[Git][java-team/libsambox-java][master] 3 commits: New upstream version 2.3.1

Markus Koschany (@apo) gitlab at salsa.debian.org
Sat Nov 20 21:48:24 GMT 2021



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


Commits:
bfc4d272 by Markus Koschany at 2021-11-20T22:43:58+01:00
New upstream version 2.3.1
- - - - -
9200ee18 by Markus Koschany at 2021-11-20T22:44:00+01:00
Update upstream source from tag 'upstream/2.3.1'

Update to upstream version '2.3.1'
with Debian dir 8f4557b2c8b79db1bebd6291bf4fc169dd113380
- - - - -
5a5d4e28 by Markus Koschany at 2021-11-20T22:46:44+01:00
Update changelog

- - - - -


4 changed files:

- debian/changelog
- pom.xml
- src/main/java/org/sejda/sambox/pdmodel/PDPage.java
- src/main/java/org/sejda/sambox/pdmodel/common/PDNameTreeNode.java


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+libsambox-java (2.3.1-1) unstable; urgency=medium
+
+  * New upstream version 2.3.1.
+
+ -- Markus Koschany <apo at debian.org>  Sat, 20 Nov 2021 22:46:33 +0100
+
 libsambox-java (2.3.0-1) unstable; urgency=medium
 
   * New upstream version 2.3.0.


=====================================
pom.xml
=====================================
@@ -5,7 +5,7 @@
 	<artifactId>sambox</artifactId>
 	<packaging>jar</packaging>
 	<name>sambox</name>
-	<version>2.3.0</version>
+	<version>2.3.1</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.0</tag>
+		<tag>v2.3.1</tag>
 	</scm>
 
 	<developers>


