From: Mathieu Baudier Date: Sun, 6 Dec 2020 07:03:37 +0000 (+0100) Subject: Make JCR set more robust. X-Git-Tag: argeo-commons-2.1.89~3 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=77bc62e8d3a92815a6ccbe96839f88344b5465ac Make JCR set more robust. --- 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();