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 18:49:23 UTC
svn commit: r1518704 -
/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Author: dkulp
Date: Thu Aug 29 16:49:23 2013
New Revision: 1518704
URL: http://svn.apache.org/r1518704
Log:
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.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Modified: cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=1518704&r1=1518703&r2=1518704&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/branches/2.7.x-fixes/api/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Thu Aug 29 16:49:23 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) {