You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2013/04/02 18:22:12 UTC

svn commit: r1463617 - in /cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils: StaxUtils.java WoodstoxHelper.java

Author: dkulp
Date: Tue Apr  2 16:22:12 2013
New Revision: 1463617

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

........
  r1463613 | dkulp | 2013-04-02 12:20:04 -0400 (Tue, 02 Apr 2013) | 10 lines

  Merged revisions 1463600 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk

  ........
    r1463600 | dkulp | 2013-04-02 11:42:04 -0400 (Tue, 02 Apr 2013) | 2 lines

    Update to make things work if woodstox isn't found and insecure parsing is turned on.

  ........

........

Added:
    cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java
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=1463617&r1=1463616&r2=1463617&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 Tue Apr  2 16:22:12 2013
@@ -77,8 +77,6 @@ import org.w3c.dom.UserDataHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 
-import com.ctc.wstx.stax.WstxInputFactory;
-
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
@@ -86,7 +84,6 @@ import org.apache.cxf.common.util.System
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.XMLUtils;
-import org.codehaus.stax2.XMLStreamReader2;
 
 public final class StaxUtils {
     // System properies for defaults, but also contextual properties usable
@@ -136,8 +133,7 @@ public final class StaxUtils {
     private static long maxElementCount = Long.MAX_VALUE;
     private static long maxXMLCharacters = Long.MAX_VALUE;
     
-    //will change to false in the near future
-    private static boolean allowInsecureParser = true;
+    private static boolean allowInsecureParser;
     
     static {
         int i = getInteger("org.apache.cxf.staxutils.pool-size", 20);
@@ -320,7 +316,7 @@ public final class StaxUtils {
     }
     
     private static XMLInputFactory createWoodstoxFactory() {
-        return new WstxInputFactory();
+        return WoodstoxHelper.createInputFactory();
     }
     private static boolean setRestrictionProperties(XMLInputFactory factory) {
         //For now, we can only support Woodstox 4.2.x and newer as none of the other
@@ -1789,7 +1785,7 @@ public final class StaxUtils {
         return reader;
     }
     private static void setProperty(XMLStreamReader reader, String p, Object v) {
-        ((XMLStreamReader2)reader).setProperty(p, v);
+        WoodstoxHelper.setProperty(reader, p, v);
     }
 
 }

Added: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java?rev=1463617&view=auto
==============================================================================
--- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java (added)
+++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java Tue Apr  2 16:22:12 2013
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.staxutils;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.codehaus.stax2.XMLStreamReader2;
+
+/**
+ * 
+ */
+final class WoodstoxHelper {
+
+    private WoodstoxHelper() {
+    }
+    
+    public static XMLInputFactory createInputFactory() {
+        return new com.ctc.wstx.stax.WstxInputFactory();
+    }
+
+    public static void setProperty(XMLStreamReader reader, String p, Object v) {
+        ((XMLStreamReader2)reader).setProperty(p, v);
+    }
+
+}