Bug 57961 - NPE in PoiTextExtractor when closed
Summary: NPE in PoiTextExtractor when closed
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: 3.10-FINAL
Hardware: PC Mac OS X 10.1
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2015-05-27 23:44 UTC by Michael Rimov
Modified: 2015-06-16 13:45 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rimov 2015-05-27 23:44:38 UTC

File f = /* ... */
try (POITextExtractor extractor = ExtractorFactory.createExtractor(file);) {
  	return extractor.getText();

Which can result in:

Caused by: org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Fail to save: an error occurs while saving the package : null
	at org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:500)
	at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1417)
	at org.apache.poi.openxml4j.opc.OPCPackage.save(OPCPackage.java:1404)
	at org.apache.poi.openxml4j.opc.ZipPackage.closeImpl(ZipPackage.java:349)
	at org.apache.poi.openxml4j.opc.OPCPackage.close(OPCPackage.java:420)
	at org.apache.poi.POIXMLTextExtractor.close(POIXMLTextExtractor.java:87)
	at com.gaggle.message.index.poi.PoiIndexer$1.call(PoiIndexer.java:94)
	at com.gaggle.message.index.poi.PoiIndexer$1.call(PoiIndexer.java:1)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller.marshall(ZipPackagePropertiesMarshaller.java:46)
	at org.apache.poi.openxml4j.opc.ZipPackage.saveImpl(ZipPackage.java:444)

The file being processed was a word document and extractor.getText() DID return data.  Unfortunately, due to privacy concerns with a client I can't release the actual document.

Comment 1 Dominik Stadler 2015-05-28 05:54:29 UTC
Please try with the latest version 3.12 as there have been a few fixes in that area and thus the problem might be already fixed there now. Especially r1662971 looks like it should be able to fix your issue.
Comment 2 Dominik Stadler 2015-06-16 13:45:02 UTC
No update on this one so I assume it was fixed in 3.12. Please reopen with more information if this is still an issue for you.