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/08 14:52:20 UTC

svn commit: r1637566 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java

Author: lehmi
Date: Sat Nov  8 13:52:20 2014
New Revision: 1637566

URL: http://svn.apache.org/r1637566
Log:
PDFBOX-2490: clarify the meaning of the return value of isEncrypted, added isDecrypted

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java?rev=1637566&r1=1637565&r2=1637566&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java Sat Nov  8 13:52:20 2014
@@ -358,14 +358,27 @@ public class COSDocument extends COSBase
         return version;
     }
 
-    /** Signals that the document is decrypted completely.
+    /** 
+     * Signals that the document is decrypted completely.
      *  Needed e.g. by {@link org.apache.pdfbox.pdfparser.NonSequentialPDFParser} to circumvent
-     *  additional decryption later on. */
+     *  additional decryption later on.
+     */
     public void setDecrypted()
     {
         isDecrypted = true;
     }
 
+    /** 
+     * Indicates if a encrypted pdf is already decrypted after parsing.
+     * Does make sense only if the {@link org.apache.pdfbox.pdfparser.NonSequentialPDFParser} is used.
+     * 
+     *  @return true indicates that the pdf is decrypted.
+     */
+    public boolean isDecrypted()
+    {
+        return isDecrypted;
+    }
+    
     /**
      * This will tell if this is an encrypted document.
      *
@@ -373,10 +386,6 @@ public class COSDocument extends COSBase
      */
     public boolean isEncrypted()
     {
-        if ( isDecrypted )
-        {
-            return false;
-        }
         boolean encrypted = false;
         if( trailer != null )
         {