You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2022/09/20 17:14:53 UTC

svn commit: r1904173 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java

Author: tilman
Date: Tue Sep 20 17:14:53 2022
New Revision: 1904173

URL: http://svn.apache.org/viewvc?rev=1904173&view=rev
Log:
PDFBOX-5499: set threshold to 1000

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java?rev=1904173&r1=1904172&r2=1904173&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java Tue Sep 20 17:14:53 2022
@@ -51,6 +51,7 @@ public class COSDictionary extends COSBa
     private static final Log LOG = LogFactory.getLog(COSDictionary.class);
 
     private static final String PATH_SEPARATOR = "/";
+    private static final int MAP_TRESHOLD = 1000;
 
     /**
      * The name-value pairs of this dictionary. The pairs are kept in the order they were added to the dictionary.
@@ -204,7 +205,7 @@ public class COSDictionary extends COSBa
         }
         else
         {
-            if (items instanceof SmallMap && items.size() >= 100)
+            if (items instanceof SmallMap && items.size() >= MAP_TRESHOLD)
             {
                 items = new LinkedHashMap<>(items);
             }
@@ -1271,7 +1272,7 @@ public class COSDictionary extends COSBa
      */
     public void addAll(COSDictionary dict)
     {
-        if (items instanceof SmallMap && items.size() + dict.items.size() >= 100)
+        if (items instanceof SmallMap && items.size() + dict.items.size() >= MAP_TRESHOLD)
         {
             items = new LinkedHashMap<>(items);
         }