[Git][java-team/libsambox-java][upstream] New upstream version 2.3.4

Markus Koschany (@apo) gitlab at salsa.debian.org
Sat Dec 25 20:18:54 GMT 2021



Markus Koschany pushed to branch upstream at Debian Java Maintainers / libsambox-java


Commits:
ce6fd040 by Markus Koschany at 2021-12-25T21:14:42+01:00
New upstream version 2.3.4
- - - - -


5 changed files:

- pom.xml
- src/main/java/org/sejda/sambox/pdmodel/PDPageTree.java
- src/main/java/org/sejda/sambox/pdmodel/common/PDNameTreeNode.java
- src/main/java/org/sejda/sambox/pdmodel/graphics/shading/AxialShadingContext.java
- src/main/java/org/sejda/sambox/pdmodel/interactive/form/PDButton.java


Changes:

=====================================
pom.xml
=====================================
@@ -5,7 +5,7 @@
 	<artifactId>sambox</artifactId>
 	<packaging>jar</packaging>
 	<name>sambox</name>
-	<version>2.3.1</version>
+	<version>2.3.4</version>
 
 	<description>An Apache PDFBox fork intended to be used as PDF processor for Sejda and PDFsam related projects</description>
 	<url>http://www.sejda.org</url>
@@ -33,7 +33,7 @@
 		<connection>scm:git:git at github.com:torakiki/sambox.git</connection>
 		<developerConnection>scm:git:git at github.com:torakiki/sambox.git</developerConnection>
 		<url>scm:git:git at github.com:torakiki/sambox.git</url>
-		<tag>v2.3.1</tag>
+		<tag>v2.3.4</tag>
 	</scm>
 
 	<developers>


=====================================
src/main/java/org/sejda/sambox/pdmodel/PDPageTree.java
=====================================
@@ -470,7 +470,7 @@ public class PDPageTree implements COSObjectable, Iterable<PDPage>
     public void remove(int index)
     {
         PageAndPageTreeParent res = get(index + 1, root, 0, null);
-        remove(res.node);
+        remove(res.node, res.parent);
     }
 
     /**
@@ -487,14 +487,32 @@ public class PDPageTree implements COSObjectable, Iterable<PDPage>
      * Removes the given COS page.
      */
     private void remove(COSDictionary node)
+    {
+        remove(node, null);
+    }
+
+    /**
+     * Removes the given COS page.
+     */
+    private void remove(COSDictionary node, COSDictionary knownParent)
     {
         // remove from parent's kids
         COSDictionary parent = node.getDictionaryObject(COSName.PARENT, COSName.P,
                 COSDictionary.class);
+        
+        if(parent == null)
+        {
+            // broken node with missing PARENT, use the one known from traversing the page tree
+            parent = knownParent;
+        }
+        
         COSArray kids = parent.getDictionaryObject(COSName.KIDS, COSArray.class);
         if (kids.removeObject(node))
         {
             // update ancestor counts
+            parent.setInt(COSName.COUNT, parent.getInt(COSName.COUNT) - 1);
+            node = parent;
+            
             do
             {
                 node = node.getDictionaryObject(COSName.PARENT, COSName.P, COSDictionary.class);


=====================================
src/main/java/org/sejda/sambox/pdmodel/common/PDNameTreeNode.java
=====================================
@@ -246,7 +246,7 @@ public abstract class PDNameTreeNode<T extends COSObjectable> implements COSObje
                 return names.get(name);
             }
         }
-        catch (IOException e)
+        catch (IOException | ClassCastException e)
         {
             LOG.warn("NameTreeNode couldn't get the names map", e);
         }


=====================================
src/main/java/org/sejda/sambox/pdmodel/graphics/shading/AxialShadingContext.java
=====================================
@@ -115,6 +115,7 @@ public class AxialShadingContext extends ShadingContext implements PaintContext
         {
             LOG.error(ex.getMessage() + ", matrix: " + matrix, ex);
             LOG.error(ex.getMessage(), ex);
+            rat = new AffineTransform();
         }
 
         // shading space -> device space


=====================================
src/main/java/org/sejda/sambox/pdmodel/interactive/form/PDButton.java
=====================================
@@ -441,12 +441,6 @@ public abstract class PDButton extends PDTerminalField
         List<String> options = getExportValues();
         Set<String> uniqueOptions = new HashSet<>(options);
 
-        if (widgets.size() != options.size() && uniqueOptions.size() > 1)
-        {
-            throw new IllegalArgumentException(
-                    "The number of options doesn't match the number of widgets");
-        }
-
         if (value.equals(COSName.Off.getName()))
         {
             updateByValue(value);
@@ -465,8 +459,16 @@ public abstract class PDButton extends PDTerminalField
                 if (onValue != null)
                 {
                     updateByValue(onValue);
+                    return;
                 }
             }
+
+            // we reach here if update failed
+            if (widgets.size() != options.size() && uniqueOptions.size() > 1)
+            {
+                throw new IllegalArgumentException(
+                        "The number of options doesn't match the number of widgets");
+            }
         }
     }
 }



View it on GitLab: https://salsa.debian.org/java-team/libsambox-java/-/commit/ce6fd04071889a60e3f0bd290bcf8ccd2fe48d34

-- 
View it on GitLab: https://salsa.debian.org/java-team/libsambox-java/-/commit/ce6fd04071889a60e3f0bd290bcf8ccd2fe48d34
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20211225/5d1b6728/attachment.htm>


More information about the pkg-java-commits mailing list