pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1813074 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Date Mon, 23 Oct 2017 20:07:49 GMT
Author: lehmi
Date: Mon Oct 23 20:07:48 2017
New Revision: 1813074

URL: http://svn.apache.org/viewvc?rev=1813074&view=rev
Log:
PDFBOX-3976: eliminate the root issue instead of avoiding the NPE

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1813074&r1=1813073&r2=1813074&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Mon
Oct 23 20:07:48 2017
@@ -1660,7 +1660,7 @@ public class COSParser extends BaseParse
                         int genNumber = ((COSObject) infoObj).getGenerationNumber();
                         trailerKeys[1] = new COSObjectKey(objNumber, genNumber);
                     }
-                    if (trailerKeys[0] != null || trailerKeys[1] != null)
+                    if (trailerKeys[0] != null && trailerKeys[1] != null)
                     {
                         trailerDicts.add(trailerKeys);
                     }
@@ -1678,15 +1678,12 @@ public class COSParser extends BaseParse
         if (trailerdictsSize > 1)
         {
             COSObjectKey[] first = trailerDicts.get(0);
-            if (first[0] != null && first[1] != null)
+            for (int i = trailerdictsSize - 1; i > 0; i--)
             {
-                for (int i = trailerdictsSize - 1; i > 0; i--)
+                COSObjectKey[] other = trailerDicts.get(i);
+                if (first[0].equals(other[0]) && first[1].equals(other[1]))
                 {
-                    COSObjectKey[] other = trailerDicts.get(i);
-                    if (first[0].equals(other[0]) && first[1].equals(other[1]))
-                    {
-                        trailerDicts.remove(other);
-                    }
+                    trailerDicts.remove(other);
                 }
             }
         }



Mime
View raw message