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

XWikiHibernateStore ConcurrentModificationException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.2, 10.2
    • Fix Version/s: 9.11.5, 10.3
    • Component/s: Old Core
    • Labels:
      None
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      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

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

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response: