cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r794794 - in /cxf/branches/2.2.x-fixes: ./ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/ rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/
Date Thu, 16 Jul 2009 19:31:54 GMT
Author: dkulp
Date: Thu Jul 16 19:31:53 2009
New Revision: 794794

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

........
  r794771 | bimargulies | 2009-07-16 14:10:28 -0400 (Thu, 16 Jul 2009) | 1 line
  
  CXF-2309, avoid exposing unwanted XML element for Document mapping.
........

Added:
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/DOMMappingTest.java
      - copied unchanged from r794771, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/DOMMappingTest.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/BeanWithDOM.java
      - copied unchanged from r794771, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/BeanWithDOM.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/DocumentService.java
      - copied unchanged from r794771, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/DocumentService.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/IDocumentService.java
      - copied unchanged from r794771, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/IDocumentService.java
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/DocumentType.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul 16 19:31:53 2009
@@ -1 +1 @@
-/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728
+/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728,794771

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

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/DocumentType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/DocumentType.java?rev=794794&r1=794793&r2=794794&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/DocumentType.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/xml/DocumentType.java
Thu Jul 16 19:31:53 2009
@@ -25,6 +25,7 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import org.apache.cxf.aegis.Context;
 import org.apache.cxf.aegis.DatabindingException;
@@ -64,20 +65,32 @@
     public Object readObject(MessageReader mreader, Context context) throws DatabindingException
{
         try {
             XMLStreamReader reader = ((ElementReader)mreader).getXMLStreamReader();
-            return StaxUtils.read(builder, new FragmentStreamReader(reader), true);
+            // we need to eat the surrounding element.
+            reader.nextTag();
+            Object tree = StaxUtils.read(builder, new FragmentStreamReader(reader), true);
+            reader.nextTag(); // eat the end tag.
+            return tree;
         } catch (XMLStreamException e) {
             throw new DatabindingException("Could not parse xml.", e);
         }
     }
 
     @Override
-    public void writeObject(Object object, MessageWriter writer,
+    public void writeObject(Object object, MessageWriter writer, 
                             Context context) throws DatabindingException {
         Document doc = (Document)object;
 
         try {
-            StaxUtils.writeElement(doc.getDocumentElement(), ((ElementWriter)writer).getXMLStreamWriter(),
-                                   false);
+            Element docElement = doc.getDocumentElement();
+            if (docElement == null) {
+                if (isNillable()) {
+                    writer.writeXsiNil();
+                } else {
+                    throw new DatabindingException("Could not write xml: null document element.");
+                }
+            } else {
+                StaxUtils.writeElement(docElement, ((ElementWriter)writer).getXMLStreamWriter(),
false);
+            }
         } catch (XMLStreamException e) {
             throw new DatabindingException("Could not write xml.", e);
         }

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java?rev=794794&r1=794793&r2=794794&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
Thu Jul 16 19:31:53 2009
@@ -158,7 +158,7 @@
         assertEquals("before items", arrayService.getBeforeValue());
         assertEquals(3, arrayService.getW3cArray().length);
         org.w3c.dom.Document e = arrayService.getW3cArray()[0];
-        assertValid("/a:anyType/iam:walrus", e);
+        assertValid("/iam:walrus", e);
         assertEquals("after items", arrayService.getAfterValue());
     }
 



Mime
View raw message