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);
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