cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1463600 - in /cxf/trunk/api/src/main/java/org/apache/cxf/staxutils: StaxUtils.java WoodstoxHelper.java
Date Tue, 02 Apr 2013 15:42:04 GMT
Author: dkulp
Date: Tue Apr  2 15:42:04 2013
New Revision: 1463600

URL: http://svn.apache.org/r1463600
Log:
Update to make things work if woodstox isn't found and insecure parsing is turned on.

Added:
    cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=1463600&r1=1463599&r2=1463600&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Tue Apr  2 15:42:04
2013
@@ -78,8 +78,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;
@@ -87,7 +85,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
@@ -137,8 +134,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);
@@ -321,7 +317,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
@@ -1777,7 +1773,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/trunk/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java?rev=1463600&view=auto
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java (added)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/staxutils/WoodstoxHelper.java Tue Apr  2 15:42:04
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);
+    }
+
+}



Mime
View raw message