cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r647285 - in /incubator/cxf/branches/2.0.x-fixes: ./ distribution/bundle/pom.xml rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
Date Fri, 11 Apr 2008 19:45:31 GMT
Author: dkulp
Date: Fri Apr 11 12:45:30 2008
New Revision: 647285

URL: http://svn.apache.org/viewvc?rev=647285&view=rev
Log:
Merged revisions 647008 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r647008 | dkulp | 2008-04-10 19:29:16 -0400 (Thu, 10 Apr 2008) | 4 lines
  
  Remove direct dependency on woodstox from the code
  Mark the woodstox import as optional in osgi manifest
  Update other deps in osgi manifest as optional
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml?rev=647285&r1=647284&r2=647285&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/distribution/bundle/pom.xml Fri Apr 11 12:45:30 2008
@@ -229,6 +229,8 @@
                 <configuration>
                     <instructions>
                         <Import-Package>
+                            antlr*;resolution:=optional,
+                            com.ctc.wstx*;resolution:=optional,
                             com.ibm*;resolution:=optional,
                             com.sun*;resolution:=optional,
                             javanet.staxutils*;resolution:=optional,
@@ -236,12 +238,14 @@
                             javax.xml.soap,
                             junit.framework*;resolution:=optional,
                             org.apache.commons.lang*;resolution:=optional,
+                            org.apache.commons.codec*;resolution:=optional,
                             org.apache.log4j*;resolution:=optional,
                             org.apache.tools.ant*;resolution:=optional,
                             org.apache.velocity*;resolution:=optional,
                             org.apache.xmlbeans*;resolution:=optional,
                             org.apache.ws.security*;resolution:=optional,
                             org.codehaus.jra*;resolution:=optional,
+                            org.codehaus.jettison*;resolution:=optional,
                             org.jdom*;resolution:=optional,
                             org.junit*;resolution:=optional,
                             org.mortbay*;resolution:=optional,

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java?rev=647285&r1=647284&r2=647285&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/TunedDocumentLoader.java
Fri Apr 11 12:45:30 2008
@@ -23,6 +23,9 @@
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.sax.SAXSource;
@@ -34,7 +37,6 @@
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 
-import com.ctc.wstx.sax.WstxSAXParserFactory;
 
 import org.springframework.beans.factory.xml.DefaultDocumentLoader;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
@@ -57,9 +59,28 @@
         }
     }
     private TransformerFactory transformerFactory;
+    private SAXParserFactory saxParserFactory;
+    private SAXParserFactory nsasaxParserFactory;
     
     TunedDocumentLoader() {
         transformerFactory = TransformerFactory.newInstance();
+        
+        try {
+            Class<?> cls = Class.forName("com.ctc.wstx.sax.WstxSAXParserFactory");
+            saxParserFactory = (SAXParserFactory)cls.newInstance();
+            nsasaxParserFactory = (SAXParserFactory)cls.newInstance();
+        } catch (Exception e) {
+            //woodstox not found, use any other Stax parser
+            saxParserFactory = SAXParserFactory.newInstance();
+            nsasaxParserFactory = SAXParserFactory.newInstance();
+        }
+
+        try {
+            nsasaxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes",

+                                           true);
+        } catch (Exception e) {
+            //ignore
+        }
     }
 
     @Override
@@ -67,11 +88,9 @@
                                  ErrorHandler errorHandler, int validationMode, boolean namespaceAware)
         throws Exception {
         if (validationMode == XmlBeanDefinitionReader.VALIDATION_NONE) {
-            WstxSAXParserFactory woodstoxParserFactory;
-            woodstoxParserFactory = new WstxSAXParserFactory();
-            woodstoxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes",

-                                             namespaceAware);
-            SAXParser parser = woodstoxParserFactory.newSAXParser();
+            SAXParserFactory parserFactory = 
+                namespaceAware ? nsasaxParserFactory : saxParserFactory;
+            SAXParser parser = parserFactory.newSAXParser();
             XMLReader reader = parser.getXMLReader();
             reader.setEntityResolver(entityResolver);
             reader.setErrorHandler(errorHandler);



Mime
View raw message