You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2013/06/19 13:56:21 UTC

svn commit: r1494571 - /poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java

Author: nick
Date: Wed Jun 19 11:56:21 2013
New Revision: 1494571

URL: http://svn.apache.org/r1494571
Log:
Avoid a NPE if no password was given - use the default office one instead

Modified:
    poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java

Modified: poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java?rev=1494571&r1=1494570&r2=1494571&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java Wed Jun 19 11:56:21 2013
@@ -96,6 +96,11 @@ public abstract class Decryptor {
 
     protected byte[] hashPassword(EncryptionInfo info,
                                   String password) throws NoSuchAlgorithmException {
+        // If no password was given, use the default
+        if (password == null) {
+            password = DEFAULT_PASSWORD;
+        }
+        
         MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
         byte[] bytes;
         try {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org