=====================================
src/main/java/org/sejda/sambox/pdmodel/PDPage.java
=====================================
@@ -162,13 +162,13 @@ public class PDPage implements COSObjectable, PDContentStream
             for (int i = 0; i < array.size(); i++)
             {
                 COSBase baseObject = array.getObject(i);
-                if(baseObject instanceof COSStream) 
+                if (baseObject instanceof COSStream)
                 {
                     COSStream stream = (COSStream) baseObject;
                     if (nonNull(stream))
                     {
                         streams.add(new PDStream(stream));
-                    }    
+                    }
                 }
                 else
                 {
@@ -232,9 +232,9 @@ public class PDPage implements COSObjectable, PDContentStream
     {
         if (pageResources == null)
         {
-            pageResources = new PDResources(ofNullable(
-                    (COSDictionary) PDPageTree.getInheritableAttribute(page, COSName.RESOURCES, COSDictionary.class))
-                            .orElseGet(() -> {
+            pageResources = new PDResources(
+                    ofNullable((COSDictionary) PDPageTree.getInheritableAttribute(page,
+                            COSName.RESOURCES, COSDictionary.class)).orElseGet(() -> {
                                 COSDictionary emptyRes = new COSDictionary();
                                 // it's illegal for a page to not have resources, either direct or inherited. According
                                 // to the specs "If the page requires no resources, the value of this entry shall be an
@@ -322,8 +322,12 @@ public class PDPage implements COSObjectable, PDContentStream
 
     public PDRectangle getMediaBoxRaw()
     {
-        return PDRectangle
-                .rectangleFrom(page.getDictionaryObject(COSName.MEDIA_BOX, COSArray.class));
+        COSBase array = PDPageTree.getInheritableAttribute(page, COSName.MEDIA_BOX);
+        if (array instanceof COSArray)
+        {
+            return PDRectangle.rectangleFrom((COSArray) array);
+        }
+        return null;
     }
 
     /**
@@ -368,8 +372,12 @@ public class PDPage implements COSObjectable, PDContentStream
 
     public PDRectangle getCropBoxRaw()
     {
-        return PDRectangle
-                .rectangleFrom(page.getDictionaryObject(COSName.CROP_BOX, COSArray.class));
+        COSBase array = PDPageTree.getInheritableAttribute(page, COSName.CROP_BOX);
+        if (array instanceof COSArray)
+        {
+            return PDRectangle.rectangleFrom((COSArray) array);
+        }
+        return null;
     }
 
     /**
@@ -399,14 +407,10 @@ public class PDPage implements COSObjectable, PDContentStream
     {
         try
         {
-            COSBase base = page.getDictionaryObject(COSName.BLEED_BOX);
-            if (base instanceof COSArray)
+            PDRectangle trimBox = getBleedBoxRaw();
+            if (inMediaBoxBounds(trimBox))
             {
-                COSArray array = (COSArray) base;
-                if (inMediaBoxBounds(new PDRectangle(array)))
-                {
-                    return new PDRectangle((COSArray) base);
-                }
+                return trimBox;
             }
         }
         catch (Exception ex)
@@ -449,14 +453,10 @@ public class PDPage implements COSObjectable, PDContentStream
     {
         try
         {
-            COSBase base = page.getDictionaryObject(COSName.TRIM_BOX);
-            if (base instanceof COSArray)
+            PDRectangle trimBox = getTrimBoxRaw();
+            if (inMediaBoxBounds(trimBox))
             {
-                COSArray array = (COSArray) base;
-                if (inMediaBoxBounds(new PDRectangle(array)))
-                {
-                    return new PDRectangle(array);
-                }
+                return trimBox;
             }
         }
         catch (Exception ex)
@@ -499,14 +499,10 @@ public class PDPage implements COSObjectable, PDContentStream
     {
         try
         {
-            COSBase base = page.getDictionaryObject(COSName.ART_BOX);
-            if (base instanceof COSArray)
+            PDRectangle artBox = getArtBoxRaw();
+            if (inMediaBoxBounds(artBox))
             {
-                COSArray array = (COSArray) base;
-                if (inMediaBoxBounds(new PDRectangle(array)))
-                {
-                    return new PDRectangle(array);
-                }
+                return artBox;
             }
         }
         catch (Exception ex)
@@ -558,7 +554,7 @@ public class PDPage implements COSObjectable, PDContentStream
     private boolean inMediaBoxBounds(PDRectangle box)
     {
         PDRectangle mediaBox = getMediaBox();
-        return mediaBox.getLowerLeftX() <= box.getLowerLeftX()
+        return nonNull(box) && mediaBox.getLowerLeftX() <= box.getLowerLeftX()
                 && mediaBox.getLowerLeftY() <= box.getLowerLeftY()
                 && mediaBox.getUpperRightX() >= box.getUpperRightX()
                 && mediaBox.getUpperRightY() >= box.getUpperRightY();
@@ -942,7 +938,8 @@ public class PDPage implements COSObjectable, PDContentStream
         });
     }
 
-    public COSDictionary getPageTreeParent() {
+    public COSDictionary getPageTreeParent()
+    {
         return pageTreeParent;
     }
 }


=====================================
src/main/java/org/sejda/sambox/pdmodel/common/PDNameTreeNode.java
=====================================
@@ -291,7 +291,17 @@ public abstract class PDNameTreeNode<T extends COSObjectable> implements COSObje
                     continue;
                 }
                 COSBase cosValue = namesArray.getObject(i + 1);
-                names.put(key.getString(), convertCOSToPD(cosValue));
+                T pdValue = null;
+                try 
+                {
+                    pdValue = convertCOSToPD(cosValue);
+                } 
+                catch (ClassCastException ex)
+                {
+                    LOG.warn("Skipping, could not convert COS to PD: " + cosValue, ex);
+                }
+
+                names.put(key.getString(), pdValue);
             }
             return Collections.unmodifiableMap(names);
         }



View it on GitLab: https://salsa.debian.org/java-team/libsambox-java/-/compare/084764886c4e232a618efe8dc06123961f29af56...5a5d4e2861f674cdb7f927114051f4fe7d47191b

-- 
View it on GitLab: https://salsa.debian.org/java-team/libsambox-java/-/compare/084764886c4e232a618efe8dc06123961f29af56...5a5d4e2861f674cdb7f927114051f4fe7d47191b
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/20211120/6eb7cf4a/attachment.htm>


More information about the pkg-java-commits mailing list