projects
/
lgpl
/
argeo-commons.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4573968
)
Make JCR set more robust.
author
Mathieu Baudier <mbaudier@argeo.org>
Sun, 6 Dec 2020 07:03:37 +0000
(08:03 +0100)
committer
Mathieu Baudier <mbaudier@argeo.org>
Sun, 6 Dec 2020 07:03:37 +0000
(08:03 +0100)
org.argeo.jcr/src/org/argeo/jcr/Jcr.java
patch
|
blob
|
history
diff --git
a/org.argeo.jcr/src/org/argeo/jcr/Jcr.java
b/org.argeo.jcr/src/org/argeo/jcr/Jcr.java
index 3cbdd57f5df6731578875e5328601b79b28606d3..6f0e39d8298759db33affea0dc57d9a69b7bb47f 100644
(file)
--- a/
org.argeo.jcr/src/org/argeo/jcr/Jcr.java
+++ b/
org.argeo.jcr/src/org/argeo/jcr/Jcr.java
@@
-297,8
+297,13
@@
public class Jcr {
*/
public static void set(Node node, String property, Object value) {
try {
*/
public static void set(Node node, String property, Object value) {
try {
- if (!node.hasProperty(property))
- throw new IllegalArgumentException("No property " + property + " in " + node);
+ if (!node.hasProperty(property)) {
+ if (value != null)
+ node.setProperty(property, value.toString());
+ return;
+ // throw new IllegalArgumentException("No property " + property + " in " +
+ // node);
+ }
Property prop = node.getProperty(property);
if (value == null) {
prop.remove();
Property prop = node.getProperty(property);
if (value == null) {
prop.remove();