Correct an eclipse warning around close(), and a related bug that this identified
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1589756 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
14a7ae6316
commit
67d97d8894
@ -403,6 +403,11 @@ public abstract class OPCPackage implements RelationshipSource, Closeable {
|
|||||||
revert();
|
revert();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.contentTypeManager == null) {
|
||||||
|
logger.log(POILogger.WARN,
|
||||||
|
"Unable to call close() on a package that hasn't been fully opened yet");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Save the content
|
// Save the content
|
||||||
ReentrantReadWriteLock l = new ReentrantReadWriteLock();
|
ReentrantReadWriteLock l = new ReentrantReadWriteLock();
|
||||||
|
@ -64,6 +64,10 @@ public final class ZipPackage extends Package {
|
|||||||
public ZipPackage() {
|
public ZipPackage() {
|
||||||
super(defaultPackageAccess);
|
super(defaultPackageAccess);
|
||||||
this.zipArchive = null;
|
this.zipArchive = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.contentTypeManager = new ZipContentTypeManager(null, this);
|
||||||
|
} catch (InvalidFormatException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,7 +73,7 @@ public class XWPFWordExtractor extends POIXMLTextExtractor {
|
|||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
if(args.length < 1) {
|
if(args.length < 1) {
|
||||||
System.err.println("Use:");
|
System.err.println("Use:");
|
||||||
System.err.println(" HXFWordExtractor <filename.docx>");
|
System.err.println(" XWPFWordExtractor <filename.docx>");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
POIXMLTextExtractor extractor =
|
POIXMLTextExtractor extractor =
|
||||||
@ -81,6 +81,7 @@ public class XWPFWordExtractor extends POIXMLTextExtractor {
|
|||||||
args[0]
|
args[0]
|
||||||
));
|
));
|
||||||
System.out.println(extractor.getText());
|
System.out.println(extractor.getText());
|
||||||
|
extractor.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
|
Loading…
Reference in New Issue
Block a user