diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-03-30 11:52:54 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-03-30 11:52:54 +0200 |
commit | 16a8c6fb04043162a981f6c1ea593de86e2f43cb (patch) | |
tree | 799cb78882ab4eb705aec51dd07623f3b45cba3f /pdf-as-lib/src/main/java | |
parent | 3519b94beadc1b6957471c80e5b77f81d5ee45b7 (diff) | |
download | pdf-as-4-16a8c6fb04043162a981f6c1ea593de86e2f43cb.tar.gz pdf-as-4-16a8c6fb04043162a981f6c1ea593de86e2f43cb.tar.bz2 pdf-as-4-16a8c6fb04043162a981f6c1ea593de86e2f43cb.zip |
Fallback to depreceated factory method for Stax in case new method is not found
Diffstat (limited to 'pdf-as-lib/src/main/java')
-rw-r--r-- | pdf-as-lib/src/main/java/at/gv/egiz/sl/util/SLMarschaller.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/SLMarschaller.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/SLMarschaller.java index e53fc230..8e84b491 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/SLMarschaller.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/SLMarschaller.java @@ -72,7 +72,13 @@ public class SLMarschaller { } public static Object unmarshal(InputStream is) throws JAXBException { - XMLInputFactory xif = XMLInputFactory.newFactory(); + XMLInputFactory xif = null; + try { + xif = XMLInputFactory.newFactory(); + } catch(java.lang.NoSuchMethodError e) { + // Fallback for old STAX implementations + xif = XMLInputFactory.newInstance(); + } xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); xif.setProperty(XMLInputFactory.SUPPORT_DTD, false); XMLStreamReader xmlStreamReader; @@ -87,7 +93,14 @@ public class SLMarschaller { public static Object unmarshalFromString(String message) throws JAXBException { StringReader sr = new StringReader(message); - XMLInputFactory xif = XMLInputFactory.newFactory(); + XMLInputFactory xif = null; + try { + xif = XMLInputFactory.newFactory(); + } catch(java.lang.NoSuchMethodError e) { + // Fallback for old STAX implementations + xif = XMLInputFactory.newInstance(); + } + xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); xif.setProperty(XMLInputFactory.SUPPORT_DTD, false); XMLStreamReader xmlStreamReader; |