cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r931768 - in /cxf/branches/2.2.x-fixes: ./ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/ rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/typ...
Date Thu, 08 Apr 2010 03:30:55 GMT
Author: dkulp
Date: Thu Apr  8 03:30:54 2010
New Revision: 931768

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

........
  r931765 | dkulp | 2010-04-07 23:21:26 -0400 (Wed, 07 Apr 2010) | 1 line
  
  [CXF=2695] Support xsi:nil on all struct child elements
........

Added:
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/struct5.xml
      - copied unchanged from r931765, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/struct5.xml
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/basic/BeanType.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr  8 03:30:54 2010
@@ -1 +1 @@
-/cxf/trunk:931758
+/cxf/trunk:931758,931765

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/basic/BeanType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java?rev=931768&r1=931767&r2=931768&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
Thu Apr  8 03:30:54 2010
@@ -162,7 +162,7 @@ public class BeanType extends Type {
 
                         writeProperty(name, target, writeObj, clazz, propertyTypeInfo);
                     } else {
-                        if (!propertyTypeInfo.isNillable(name)) {
+                        if (!alwaysAllowNillables() && !propertyTypeInfo.isNillable(name))
{
                             throw new DatabindingException(name.getLocalPart() 
                                                            + " is nil, but not nillable.");
 
@@ -187,6 +187,10 @@ public class BeanType extends Type {
             throw new DatabindingException("Could not create class: " + e.getMessage(), e);
         }
     }
+    
+    protected boolean alwaysAllowNillables() {
+        return false;
+    }
 
     protected Type getElementType(QName name, BeanTypeInfo beanTypeInfo, 
                                   MessageReader reader, Context context) {

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java?rev=931768&r1=931767&r2=931768&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/StructType.java
Thu Apr  8 03:30:54 2010
@@ -50,6 +50,11 @@ public class StructType extends BeanType
     public StructType(BeanTypeInfo info) {
         super(info);
     }
+    
+    //soap-encoding always allow xsi:nil=true to be set
+    protected boolean alwaysAllowNillables() {
+        return true;
+    }
 
     /**
      * Gets the BeanTypeInfo using an unqualified name.

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java?rev=931768&r1=931767&r2=931768&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/encoded/StructTypeTest.java
Thu Apr  8 03:30:54 2010
@@ -102,6 +102,12 @@ public class StructTypeTest extends Abst
         // Test writing
         Element element = writeRef(po);
         validatePurchaseOrder(element);
+
+        // Test reading - no namespace on nested elements, xsi:nil (CXF-2695)
+        reader = new ElementReader(getClass().getResourceAsStream("struct5.xml"));
+        po = (PurchaseOrder) purchaseOrderType.readObject(reader, getLocalContext());
+        validatePurchaseOrder(po, true);
+        reader.getXMLStreamReader().close();
     }
 
     @Test
@@ -143,12 +149,19 @@ public class StructTypeTest extends Abst
     }
 
     private void validatePurchaseOrder(PurchaseOrder purchaseOrder) {
+        validatePurchaseOrder(purchaseOrder, false);
+    }
+    private void validatePurchaseOrder(PurchaseOrder purchaseOrder, boolean nilZip) {
         assertNotNull(purchaseOrder);
         assertNotNull(purchaseOrder.getShipping());
         assertEquals("1234 Riverside Drive", purchaseOrder.getShipping().getStreet());
         assertEquals("Gainesville", purchaseOrder.getShipping().getCity());
         assertEquals("FL", purchaseOrder.getShipping().getState());
-        assertEquals("30506", purchaseOrder.getShipping().getZip());
+        if (nilZip) {
+            assertNull(purchaseOrder.getShipping().getZip());
+        } else {
+            assertEquals("30506", purchaseOrder.getShipping().getZip());
+        }
         assertNotNull(purchaseOrder.getBilling());
         assertEquals("1234 Fake Street", purchaseOrder.getBilling().getStreet());
         assertEquals("Las Vegas", purchaseOrder.getBilling().getCity());



Mime
View raw message