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

Markus Koschany gitlab at salsa.debian.org
Tue Nov 10 16:12:36 GMT 2020



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


Commits:
77fd3b54 by Markus Koschany at 2020-11-10T17:08:15+01:00
New upstream version 2.2.4
- - - - -


6 changed files:

- pom.xml
- src/main/java/org/sejda/sambox/pdmodel/PDDocument.java
- src/main/java/org/sejda/sambox/pdmodel/PDPage.java
- src/main/java/org/sejda/sambox/pdmodel/font/PDCIDFontType2Embedder.java
- src/main/java/org/sejda/sambox/pdmodel/interactive/documentnavigation/destination/PDPageXYZDestination.java
- src/main/java/org/sejda/sambox/pdmodel/interactive/form/PDAcroForm.java


Changes:

=====================================
pom.xml
=====================================
@@ -5,7 +5,7 @@
 	<artifactId>sambox</artifactId>
 	<packaging>jar</packaging>
 	<name>sambox</name>
-	<version>2.2.3</version>
+	<version>2.2.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.2.3</tag>
+		<tag>v2.2.4</tag>
 	</scm>
 
 	<developers>
@@ -1093,7 +1093,7 @@
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
-			<version>4.12</version>
+			<version>4.13.1</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>


=====================================
src/main/java/org/sejda/sambox/pdmodel/PDDocument.java
=====================================
@@ -595,7 +595,11 @@ public class PDDocument implements Closeable
         getDocumentInformation().setModificationDate(Calendar.getInstance());
         for (Subsettable font : fontsToSubset)
         {
-            font.subset();
+            try {
+                font.subset();
+            } catch (Exception e) {
+                LOG.warn("Exception occurred while subsetting font: " + font, e);
+            }
         }
         fontsToSubset.clear();
         Optional<EncryptionContext> encryptionContext = ofNullable(


=====================================
src/main/java/org/sejda/sambox/pdmodel/PDPage.java
=====================================
@@ -148,10 +148,18 @@ public class PDPage implements COSObjectable, PDContentStream
             COSArray array = (COSArray) base;
             for (int i = 0; i < array.size(); i++)
             {
-                COSStream stream = (COSStream) array.getObject(i);
-                if (nonNull(stream))
+                COSBase baseObject = array.getObject(i);
+                if(baseObject instanceof COSStream) 
                 {
-                    streams.add(new PDStream(stream));
+                    COSStream stream = (COSStream) baseObject;
+                    if (nonNull(stream))
+                    {
+                        streams.add(new PDStream(stream));
+                    }    
+                }
+                else
+                {
+                    LOG.warn("Page has contents object that is not a stream: " + baseObject);
                 }
             }
         }


=====================================
src/main/java/org/sejda/sambox/pdmodel/font/PDCIDFontType2Embedder.java
=====================================
@@ -95,9 +95,6 @@ final class PDCIDFontType2Embedder extends TrueTypeEmbedder
             // build GID -> Unicode map
             buildToUnicodeCMap(null);
         }
-
-        // ToUnicode CMap
-        buildToUnicodeCMap(null);
     }
 
     /**


=====================================
src/main/java/org/sejda/sambox/pdmodel/interactive/documentnavigation/destination/PDPageXYZDestination.java
=====================================
@@ -24,9 +24,8 @@ import org.sejda.sambox.cos.COSName;
 import org.sejda.sambox.cos.COSNumber;
 
 /**
- * This represents a destination to a page at an x,y coordinate with a zoom setting.
- * The default x,y,z will be whatever is the current value in the viewer application and
- * are not required.
+ * This represents a destination to a page at an x,y coordinate with a zoom setting. The default x,y,z will be whatever
+ * is the current value in the viewer application and are not required.
  *
  * @author Ben Litchfield
  */
@@ -37,10 +36,6 @@ public class PDPageXYZDestination extends PDPageDestination
      */
     protected static final String TYPE = "XYZ";
 
