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
This commit is contained in:
Andreas Beeker 2015-08-02 21:29:23 +00:00
parent 6b8af03c42
commit 77315b425f

View File

@ -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 {