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 2014/11/24 20:35:17 UTC

svn commit: r1641449 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java

Author: lehmi
Date: Mon Nov 24 19:35:16 2014
New Revision: 1641449

URL: http://svn.apache.org/r1641449
Log:
PDFBOX-2520: don't automatically decrypt encrypted pdfs, this shall be done by the parser/user before using PDFTextStripper

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java?rev=1641449&r1=1641448&r2=1641449&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java Mon Nov 24 19:35:16 2014
@@ -36,8 +36,6 @@ import java.util.regex.Pattern;
 
 import org.apache.pdfbox.cos.COSDocument;
 import org.apache.pdfbox.cos.COSStream;
-import org.apache.pdfbox.exceptions.CryptographyException;
-import org.apache.pdfbox.exceptions.WrappedIOException;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.common.COSObjectable;
@@ -343,24 +341,6 @@ public class PDFTextStripper extends PDF
             articleEnd = lineSeparator;
         }
         startDocument(document);
-
-        if( document.isEncrypted() )
-        {
-            // We are expecting non-encrypted documents here, but it is common
-            // for users to pass in a document that is encrypted with an empty
-            // password (such a document appears to not be encrypted by
-            // someone viewing the document, thus the confusion).  We will
-            // attempt to decrypt with the empty password to handle this case.
-            //
-            try
-            {
-                document.decrypt("");
-            }
-            catch (CryptographyException e)
-            {
-                throw new WrappedIOException("Error decrypting document, details: ", e);
-            }
-        }
         processPages( document.getDocumentCatalog().getAllPages() );
         endDocument(document);
     }