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/08/29 00:39:48 UTC
svn commit: r1518409 -
/cxf/trunk/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Author: dkulp
Date: Wed Aug 28 22:39:48 2013
New Revision: 1518409
URL: http://svn.apache.org/r1518409
Log:
Add some protection around the factory loading
Modified:
cxf/trunk/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Modified: cxf/trunk/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=1518409&r1=1518408&r2=1518409&view=diff
==============================================================================
--- cxf/trunk/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/trunk/core/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Wed Aug 28 22:39:48 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) {