cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1518722 - /cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Date Thu, 29 Aug 2013 17:42:29 GMT
Author: dkulp
Date: Thu Aug 29 17:42:28 2013
New Revision: 1518722

URL: http://svn.apache.org/r1518722
Log:
Merged revisions 1518704 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

........
  r1518704 | dkulp | 2013-08-29 12:49:23 -0400 (Thu, 29 Aug 2013) | 10 lines

  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.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java

Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=1518722&r1=1518721&r2=1518722&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Thu
Aug 29 17:42:28 2013
@@ -175,14 +175,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;
         
     }
     
@@ -288,8 +292,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