]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-4533,CSPACE-3231: Changed the way that empty strings are handled in services...
authorAron Roberts <aron@socrates.berkeley.edu>
Fri, 4 Nov 2011 01:50:01 +0000 (01:50 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Fri, 4 Nov 2011 01:50:01 +0000 (01:50 +0000)
services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java
services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementServiceTest.java

index 7ad430654ac567d2792d31ba4c7132e979c24c3e..b22c39a4cc39eeddfe4e8548d64a978b3daedd4d 100644 (file)
@@ -860,7 +860,7 @@ public class DocumentUtils {
                 return false;
             }
         }
-
+        
        /**
         * Insert multi values.
         *
@@ -1189,7 +1189,12 @@ public class DocumentUtils {
                                 }
                             }
                         } else {
-                           result = type.decode(element.getText());
+                            String textValue = element.getText();
+                            if (textValue != null && textValue.trim().isEmpty()) {
+                                result = null;
+                            } else {
+                               result = type.decode(textValue);
+                            }
                         }
                } else if (type.isListType()) {
                        ListType ltype = (ListType) type;
index a2619f28de619ad9ee0c148973b81985bcd1efd0..2a10656982183af6f33719502be320d41ed5d0e0 100644 (file)
@@ -476,8 +476,10 @@ public class MovementServiceTest extends AbstractServiceTestImpl {
         }
 
         // Check selected fields in the updated common part.
-        Assert.assertEquals(updatedMovementCommon.getNormalLocation(),
-            movementCommon.getNormalLocation(), "Data in updated object did not match submitted data.");
+        
+        // By submitting an empty string in the update payload, the value of this field
+        // in the object created from the response payload will be null.
+        Assert.assertNull(updatedMovementCommon.getNormalLocation(), "Data in updated object did not match submitted data.");
         if(logger.isDebugEnabled()){
             logger.debug("Normal location after update=|" + updatedMovementCommon.getNormalLocation() + "|");
         }