From: Andreas Beeker Date: Mon, 27 Jul 2015 20:24:09 +0000 (+0000) Subject: temporary activate jaxp debugging to find jaxb/stax error on gump build X-Git-Tag: REL_3_13_FINAL~199 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=77098e5e3e6953c3f6cd9f5c7d381d8536e238f8;p=poi.git 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 --- 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 7d962fc433..14f92e2bbe 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java @@ -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",};