Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
2.3
-
None
-
None
-
None
-
Ubuntu
Description
I get this ConcurrentModificationException when running a multithreaded testcase.
The problem is related to the preloaders (ArrayList) in ImageImplRegistry which isn't threadsafe. Using CopyOnWriteArrayList is a quick solution to the issue.
The other lists/maps are using the same non-threadsafe implementations. CopyOnWriteArrayList and ConcurrentHashMap works better.
Stacktrace: Caused by: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909) at java.util.ArrayList$Itr.next(ArrayList.java:859) at org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry$MyIterator.next(ImageImplRegistry.java:267) at org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:175) at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:127) at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123) at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81) at org.apache.fop.fo.FObj.processNode(FObj.java:126) at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:291) at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:179) at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:485)