You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2021/01/14 15:34:44 UTC
[sling-org-apache-sling-jcr-resource] branch
feature/SLING-10063-improve-exception-msg created (now 357362f)
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a change to branch feature/SLING-10063-improve-exception-msg
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resource.git.
at 357362f SLING-10063 improve exception messages
This branch includes the following new commits:
new 357362f SLING-10063 improve exception messages
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[sling-org-apache-sling-jcr-resource] 01/01: SLING-10063 improve
exception messages
Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch feature/SLING-10063-improve-exception-msg
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resource.git
commit 357362f1ec1551b84366cf38e547fc7405296b29
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Jan 14 16:34:25 2021 +0100
SLING-10063 improve exception messages
---
.../sling/jcr/resource/internal/JcrModifiableValueMap.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java b/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java
index a6d3734..936404c 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java
@@ -455,13 +455,21 @@ public final class JcrModifiableValueMap
node.setProperty(name, entry.convertToType(Value.class, node, this.helper.getDynamicClassLoader()));
}
} catch (final RepositoryException re) {
- throw new IllegalArgumentException("Value for key " + key + " can't be put into node: " + value, re);
+ throw new IllegalArgumentException("Value '"+ value + "' for property '" + key + "' can't be put into node '" + getNodePath(node) + "'.", re);
}
this.valueCache.put(key, value);
return oldValue;
}
+ static String getNodePath(Node node) {
+ try {
+ return node.getPath();
+ } catch (RepositoryException e) {
+ return "Could not get node path: "+ e.getMessage();
+ }
+ }
+
/**
* @see java.util.Map#putAll(java.util.Map)
*/
@@ -492,7 +500,7 @@ public final class JcrModifiableValueMap
node.getProperty(name).remove();
}
} catch (final RepositoryException re) {
- throw new IllegalArgumentException("Value for key " + key + " can't be removed from node.", re);
+ throw new IllegalArgumentException("Value for property '" + key + "' can't be removed from node '" + getNodePath(node) + "'.", re);
}
return oldValue;