pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1850053 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java
Date Mon, 31 Dec 2018 15:22:31 GMT
Author: tilman
Date: Mon Dec 31 15:22:31 2018
New Revision: 1850053

URL: http://svn.apache.org/viewvc?rev=1850053&view=rev
Log:
PDFBOX-4003: correct calculation of missing destParentTreeNextKey

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java?rev=1850053&r1=1850052&r2=1850053&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFMergerUtility.java Mon
Dec 31 15:22:31 2018
@@ -715,8 +715,15 @@ public class PDFMergerUtility
                 {
                     if (destParentTreeNextKey < 0)
                     {
-                        //TODO this is not correct. Needs to search the tree and put last
+ 1 here
-                        destParentTreeNextKey = destNumbersArray.size() / 2;
+                        Map<Integer, COSObjectable> numberTreeAsMap = getNumberTreeAsMap(destParentTree);
+                        if (numberTreeAsMap.isEmpty())
+                        {
+                            destParentTreeNextKey = 0;
+                        }
+                        else
+                        {
+                            destParentTreeNextKey = Collections.max(numberTreeAsMap.keySet())
+ 1;
+                        }
                     }
                     if (destParentTreeNextKey > 0 && srcStructTree != null)
                     {



Mime
View raw message