You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/05/13 09:55:56 UTC
svn commit: r1889827 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java
Author: tilman
Date: Thu May 13 09:55:56 2021
New Revision: 1889827
URL: http://svn.apache.org/viewvc?rev=1889827&view=rev
Log:
PDFBOX-4892: don't cache null keys, as suggested by valerybokov
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java?rev=1889827&r1=1889826&r2=1889827&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDResources.java Thu May 13 09:55:56 2021
@@ -201,7 +201,7 @@ public final class PDResources implement
}
// we can't cache PDPattern, because it holds page resources, see PDFBOX-2370
- if (cache != null && !(colorSpace instanceof PDPattern))
+ if (cache != null && indirect != null && !(colorSpace instanceof PDPattern))
{
cache.put(indirect, colorSpace);
}
@@ -244,7 +244,7 @@ public final class PDResources implement
extGState = new PDExtendedGraphicsState((COSDictionary) base);
}
- if (cache != null)
+ if (cache != null && indirect != null)
{
cache.put(indirect, extGState);
}
@@ -277,7 +277,7 @@ public final class PDResources implement
shading = PDShading.create((COSDictionary) base);
}
- if (cache != null)
+ if (cache != null && indirect != null)
{
cache.put(indirect, shading);
}
@@ -310,7 +310,7 @@ public final class PDResources implement
pattern = PDAbstractPattern.create((COSDictionary) base, getResourceCache());
}
- if (cache != null)
+ if (cache != null && indirect != null)
{
cache.put(indirect, pattern);
}
@@ -342,7 +342,7 @@ public final class PDResources implement
propertyList = PDPropertyList.create((COSDictionary) base);
}
- if (cache != null)
+ if (cache != null && indirect != null)
{
cache.put(indirect, propertyList);
}
@@ -408,7 +408,7 @@ public final class PDResources implement
{
xobject = PDXObject.createXObject(value, this);
}
- if (cache != null && isAllowedCache(xobject))
+ if (cache != null && indirect != null && isAllowedCache(xobject))
{
cache.put(indirect, xobject);
}