cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1518704 - /cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Date Thu, 29 Aug 2013 16:49:23 GMT
Author: dkulp
Date: Thu Aug 29 16:49:23 2013
New Revision: 1518704

URL: http://svn.apache.org/r1518704
Log:
Merged revisions 1518409 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1518409 | dkulp | 2013-08-28 18:39:48 -0400 (Wed, 28 Aug 2013) | 2 lines

  Add some protection around the factory loading

........

Modified:
    cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java

Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=1518704&r1=1518703&r2=1518704&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Thu
Aug 29 16:49:23 2013
@@ -176,14 +176,18 @@ public final class StaxUtils {
         }
         SAFE_INPUT_FACTORY = xif;
         
-        XMLOutputFactory xof = XMLOutputFactory.newInstance();
-        String xofClassName = xof.getClass().getName();
-        if (xofClassName.contains("ctc.wstx") || xofClassName.contains("xml.xlxp")
-                || xofClassName.contains("xml.xlxp2") || xofClassName.contains("bea.core"))
{
-            SAFE_OUTPUT_FACTORY = xof;
-        } else {
-            SAFE_OUTPUT_FACTORY = null;
+        XMLOutputFactory xof = null;
+        try {
+            xof = XMLOutputFactory.newInstance();
+            String xofClassName = xof.getClass().getName();
+            if (!xofClassName.contains("ctc.wstx") && !xofClassName.contains("xml.xlxp")
+                && !xofClassName.contains("xml.xlxp2") && !xofClassName.contains("bea.core"))
{
+                xof = null;
+            }
+        } catch (Throwable t) {
+            //ignore, can always drop down to the pooled factories
         }
+        SAFE_OUTPUT_FACTORY = xof;
         
     }
     
@@ -289,8 +293,13 @@ public final class StaxUtils {
      * @throws XMLStreamException 
      */
     public static XMLInputFactory createXMLInputFactory(boolean nsAware) {
-        XMLInputFactory factory = XMLInputFactory.newInstance();
-        if (!setRestrictionProperties(factory)) {
+        XMLInputFactory factory = null;
+        try {
+            factory = XMLInputFactory.newInstance();
+        } catch (Throwable t) {
+            factory = null;
+        }
+        if (factory == null || !setRestrictionProperties(factory)) {
             try {
                 factory = createWoodstoxFactory();
             } catch (Throwable t) {



Mime
View raw message