-    /**
-     * Default constructor.
-     *
-     */
     public PDPageXYZDestination()
     {
         super();
@@ -53,31 +48,29 @@ public class PDPageXYZDestination extends PDPageDestination
      *
      * @param arr The destination array.
      */
-    public PDPageXYZDestination( COSArray arr )
+    public PDPageXYZDestination(COSArray arr)
     {
-        super( arr );
+        super(arr);
     }
 
     /**
-     * Get the left x coordinate.  Return values of 0 or -1 imply that the current x-coordinate
-     * will be used.
-     *
-     * @return The left x coordinate.
+     * @return The left x coordinate. A value of -1 implies that the current x-coordinate will be used.
      */
     public int getLeft()
     {
-        return array.getInt( 2 );
+        return array.getInt(2);
     }
 
     /**
-     * Set the left x-coordinate, values 0 or -1 imply that the current x-coordinate
-     * will be used.
+     * Set the left x-coordinate, a value of -1 implies that null will be used and the current x-coordinate will be
+     * used.
+     * 
      * @param x The left x coordinate.
      */
-    public void setLeft( int x )
+    public void setLeft(int x)
     {
-        array.growToSize( 3 );
-        if( x == -1 )
+        array.growToSize(3);
+        if (x == -1)
         {
             array.set(2, null);
         }
@@ -88,25 +81,22 @@ public class PDPageXYZDestination extends PDPageDestination
     }
 
     /**
-     * Get the top y coordinate.  Return values of 0 or -1 imply that the current y-coordinate
-     * will be used.
-     *
-     * @return The top y coordinate.
+     * @return The top y coordinate. A value of -1 implies that the current y-coordinate will be used.
      */
     public int getTop()
     {
-        return array.getInt( 3 );
+        return array.getInt(3);
     }
 
     /**
-     * Set the top y-coordinate, values 0 or -1 imply that the current y-coordinate
-     * will be used.
+     * Set the top y-coordinate, a value of -1 implies that null will be used and the current y-coordinate will be used.
+     * 
      * @param y The top ycoordinate.
      */
-    public void setTop( int y )
+    public void setTop(int y)
     {
-        array.growToSize( 4 );
-        if( y == -1 )
+        array.growToSize(4);
+        if (y == -1)
         {
             array.set(3, null);
         }
@@ -117,10 +107,8 @@ public class PDPageXYZDestination extends PDPageDestination
     }
 
     /**
-     * Get the zoom value.  Return values of 0 or -1 imply that the current zoom
-     * will be used.
      *
-     * @return The zoom value for the page.
+     * @return The zoom value for the page. Values of 0 or -1 imply that the current zoom will be used
      */
     public float getZoom()
     {
@@ -133,20 +121,20 @@ public class PDPageXYZDestination extends PDPageDestination
     }
 
     /**
-     * Set the zoom value for the page, values 0 or -1 imply that the current zoom
-     * will be used.
+     * Set the zoom value for the page, values 0 or -1 imply that the current zoom will be used.
+     * 
      * @param zoom The zoom value.
      */
-    public void setZoom( float zoom )
+    public void setZoom(float zoom)
     {
-        array.growToSize( 5 );
-        if( zoom == -1 )
+        array.growToSize(5);
+        if (zoom == -1)
         {
             array.set(4, null);
         }
         else
         {
-            array.set( 4, new COSFloat(zoom) );
+            array.set(4, new COSFloat(zoom));
         }
     }
 }


=====================================
src/main/java/org/sejda/sambox/pdmodel/interactive/form/PDAcroForm.java
=====================================
@@ -19,11 +19,15 @@ package org.sejda.sambox.pdmodel.interactive.form;
 import static java.util.Objects.isNull;
 import static java.util.Objects.nonNull;
 import static java.util.Optional.ofNullable;
-import static java.util.function.Function.identity;
-import static java.util.stream.Collectors.toMap;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 import org.sejda.sambox.cos.COSArray;
@@ -705,14 +709,14 @@ public final class PDAcroForm extends PDDictionaryWrapper
     private Map<COSDictionary, PDAnnotationWidget> widgets(List<PDField> fields)
     {
         Map<COSDictionary, PDAnnotationWidget> widgetMap = new HashMap<>();
-        for(PDField field: fields) 
+        for (PDField field : fields)
         {
-            for(PDAnnotationWidget widget: field.getWidgets())
+            for (PDAnnotationWidget widget : field.getWidgets())
             {
                 widgetMap.put(widget.getCOSObject(), widget);
             }
         }
-        
+
         return widgetMap;
     }
 



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

-- 
View it on GitLab: https://salsa.debian.org/java-team/libsambox-java/-/commit/77fd3b543e29e733f0379dbf101dc8ce1eca4aa6
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/20201110/e5437c82/attachment.html>


More information about the pkg-java-commits mailing list