poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1494571 - /poi/trunk/src/java/org/apache/poi/poifs/crypt/Decryptor.java
Date Wed, 19 Jun 2013 11:56:21 GMT
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


Mime
View raw message