SLING-8768 : Revert SLING-2534 and let empty values remove the property
diff --git a/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java b/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java
index 0ff1365..c5c69fb 100644
--- a/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java
+++ b/src/main/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandler.java
@@ -211,12 +211,9 @@
 
         // RequestProperty#getStringValues already takes care of the configs ignoreBlanks, defaultValues etc.
         // and provides values as null, new String[0] etc. accordingly.
-        final int type = getType(parent, prop);
-
-        if (values == null
-                || (values.length == 1 && values[0].length() == 0 && type != PropertyType.STRING
-                        && type != PropertyType.UNDEFINED)) {
-            // if no value is present, just remove the existing property (if any)
+        if (values == null || (values.length == 1 && values[0].length() == 0)) {
+            // if no value is present or a single empty string is given,
+            // just remove the existing property (if any)
             removeProperty(parent, prop);
 
         } else if (values.length == 0) {
@@ -239,7 +236,9 @@
                 removeIfSingleValueProperty(parent, prop);
             }
 
+            final int type = getType(parent, prop);
             if (jcrSupport.hasSession(parent.resource.getResourceResolver())) {
+
                 if (type == PropertyType.DATE) {
                     if (storeAsDate(parent, prop.getName(), values, multiValue)) {
                         return;
diff --git a/src/test/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandlerTest.java b/src/test/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandlerTest.java
index 3689438..0e819c8 100644
--- a/src/test/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandlerTest.java
+++ b/src/test/java/org/apache/sling/servlets/post/impl/helper/SlingPropertyValueHandlerTest.java
@@ -132,10 +132,9 @@
         handler.setProperty(rsrc, prop);
 
         // value map should be empty, one change: delete
-        assertEquals(1, valueMap.size());
-        assertEquals("", valueMap.get("property"));
+        assertTrue(valueMap.isEmpty());
         assertEquals(1, mods.size());
-        assertEquals(ModificationType.MODIFY, mods.get(0).getType());
+        assertEquals(ModificationType.DELETE, mods.get(0).getType());
         assertEquals("/content/property", mods.get(0).getSource());
     }
 }