cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r819016 - in /cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils: StaxUtils.java StreamWriterContentHandler.java
Date Fri, 25 Sep 2009 21:19:07 GMT
Author: dkulp
Date: Fri Sep 25 21:19:07 2009
New Revision: 819016

URL: http://svn.apache.org/viewvc?rev=819016&view=rev
Log:
[CXF-2447] Fix problems of creating a default bus in SpringDM/OSGI when
using the stax parser built into the Java6 jdk.

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=819016&r1=819015&r2=819016&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Fri Sep
25 21:19:07 2009
@@ -337,18 +337,22 @@
     public static void copy(Source source, XMLStreamWriter writer) throws XMLStreamException
{
         if (source instanceof SAXSource) {
             InputSource src = ((SAXSource)source).getInputSource();
-            if (src.getByteStream() == null && src.getCharacterStream() == null
-                && src.getSystemId() == null && src.getPublicId() == null
+            if (src.getSystemId() == null && src.getPublicId() == null
                 && ((SAXSource)source).getXMLReader() != null) {
-                //OK - reader is OK.  We'll dump that out
+                
+                //OK - reader is OK.  We'll use that out
                 StreamWriterContentHandler ch = new StreamWriterContentHandler(writer);
                 XMLReader reader = ((SAXSource)source).getXMLReader();
                 reader.setContentHandler(ch);
                 try {
+                    try {
+                        reader.setFeature("http://xml.org/sax/features/namespaces", true);
+                    } catch (Throwable t) {
+                        //ignore
+                    }
                     reader.parse(((SAXSource)source).getInputSource());
                     return;
                 } catch (Exception e) {
-                    e.printStackTrace();
                     throw new XMLStreamException(e);
                 }
             }

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java?rev=819016&r1=819015&r2=819016&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StreamWriterContentHandler.java
Fri Sep 25 21:19:07 2009
@@ -210,7 +210,11 @@
                 int attCount = atts.getLength();
                 for (int i = 0; i < attCount; i++) {
                     if (StringUtils.isEmpty(atts.getURI(i))) {
-                        writer.writeAttribute(atts.getLocalName(i),
+                        String s = atts.getLocalName(i);
+                        if (StringUtils.isEmpty(s)) {
+                            s = atts.getQName(i);
+                        }
+                        writer.writeAttribute(s,
                                               atts.getValue(i));
                     } else {
                         writer.writeAttribute(atts.getURI(i),



Mime
View raw message