pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1859067 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
Date Fri, 10 May 2019 08:24:48 GMT
Author: tilman
Date: Fri May 10 08:24:48 2019
New Revision: 1859067

URL: http://svn.apache.org/viewvc?rev=1859067&view=rev
Log:
PDFBOX-4540: don't construct new decoder each time, as suggested by Jonathan

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java?rev=1859067&r1=1859066&r2=1859067&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java Fri May 10
08:24:48 2019
@@ -890,15 +890,13 @@ public class COSWriter implements ICOSVi
         {
             actual = ((COSObject)obj).getObject();
         }
-        COSObjectKey key = null;
-        if( actual != null )
+        // PDFBOX-4540: because objectKeys is accessible from outside, it is possible
+        // that a COSObject obj is already in the objectKeys map.
+        COSObjectKey key = objectKeys.get(obj);
+        if( key == null && actual != null )
         {
             key = objectKeys.get(actual);
         }
-        if( key == null )
-        {
-            key = objectKeys.get(obj);
-        }
         if (key == null)
         {
             setNumber(getNumber()+1);



Mime
View raw message