From 77bc62e8d3a92815a6ccbe96839f88344b5465ac Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Sun, 6 Dec 2020 08:03:37 +0100 Subject: [PATCH] Make JCR set more robust. --- org.argeo.jcr/src/org/argeo/jcr/Jcr.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org.argeo.jcr/src/org/argeo/jcr/Jcr.java b/org.argeo.jcr/src/org/argeo/jcr/Jcr.java index 3cbdd57f5..6f0e39d82 100644 --- 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 { - 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(); -- 2.30.2