temporary activate jaxp debugging to find jaxb/stax error on gump build

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1692944 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2015-07-27 20:24:09 +00:00
parent f1000cbaf4
commit b6b3853330

View File

@ -22,12 +22,15 @@ package org.apache.poi.xslf.usermodel;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import org.apache.poi.sl.draw.Drawable;
import org.apache.poi.util.JvmBugs;
import org.apache.poi.xslf.XSLFTestDataSamples;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
/**
@ -36,6 +39,33 @@ import org.junit.Test;
* @author Yegor Kozlov
*/
public class TestPPTX2PNG {
private static boolean jaxpDebugEnable = false;
@BeforeClass
public static void activateJaxpDebug() {
jaxpDebugEnable = setDebugFld(true);
}
@AfterClass
public static void resetJaxpDebug() {
setDebugFld(jaxpDebugEnable);
}
private static boolean setDebugFld(boolean enable) {
// enable jaxp debugging because of jaxb/stax error in gump build
try {
Class<?> clz = Class.forName("javax.xml.stream.FactoryFinder");
Field fld = clz.getDeclaredField("debug");
fld.setAccessible(true);
boolean isDebug = (Boolean)fld.get(null);
fld.set(null, enable);
return isDebug;
} catch (Exception e) {
// ignore
return false;
}
}
@Test
public void render() throws Exception {
String[] testFiles = {"backgrounds.pptx","layouts.pptx", "sample.pptx", "shapes.pptx", "themes.pptx",};