This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-post.git
The following commit(s) were added to refs/heads/master by this push:
new 5aa189b SLING-2534 : Strings of zero length on update in post servlet
delete the property
5aa189b is described below
commit 5aa189bd053c359fa38efa713e9694a8b70ef212
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Wed Nov 14 07:45:54 2018 +0100
SLING-2534 : Strings of zero length on update in post servlet delete the
property
---
.../servlets/post/impl/helper/SlingPropertyValueHandler.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
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 4137afa..2530647 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
@@ -209,12 +209,14 @@ public class SlingPropertyValueHandler {
String[] values = prop.getStringValues();
- if (values == null || (values.length == 1 && values[0].length() == 0))
{
- // if no value is present or a single empty string is given,
+ if (values == null
+ || (values.length == 1 && values[0].length() == 0 &&
getType(parent, prop) != PropertyType.STRING)) {
+ // if no value is present or a single empty non string is given,
// just remove the existing property (if any)
removeProperty(parent, prop);
- } else if (values.length == 0) {
+ } else if (values.length == 0
+ || (values.length == 1 && values[0].length() == 0 &&
getType(parent, prop) == PropertyType.STRING)) {
// do not create new prop here, but clear existing
clearProperty(parent, prop);