Author: cziegeler
Date: Tue Mar 10 18:33:38 2009
New Revision: 752208

URL: http://svn.apache.org/viewvc?rev=752208&view=rev
Log:
SLING-881 :  if a property is updated and no type hint is sent from the client, 
use the current type of the property to update the value. Record delete change 
only if property has been deleted.

Modified:
    
incubator/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java

Modified: 
incubator/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java?rev=752208&r1=752207&r2=752208&view=diff
==============================================================================
--- 
incubator/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java
 (original)
+++ 
incubator/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java
 Tue Mar 10 18:33:38 2009
@@ -194,13 +194,19 @@
                 // ignore
             }
         }
+        final String[] values = prop.getStringValues();
+        if ( type == PropertyType.UNDEFINED && values != null && values.length 
> 0 ) {
+            if ( parent.hasProperty(prop.getName()) ) {
+                type = parent.getProperty(prop.getName()).getType();
+            }
+        }
 
-        String[] values = prop.getStringValues();
         if (values == null) {
             // remove property
-            changes.add(Modification.onDeleted(
-                removePropertyIfExists(parent, prop.getName())
-            ));
+            final String removePath = removePropertyIfExists(parent, 
prop.getName());
+            if ( removePath != null ) {
+                changes.add(Modification.onDeleted(removePath));
+            }
         } else if (values.length == 0) {
             // do not create new prop here, but clear existing
             if (parent.hasProperty(prop.getName())) {


Reply via email to