You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/12/04 07:16:01 UTC

svn commit: r1884087 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java

Author: lehmi
Date: Fri Dec  4 07:16:01 2020
New Revision: 1884087

URL: http://svn.apache.org/viewvc?rev=1884087&view=rev
Log:
PDFBOX-4999: don't skip size values when merging COSDictionaries as proposed by Michael Klink

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java?rev=1884087&r1=1884086&r2=1884087&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java Fri Dec  4 07:16:01 2020
@@ -1435,23 +1435,16 @@ public class COSDictionary extends COSBa
     }
 
     /**
-     * This will add all of the dictionaries keys/values to this dictionary.
-     * Only called when adding keys to a trailer that already exists.
+     * This will add all of the dictionaries keys/values to this dictionary. Existing key/value pairs will be
+     * overwritten.
      *
-     * @param dic The dictionaries to get the keys from.
+     * @param dic The dictionaries to get the key/value pairs from.
      */
     public void addAll(COSDictionary dic)
     {
         for (Map.Entry<COSName, COSBase> entry : dic.entrySet())
         {
-            /*
-             * If we're at a second trailer, we have a linearized pdf file, meaning that the first Size entry represents
-             * all of the objects so we don't need to grab the second.
-             */
-            if (!COSName.SIZE.equals(entry.getKey()) || !items.containsKey(COSName.SIZE))
-            {
-                setItem(entry.getKey(), entry.getValue());
-            }
+            setItem(entry.getKey(), entry.getValue());
         }
     }