pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1850540 - /pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
Date Sun, 06 Jan 2019 11:14:16 GMT
Author: tilman
Date: Sun Jan  6 11:14:15 2019
New Revision: 1850540

URL: http://svn.apache.org/viewvc?rev=1850540&view=rev
Log:
PDFBOX-4003: get the whole tree map with the new convenience method when testing (not relevant
in results here because these are flat, but used by myself to check the integrity of files
prior to future tests)

Modified:
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java?rev=1850540&r1=1850539&r2=1850540&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
Sun Jan  6 11:14:15 2019
@@ -525,19 +525,12 @@ public class PDFMergerUtilityTest extend
      *
      * @param document
      */
-    void checkWithNumberTree(PDDocument document)
+    void checkWithNumberTree(PDDocument document) throws IOException
     {
         PDDocumentCatalog documentCatalog = document.getDocumentCatalog();
         PDNumberTreeNode parentTree = documentCatalog.getStructureTreeRoot().getParentTree();
-        COSDictionary parentTreeDict = parentTree.getCOSObject();
-        COSArray numArray = (COSArray) parentTreeDict.getDictionaryObject(COSName.NUMS);
-        Set<Integer> keySet = new HashSet<Integer>();
-        for (int i = 0; i < numArray.size(); i += 2)
-        {
-            int key = numArray.getInt(i);
-            assertTrue(key >= 0);
-            keySet.add(key);
-        }
+        Map<Integer, COSObjectable> numberTreeAsMap = PDFMergerUtility.getNumberTreeAsMap(parentTree);
+        Set<Integer> keySet = numberTreeAsMap.keySet();
         PDAcroForm acroForm = documentCatalog.getAcroForm();
         if (acroForm != null)
         {



Mime
View raw message