From: Adrian Cumiskey Date: Mon, 21 Jul 2008 12:58:18 +0000 (+0000) Subject: Must synchronize on cacheMap when removing DataObjectCache instance. X-Git-Tag: fop-1_0~376^2~123 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=211db11e016d196c2b7960ccbf66be7a83460b9e;p=xmlgraphics-fop.git Must synchronize on cacheMap when removing DataObjectCache instance. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@678405 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/render/afp/DataObjectCache.java b/src/java/org/apache/fop/render/afp/DataObjectCache.java index f2631f0cd..c8129baf2 100644 --- a/src/java/org/apache/fop/render/afp/DataObjectCache.java +++ b/src/java/org/apache/fop/render/afp/DataObjectCache.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; +import java.util.Collections; import java.util.Map; import org.apache.commons.logging.Log; @@ -48,6 +49,7 @@ public final class DataObjectCache { private static Map/**/ cacheMap = new java.util.HashMap/**/(); + /** Mapping of data object uri --> cache record */ private Map/**/ includableMap = new java.util.HashMap/**/(); @@ -110,7 +112,9 @@ public final class DataObjectCache { try { raFile.close(); tempFile.delete(); - cacheMap.remove(id); // remove ourselves from the cache map + synchronized (cacheMap) { + cacheMap.remove(id); // remove ourselves from the cache map + } } catch (IOException e) { log.error("Failed to close temporary file"); }