pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1844727 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Date Wed, 24 Oct 2018 06:36:56 GMT
Author: tilman
Date: Wed Oct 24 06:36:56 2018
New Revision: 1844727

URL: http://svn.apache.org/viewvc?rev=1844727&view=rev
Log:
PDFBOX-4071: use new convenience method

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1844727&r1=1844726&r2=1844727&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Wed Oct 24
06:36:56 2018
@@ -1698,29 +1698,23 @@ public class COSParser extends BaseParse
                     skipSpaces();
                     COSDictionary trailerDict = parseCOSDictionary();
                     StringBuilder trailerKeys = new StringBuilder();
-                    if (trailerDict.containsKey(COSName.ROOT))
+                    COSObject rootObj = trailerDict.getCOSObject(COSName.ROOT);
+                    if (rootObj != null)
                     {
-                        COSBase rootObj = trailerDict.getItem(COSName.ROOT);
-                        if (rootObj instanceof COSObject)
-                        {
-                            long objNumber = ((COSObject) rootObj).getObjectNumber();
-                            int genNumber = ((COSObject) rootObj).getGenerationNumber();
-                            trailerKeys.append(objNumber).append(" ");
-                            trailerKeys.append(genNumber).append(" ");
-                            rootFound = true;
-                        }
+                        long objNumber = rootObj.getObjectNumber();
+                        int genNumber = rootObj.getGenerationNumber();
+                        trailerKeys.append(objNumber).append(" ");
+                        trailerKeys.append(genNumber).append(" ");
+                        rootFound = true;
                     }
-                    if (trailerDict.containsKey(COSName.INFO))
+                    COSObject infoObj = trailerDict.getCOSObject(COSName.INFO);
+                    if (infoObj != null)
                     {
-                        COSBase infoObj = trailerDict.getItem(COSName.INFO);
-                        if (infoObj instanceof COSObject)
-                        {
-                            long objNumber = ((COSObject) infoObj).getObjectNumber();
-                            int genNumber = ((COSObject) infoObj).getGenerationNumber();
-                            trailerKeys.append(objNumber).append(" ");
-                            trailerKeys.append(genNumber).append(" ");
-                            infoFound = true;
-                        }
+                        long objNumber = infoObj.getObjectNumber();
+                        int genNumber = infoObj.getGenerationNumber();
+                        trailerKeys.append(objNumber).append(" ");
+                        trailerKeys.append(genNumber).append(" ");
+                        infoFound = true;
                     }
                     if (rootFound && infoFound)
                     {



Mime
View raw message