Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-15161

XWikiHibernateStore ConcurrentModificationException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 9.11.5, 10.3
    • 2.7.2, 10.2
    • Old Core
    • None
    • Unknown
    • N/A
    • N/A

    Description

      In XWikiHibernateStore#loadXWikiCollectionInternal we find the following code block (Line 1367 - 1382), collecting properties already handled by custom mapping:

      List<String> handledProps = new ArrayList<String>();
      try {
      	...
      	handledProps = bclass.getCustomMappingPropertyList(context);
      	for (String prop : handledProps) {
      		if (((Map) map).get(prop) == null) {
      			handledProps.remove(prop);
      		}
      	}
      } catch (Exception e) {
      }
      

      Max one property can be removed from handledProps, the second java.util.ArrayList$Itr.next call after the first remove causes a ConcurrentModificationException. This potentially causes issues for partially custom-mapped classes (at least 2 fields).

      This bug exists since at least 2.7.2 but can also be found in the current master branch. It was hard to notice and debug because the exception is catched but not logged, even unchecked ones due to catch (Exception e) (a really bad idea).

      Attachments

        Activity

          People

            msladek Marc Sladek
            msladek Marc Sladek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: