if (pkgIdentifier!=null) {
opcPackage.setName(pkgIdentifier.name());
}
new EventFinished(startEvent).publish();
return opcPackage;
// final LoadFromZipNG loader = new LoadFromZipNG();
// return loader.get(is);
} else if (type.equals(Filetype.Compound)){
try {
POIFSFileSystem fs = new POIFSFileSystem(is);
EncryptionInfo info = new EncryptionInfo(fs);
Decryptor d = Decryptor.getInstance(info);
d.verifyPassword(password);
InputStream is2 = d.getDataStream(fs);
final LoadFromZipNG loader = new LoadFromZipNG();
return loader.get(is2);
} catch (java.security.InvalidKeyException e) {
/* Wrong password results in:
*
Caused by: java.security.InvalidKeyException: No installed provider supports this key: (null)
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at org.apache.poi.poifs.crypt.AgileDecryptor.getCipher(AgileDecryptor.java:216)
at org.apache.poi.poifs.crypt.AgileDecryptor.access$200(AgileDecryptor.java:39)
at org.apache.poi.poifs.crypt.AgileDecryptor$ChunkedCipherInputStream.<init>(AgileDecryptor.java:127)
at org.apache.poi.poifs.crypt.AgileDecryptor.getDataStream(AgileDecryptor.java:103)
at org.apache.poi.poifs.crypt.Decryptor.getDataStream(Decryptor.java:85)
*/
throw new Docx4JException("Problem reading compound file: wrong password?", e);
} catch (Exception e) {
throw new Docx4JException("Problem reading compound file", e);
} finally {
new EventFinished(startEvent).publish();
}
}
try {
FlatOpcXmlImporter xmlPackage = new FlatOpcXmlImporter(is);
return xmlPackage.get();
} catch (final Exception e) {
OpcPackage.log.error(e.getMessage(), e);
throw new Docx4JException("Couldn't load xml from stream ",e);
} finally {
new EventFinished(startEvent).publish();
}
}