From dd2a69cdc2fe33e9d488e93c778a126dc2b5c79d Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Sun, 2 Aug 2015 21:29:23 +0000 Subject: [PATCH] Trying to fix the wrong xmlinputfactory on gump run git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1693830 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xslf/usermodel/TestPPTX2PNG.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java index 14f92e2bbe..fc7747d7ee 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java @@ -26,6 +26,8 @@ import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; +import javax.xml.stream.XMLInputFactory; + import org.apache.poi.sl.draw.Drawable; import org.apache.poi.util.JvmBugs; import org.apache.poi.xslf.XSLFTestDataSamples; @@ -44,6 +46,7 @@ public class TestPPTX2PNG { @BeforeClass public static void activateJaxpDebug() { jaxpDebugEnable = setDebugFld(true); + fixDefaultInputFactory(); } @AfterClass @@ -65,6 +68,22 @@ public class TestPPTX2PNG { return false; } } + + private static void fixDefaultInputFactory() { + String originalValue = "com.sun.xml.internal.stream.XMLInputFactoryImpl"; + try { + Field fld = XMLInputFactory.class.getDeclaredField("DEFAULIMPL"); + fld.setAccessible(true); + String val = (String)fld.get(null); + if (!originalValue.equals(val)) { + System.out.println("DefaultXMLInputFactory illegal changed to: "+val); + fld.set(null, originalValue); + } + } catch (Exception e) { + // ignore + } + } + @Test public void render() throws Exception { -- 2.39.5