You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xmlgraphics.apache.org by bu...@apache.org on 2009/09/18 12:31:15 UTC

DO NOT REPLY [Bug 47868] New: ConcurrentModificationException in ImageCache.doInvalidURIHouseKeeping()

https://issues.apache.org/bugzilla/show_bug.cgi?id=47868

           Summary: ConcurrentModificationException in
                    ImageCache.doInvalidURIHouseKeeping()
           Product: XMLGraphicsCommons
           Version: Trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Image codecs
        AssignedTo: general@xmlgraphics.apache.org
        ReportedBy: mercuron@gmx.ch


If an Image in org/apache/xmlgraphics/image/loader/cache/ImageCache.java
expires a ConcurrentModificationException will be thrown.

The cause is method "private void doInvalidURIHouseKeeping()" which loops over
the Map "this.invalidURIs" and then tries to remove an element from this map in
method "private boolean removeInvalidURIIfExpired(String uri, long timestamp)".


To reproduce the error you can add the following method to ImageCacheTestCase.

    public void testImageCacheHouseKeeping() {
        ImageCache imageCache = new ImageCache(new TimeStampProvider(), new
DefaultExpirationPolicy(1));
        imageCache.registerInvalidURI("invalid");
        imageCache.registerInvalidURI("invalid2");
        try {
            Thread.sleep(1200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        imageCache.doHouseKeeping();
    }

Stacktrace:
Caused by: java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
    at java.util.HashMap$EntryIterator.next(HashMap.java:834)
    at java.util.HashMap$EntryIterator.next(HashMap.java:832)
    at
org.apache.xmlgraphics.image.loader.cache.ImageCache.doInvalidURIHouseKeeping(ImageCache.java:294)
    at
org.apache.xmlgraphics.image.loader.cache.ImageCache.doHouseKeeping(ImageCache.java:287)
    at
org.apache.xmlgraphics.image.loader.cache.ImageCache.considerHouseKeeping(ImageCache.java:277)
    at
org.apache.xmlgraphics.image.loader.cache.ImageCache.registerInvalidURI(ImageCache.java:206)
    at
org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:129)
    at
org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:112)
    at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)
    at org.apache.fop.fo.FObj.processNode(FObj.java:123)
    at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:282)
    at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:171)
    at
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
    at org.apache.xerces.xinclude.XIncludeHandler.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.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 47868] ConcurrentModificationException in ImageCache.doInvalidURIHouseKeeping()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47868

Marco <me...@gmx.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mercuron@gmx.ch

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 47868] ConcurrentModificationException in ImageCache.doInvalidURIHouseKeeping()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47868

Max Berger <ma...@berger.name> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Max Berger <ma...@berger.name> 2009-09-18 07:16:55 PDT ---
http://svn.apache.org/viewvc?rev=816640&view=rev

Fixed. Thanks for the report and the testcase!

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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