Last bit of reflection - get back to the full OOXML-enabled factory if we can

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1752228 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2016-07-11 22:57:42 +00:00
parent 4643b2ade0
commit 90e8b0f5b0

View File

@ -126,8 +126,15 @@ public class OLE2ExtractorFactory {
public static POITextExtractor createExtractor(InputStream input) throws IOException { public static POITextExtractor createExtractor(InputStream input) throws IOException {
Class<?> cls = getOOXMLClass(); Class<?> cls = getOOXMLClass();
if (cls != null) { if (cls != null) {
// TODO Reflection // Use Reflection to get us the full OOXML-enabled version
throw new IllegalArgumentException("TODO Reflection"); try {
Method m = cls.getDeclaredMethod("createExtractor", InputStream.class);
return (POITextExtractor)m.invoke(null, input);
} catch (IllegalArgumentException iae) {
throw iae;
} catch (Exception e) {
throw new IllegalArgumentException("Error creating Extractor for InputStream", e);
}
} else { } else {
// Best hope it's OLE2.... // Best hope it's OLE2....
return createExtractor(new NPOIFSFileSystem(input)); return createExtractor(new NPOIFSFileSystem(input));