Avoid a NPE if no password was given - use the default office one instead

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1494571 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2013-06-19 11:56:21 +00:00
parent 7117fe26ad
commit d80ec206c6
1 changed files with 5 additions and 0 deletions

View File

@ -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 {