pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1671490 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser: COSParser.java FDFParser.java PDFParser.java
Date Mon, 06 Apr 2015 06:57:26 GMT
Author: tilman
Date: Mon Apr  6 06:57:26 2015
New Revision: 1671490

URL: http://svn.apache.org/r1671490
Log:
PDFBOX-2576: remove creation of empty input stream that is overwritten in later initialization,
add default constructor to COSParser instead

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/FDFParser.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1671490&r1=1671489&r2=1671490&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Mon Apr 
6 06:57:26 2015
@@ -148,6 +148,13 @@ public class COSParser extends BaseParse
     public static final String TMP_FILE_PREFIX = "tmpPDF";
     
     /**
+     * Default constructor.
+     */
+    public COSParser()
+    {
+    }
+
+    /**
      * Constructor.
      * 
      * @param input inputStream of the pdf to be read
@@ -1793,6 +1800,7 @@ public class COSParser extends BaseParse
      */
     private void parseXrefStream(COSStream stream, long objByteOffset, boolean isStandalone)
throws IOException
     {
+//LOG.info ("parseXrefStream: objByteOffset = " + objByteOffset);
         // the cross reference stream of a hybrid xref table will be added to the existing
one
         // and we must not override the offset and the trailer
         if ( isStandalone )

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/FDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/FDFParser.java?rev=1671490&r1=1671489&r2=1671490&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/FDFParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/FDFParser.java Mon Apr 
6 06:57:26 2015
@@ -16,7 +16,6 @@
  */
 package org.apache.pdfbox.pdfparser;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -39,8 +38,6 @@ public class FDFParser extends COSParser
 
     private final RandomAccessBufferedFileInputStream raStream;
 
-    private static final InputStream EMPTY_INPUT_STREAM = new ByteArrayInputStream(new byte[0]);
-
     private File tempPDFFile;
 
     /**
@@ -65,7 +62,6 @@ public class FDFParser extends COSParser
      */
     public FDFParser(File file) throws IOException
     {
-        super(EMPTY_INPUT_STREAM);
         fileLen = file.length();
         raStream = new RandomAccessBufferedFileInputStream(file);
         init();
@@ -79,7 +75,6 @@ public class FDFParser extends COSParser
      */
     public FDFParser(InputStream input) throws IOException
     {
-        super(EMPTY_INPUT_STREAM);
         tempPDFFile = createTmpFile(input);
         fileLen = tempPDFFile.length();
         raStream = new RandomAccessBufferedFileInputStream(tempPDFFile);

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java?rev=1671490&r1=1671489&r2=1671490&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java Mon Apr 
6 06:57:26 2015
@@ -16,7 +16,6 @@
  */
 package org.apache.pdfbox.pdfparser;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -51,8 +50,6 @@ public class PDFParser extends COSParser
 
     private AccessPermission accessPermission;
 
-    private static final InputStream EMPTY_INPUT_STREAM = new ByteArrayInputStream(new byte[0]);
-
     private File tempPDFFile;
 
     /**
@@ -165,7 +162,6 @@ public class PDFParser extends COSParser
     public PDFParser(File file, String decryptionPassword, InputStream keyStore, String alias,
             boolean useScratchFiles) throws IOException
     {
-        super(EMPTY_INPUT_STREAM);
         fileLen = file.length();
         raStream = new RandomAccessBufferedFileInputStream(file);
         password = decryptionPassword;
@@ -255,7 +251,6 @@ public class PDFParser extends COSParser
     public PDFParser(InputStream input, String decryptionPassword, InputStream keyStore,
             String alias, boolean useScratchFiles) throws IOException
     {
-        super(EMPTY_INPUT_STREAM);
         tempPDFFile = createTmpFile(input);
         fileLen = tempPDFFile.length();
         raStream = new RandomAccessBufferedFileInputStream(tempPDFFile);



Mime
View raw message