aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2016-07-11 22:57:42 +0000
committerNick Burch <nick@apache.org>2016-07-11 22:57:42 +0000
commitc74010fcaee7c69522e898e54d22415a2344b9ae (patch)
tree0ab1f796af64b7033922fa246d5efdaf2908a4e7
parentce564f39dc6bf9e4caedb8857f15fa705bfe4705 (diff)
downloadpoi-c74010fcaee7c69522e898e54d22415a2344b9ae.tar.gz
poi-c74010fcaee7c69522e898e54d22415a2344b9ae.zip
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
-rw-r--r--src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java b/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
index 52a0bf12f8..d1577898f1 100644
--- a/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
+++ b/src/java/org/apache/poi/extractor/OLE2ExtractorFactory.java
@@ -126,8 +126,15 @@ public class OLE2ExtractorFactory {
public static POITextExtractor createExtractor(InputStream input) throws IOException {
Class<?> cls = getOOXMLClass();
if (cls != null) {
- // TODO Reflection
- throw new IllegalArgumentException("TODO Reflection");
+ // Use Reflection to get us the full OOXML-enabled version
+ 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 {
// Best hope it's OLE2....
return createExtractor(new NPOIFSFileSystem(input));