xmlgraphics-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allan Andersen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (XGC-120) java.util.ConcurrentModificationException in ImageImplregistry iterator
Date Tue, 28 May 2019 11:05:00 GMT

    [ https://issues.apache.org/jira/browse/XGC-120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16849603#comment-16849603
] 

Allan Andersen commented on XGC-120:
------------------------------------

{code:java}
// Test case

@Test
public void testInternals() {
   FopFactory factory1 = createFactory();
   FopFactory factory2 = createFactory();

   Assert.assertNotEquals( factory1, factory2, "Factory comparison" );
   Assert.assertNotEquals( factory1.getImageManager(), factory2.getImageManager(), "ImageManager
comparison" );
   Assert.assertNotEquals( factory1.getImageManager().getRegistry(), factory2.getImageManager().getRegistry(),
"Registry comparison" );
}

private FopFactory createFactory() {
   FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new File(".").toURI());
   FopFactory fopFactory;
      fopFactory = fopFactoryBuilder
            .setStrictUserConfigValidation(false)
            .setStrictFOValidation(false)
            .setComplexScriptFeatures(false)
            .build();
   return fopFactory;
}


// Result is factory1.getImageManager().getRegistry() is the same as factory2.getImageManager().getRegistry()
and the test fails.{code}

> java.util.ConcurrentModificationException in ImageImplregistry iterator
> -----------------------------------------------------------------------
>
>                 Key: XGC-120
>                 URL: https://issues.apache.org/jira/browse/XGC-120
>             Project: XMLGraphicsCommons
>          Issue Type: Bug
>    Affects Versions: 2.3
>         Environment: Ubuntu
>            Reporter: Allan Andersen
>            Priority: Major
>
> 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.
> {code:java}
> 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)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Mime
View raw message