You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2020/05/17 13:26:23 UTC

svn commit: r1877859 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos: COSDocument.java COSStream.java

Author: lehmi
Date: Sun May 17 13:26:23 2020
New Revision: 1877859

URL: http://svn.apache.org/viewvc?rev=1877859&view=rev
Log:
PDFBOX-4836: replace try-catch with throws 

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java?rev=1877859&r1=1877858&r2=1877859&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java Sun May 17 13:26:23 2020
@@ -166,16 +166,17 @@ public class COSDocument extends COSBase
     }
 
     /**
-     * Creates a new COSStream using the current configuration for scratch files. Not for public use. Only COSParser
-     * should call this method.
+     * Creates a new COSStream using the current configuration for scratch files. Not for public use. Only COSParser should
+     * call this method.
      * 
-     * @param dictionary the corresponding dictionary
+     * @param dictionary    the corresponding dictionary
      * @param startPosition the start position within the source
-     * @param streamLength the stream length
+     * @param streamLength  the stream length
      * @return the new COSStream
+     * @throws IOException if the random access view can't be read
      */
     public COSStream createCOSStream(COSDictionary dictionary, long startPosition,
-            long streamLength)
+            long streamLength) throws IOException
     {
         COSStream stream = new COSStream(scratchFile,
                 parser.createRandomAccessReadView(startPosition, streamLength));

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java?rev=1877859&r1=1877858&r2=1877859&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java Sun May 17 13:26:23 2020
@@ -83,24 +83,18 @@ public class COSStream extends COSDictio
     }
 
     /**
-     * Creates a new stream with an empty dictionary. Data is read from the given random accessview. Written data is
-     * stored in the given scratch file.
+     * Creates a new stream with an empty dictionary. Data is read from the given random accessview. Written data is stored
+     * in the given scratch file.
      *
      * @param scratchFile Scratch file for writing stream data.
+     * @throws IOException if the length of the random access view isn't available
      */
     public COSStream(ScratchFile scratchFile, RandomAccessReadView randomAccessReadView)
+            throws IOException
     {
         this(scratchFile);
         this.randomAccessReadView = randomAccessReadView;
-        try
-        {
-            setInt(COSName.LENGTH, (int) randomAccessReadView.length());
-        }
-        catch (IOException e)
-        {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+        setInt(COSName.LENGTH, (int) randomAccessReadView.length());
     }
 
     /**