cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1065774 - in /cxf/branches/2.3.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
Date Mon, 31 Jan 2011 20:49:09 GMT
Author: dkulp
Date: Mon Jan 31 20:49:09 2011
New Revision: 1065774

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

........
  r1065752 | dkulp | 2011-01-31 15:29:47 -0500 (Mon, 31 Jan 2011) | 1 line
  
  Fix a problem with Dispatch<Document> not working correctly
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java

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

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java?rev=1065774&r1=1065773&r2=1065774&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
Mon Jan 31 20:49:09 2011
@@ -97,16 +97,21 @@ public class XMLStreamDataReader impleme
                 input = StaxUtils.createXMLStreamReader(dom);
             }
             if (type != null) {
+                Object retVal = null;
                 if (SAXSource.class.isAssignableFrom(type)
                     || StaxSource.class.isAssignableFrom(type)) {
-                    return new StaxSource(resetForStreaming(input));
+                    retVal = new StaxSource(resetForStreaming(input));
                 } else if (StreamSource.class.isAssignableFrom(type)) {
-                    return new StreamSource(getInputStream(input));
+                    retVal = new StreamSource(getInputStream(input));
                 } else if (XMLStreamReader.class.isAssignableFrom(type)) {
-                    return resetForStreaming(input);
+                    retVal = resetForStreaming(input);
+                } else if (Element.class.isAssignableFrom(type)) {
+                    retVal = dom == null ? read(input).getNode() : dom;
+                } else if (Document.class.isAssignableFrom(type)) {
+                    retVal = dom == null ? read(input).getNode() : dom;
                 } else if (DataSource.class.isAssignableFrom(type)) {
                     final InputStream ins = getInputStream(input);
-                    return new DataSource() {
+                    retVal = new DataSource() {
                         public String getContentType() {
                             return "text/xml";
                         }
@@ -124,9 +129,12 @@ public class XMLStreamDataReader impleme
                     input = resetForStreaming(input);
                     Object o = createStaxSource(input, type);
                     if (o != null) {
-                        return o;
+                        retVal = o;
                     }
                 }
+                if (retVal != null) {
+                    return retVal;
+                }
             }
             return dom == null ? read(input) : new DOMSource(dom);
         } catch (IOException e) {

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java?rev=1065774&r1=1065773&r2=1065774&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
Mon Jan 31 20:49:09 2011
@@ -30,6 +30,7 @@ import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.validation.Schema;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Node;
 
@@ -72,7 +73,12 @@ public class XMLStreamDataWriter impleme
                         return;
                     }
                 }
-                StaxUtils.writeNode(nd, writer, true);
+                if (nd instanceof Document) {
+                    StaxUtils.writeDocument((Document)nd,
+                                            writer, false, true);
+                } else {
+                    StaxUtils.writeNode(nd, writer, true);                    
+                }
             } else {
                 Source s = (Source) obj;
                 if (s instanceof DOMSource



Mime
View raw message