Author: nick
Date: Wed Jun 19 12:02:07 2013
New Revision: 1494573
URL: http://svn.apache.org/r1494573
Log:
The Office Parser has a default password it can use, so if the PasswordProvider
can't provide one (i.e. if it returns null for the password), keep going with
the default rather than passing a null password through to POI (which doesn't
like that)
Modified:
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/OfficeParser.java
Modified:
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/OfficeParser.java
URL:
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/OfficeParser.java?rev=1494573&r1=1494572&r2=1494573&view=diff
==============================================================================
---
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/OfficeParser.java
(original)
+++
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/microsoft/OfficeParser.java
Wed Jun 19 12:02:07 2013
@@ -217,10 +217,14 @@ public class OfficeParser extends Abstra
// By default, use the default Office Password
String password = Decryptor.DEFAULT_PASSWORD;
- // If they supplyed a Password Provider, ask that for the
password
+ // If they supplied a Password Provider, ask that for the
password,
+ // and use the provider given one if available (stick with
default if not)
PasswordProvider passwordProvider =
context.get(PasswordProvider.class);
if (passwordProvider != null) {
- password = passwordProvider.getPassword(metadata);
+ String suppliedPassword =
passwordProvider.getPassword(metadata);
+ if (suppliedPassword != null) {
+ password = suppliedPassword;
+ }
}
// Check if we've the right password or not