You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2018/10/31 11:36:00 UTC

svn commit: r1845323 - /chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java

Author: fmui
Date: Wed Oct 31 11:36:00 2018
New Revision: 1845323

URL: http://svn.apache.org/viewvc?rev=1845323&view=rev
Log:
fixed fallback if Woodstoox is not available

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java?rev=1845323&r1=1845322&r2=1845323&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java Wed Oct 31 11:36:00 2018
@@ -61,11 +61,9 @@ public final class XMLUtils {
 
         try {
             // Woodstox is the only supported and tested StAX implementation
-            WstxInputFactory wstxFactory = (WstxInputFactory) ClassLoaderUtil
-                    .loadClass("com.ctc.wstx.stax.WstxInputFactory").getDeclaredConstructor().newInstance();
-            wstxFactory.configureForSpeed();
-
-            factory = wstxFactory;
+            factory = (XMLInputFactory) ClassLoaderUtil.loadClass("com.ctc.wstx.stax.WstxInputFactory")
+                    .getDeclaredConstructor().newInstance();
+            ((WstxInputFactory) factory).configureForSpeed();
         } catch (Exception e) {
             // other StAX implementations may work, too
             factory = XMLInputFactory.newInstance();
@@ -93,13 +91,12 @@ public final class XMLUtils {
 
         try {
             // Woodstox is the only supported and tested StAX implementation
-            WstxOutputFactory wstxFactory = (WstxOutputFactory) ClassLoaderUtil
-                    .loadClass("com.ctc.wstx.stax.WstxOutputFactory").getDeclaredConstructor().newInstance();
-            wstxFactory.configureForSpeed();
-            wstxFactory.setProperty(WstxOutputProperties.P_OUTPUT_INVALID_CHAR_HANDLER,
-                    new InvalidCharHandler.ReplacingHandler(' '));
+            factory = (XMLOutputFactory) ClassLoaderUtil.loadClass("com.ctc.wstx.stax.WstxOutputFactory")
+                    .getDeclaredConstructor().newInstance();
 
-            factory = wstxFactory;
+            ((WstxOutputFactory) factory).configureForSpeed();
+            ((WstxOutputFactory) factory).setProperty(WstxOutputProperties.P_OUTPUT_INVALID_CHAR_HANDLER,
+                    new InvalidCharHandler.ReplacingHandler(' '));
         } catch (Exception e) {
             // other StAX implementations may work, too
             factory = XMLOutputFactory.newInstance();