ConcurrentModificationException in MPrintFormat.getAllItems Method

Description

Just found one issue in org.compiere.print.MPrintFormat, it will throw java.util.ConcurrentModificationException, tested in https://test.idempiere.org

java.util.ConcurrentModificationException
at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967)
at org.compiere.print.MPrintFormat.getAllItems(MPrintFormat.java:303)

The relative code is:

Should be changed as below to avoid ConcurrentModificationException:

MRole role = MRole.getDefault(getCtx(), false); List<MPrintFormatItem> removedList = new ArrayList<MPrintFormatItem>(); for (MPrintFormatItem pfi : list) { if (! role.isColumnAccess(getAD_Table_ID(), pfi.getAD_Column_ID(), true)) removedList.add(pfi); } list.removeAll(removedList);

please help to validate, thanks!

BR,

Ken

Environment

None

Attachments

1

Activity

Anozi Mada 
May 30, 2022 at 9:37 AM

I created a pull request but with removeIf here https://github.com/idempiere/idempiere/pull/1349

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created May 7, 2022 at 2:58 PM
Updated August 1, 2022 at 5:58 PM
Resolved June 11, 2022 at 12:16 PM