pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1641210 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
Date Sun, 23 Nov 2014 16:11:32 GMT
Author: lehmi
Date: Sun Nov 23 16:11:31 2014
New Revision: 1641210

URL: http://svn.apache.org/r1641210
Log:
PDFBOX-2469: avoid calling InputStream#available as proposed by Thomas Chojecki

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
  (contents, props changed)

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java?rev=1641210&r1=1641209&r2=1641210&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
Sun Nov 23 16:11:31 2014
@@ -346,15 +346,9 @@ public abstract class SecurityHandler
                 byte[] buffer = new byte[256];
                 for (int n = 0; -1 != (n = data.read(buffer));)
                 {
-                    if (data.available() > 0)
-                    {
-                        output.write(decryptCipher.update(buffer, 0, n));
-                    }
-                    else
-                    {
-                        output.write(decryptCipher.doFinal(buffer, 0, n));
-                    }
+                    output.write(decryptCipher.update(buffer, 0, n));
                 }
+                output.write(decryptCipher.doFinal());
             }
             catch (InvalidKeyException e)
             {

Propchange: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
------------------------------------------------------------------------------
  Merged /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java:r1641208



Mime
View raw message