X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=server%2Fruntime%2Forg.argeo.server.jcr%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fjcr%2FJcrUtils.java;h=e7b3656cfd8e5e7e195a873924f65b92c95eefcb;hb=a093e5c849e70bbc754fa4462dbb6c2b59979973;hp=7b99f0272235b558af7da25870ab02db14a849dc;hpb=690ded6357e5db68db0e7f508b588b27af65839d;p=lgpl%2Fargeo-commons.git diff --git a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java index 7b99f0272..e7b3656cf 100644 --- a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java +++ b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java @@ -307,9 +307,14 @@ public class JcrUtils implements ArgeoJcrConstants { * PROPERTIES */ - /** Concisely get the string value of a property */ + /** + * Concisely get the string value of a property or null if this node doesn't + * have this property + */ public static String get(Node node, String propertyName) { try { + if (!node.hasProperty(propertyName)) + return null; return node.getProperty(propertyName).getString(); } catch (RepositoryException e) { throw new ArgeoException("Cannot get property " + propertyName @@ -1546,7 +1551,7 @@ public class JcrUtils implements ArgeoJcrConstants { /** * Add privileges on a path to a {@link Principal}. The path must already - * exist. + * exist. Session is saved. */ public static void addPrivileges(Session session, String path, Principal principal, List privs) @@ -1582,6 +1587,7 @@ public class JcrUtils implements ArgeoJcrConstants { throw new ArgeoException("Don't know how to apply privileges " + privs + " to " + principal + " on " + path); } + session.save(); } }