poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1693978 - in /poi/trunk/src: java/org/apache/poi/sl/draw/geom/PresetGeometries.java ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java
Date Mon, 03 Aug 2015 23:09:10 GMT
Author: kiwiwings
Date: Mon Aug  3 23:09:10 2015
New Revision: 1693978

URL: http://svn.apache.org/r1693978
Log:
gump build fixing - move system properties tinkering into junit class

Modified:
    poi/trunk/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java

Modified: poi/trunk/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java?rev=1693978&r1=1693977&r2=1693978&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java Mon Aug  3 23:09:10
2015
@@ -22,8 +22,15 @@ package org.apache.poi.sl.draw.geom;
 import java.io.InputStream;
 import java.util.LinkedHashMap;
 
-import javax.xml.bind.*;
-import javax.xml.stream.*;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.events.StartElement;
 import javax.xml.stream.events.XMLEvent;
 
@@ -37,7 +44,6 @@ import org.apache.poi.util.POILogger;
 public class PresetGeometries extends LinkedHashMap<String, CustomGeometry> {
     private final static POILogger LOG = POILogFactory.getLogger(PresetGeometries.class);
     protected final static String BINDING_PACKAGE = "org.apache.poi.sl.draw.binding";
-    private static final String JAXPFACTORYID = "javax.xml.stream.XMLInputFactory";
     
     protected static PresetGeometries _inst;
 
@@ -53,8 +59,6 @@ public class PresetGeometries extends Li
             }
         };
         
-        fixXmlSystemProperties();
-        
         XMLInputFactory staxFactory = XMLInputFactory.newFactory();
         XMLEventReader staxReader = staxFactory.createXMLEventReader(is);
         XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter);
@@ -115,21 +119,4 @@ public class PresetGeometries extends Li
 
         return _inst;
     }
-    
-    public static void fixXmlSystemProperties() {
-        // handling for illegal system properties - mainly because of failing gump build
-        String xmlFactClass = System.getProperty(JAXPFACTORYID);
-        if (xmlFactClass != null) {
-            try {
-                Class.forName(xmlFactClass);
-            } catch (Exception e) {
-                LOG.log(POILogger.ERROR, "Invalid xml input factory config detected. ("+JAXPFACTORYID+"="+xmlFactClass+")");
-                try {
-                    System.clearProperty(JAXPFACTORYID);
-                } catch (Exception e2) {
-                    LOG.log(POILogger.ERROR, "Failed to remove invalid xml input factory",
e2);
-                }
-            }
-        }
-    }
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java?rev=1693978&r1=1693977&r2=1693978&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestPPTX2PNG.java Mon Aug
 3 23:09:10 2015
@@ -26,8 +26,6 @@ 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;
@@ -46,7 +44,7 @@ public class TestPPTX2PNG {
     @BeforeClass
     public static void activateJaxpDebug() {
         jaxpDebugEnable = setDebugFld(true);
-        fixDefaultInputFactory();
+        setXmlInputFactory();
     }
 
     @AfterClass
@@ -69,17 +67,13 @@ public class TestPPTX2PNG {
         }
     }
 
-    private static void fixDefaultInputFactory() {
-        String originalValue = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
+    private static void setXmlInputFactory() {
+        String propName = "javax.xml.stream.XMLInputFactory";
+        String propVal = "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) {
+            Class.forName(propVal);
+            System.setProperty(propName, propVal);
+        } catch (Exception e){
             // ignore
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message