Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B55B9FB98 for ; Tue, 2 Apr 2013 15:42:33 +0000 (UTC) Received: (qmail 41689 invoked by uid 500); 2 Apr 2013 15:42:33 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 41563 invoked by uid 500); 2 Apr 2013 15:42:32 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 41530 invoked by uid 99); 2 Apr 2013 15:42:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Apr 2013 15:42:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Apr 2013 15:42:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 79911238897F; Tue, 2 Apr 2013 15:42:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130402154204.79911238897F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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); + } + +}