You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by cb...@apache.org on 2007/11/12 18:25:42 UTC

svn commit: r594223 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyCache.java

Author: cbowditch
Date: Mon Nov 12 09:25:41 2007
New Revision: 594223

URL: http://svn.apache.org/viewvc?rev=594223&view=rev
Log:
bug fix: avoid NPE when GC has removed a weak reference in the Property Cache

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyCache.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyCache.java?rev=594223&r1=594222&r2=594223&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyCache.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/PropertyCache.java Mon Nov 12 09:25:41 2007
@@ -273,11 +273,13 @@
                     for (int i = table.length; --i >= 0;) {
                         for (CacheEntry c = table[i]; c != null; c = c.next) {
                             ref = c.ref;
-                            if ((o = ref.get()) != null) {
-                                hash = hash(o);
-                                idx = hash & newLength;
-                                newTable[idx] = new CacheEntry(c, newTable[idx]);
-                                segments[hash & SEGMENT_MASK].count++;
+                            if (ref != null) {
+                                if ((o = ref.get()) != null) {
+                                    hash = hash(o);
+                                    idx = hash & newLength;
+                                    newTable[idx] = new CacheEntry(c, newTable[idx]);
+                                    segments[hash & SEGMENT_MASK].count++;
+                                }
                             }
                         }
                     }



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