]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java
Make JcrUtils.get() return null for missing property
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.jcr / src / main / java / org / argeo / jcr / JcrUtils.java
index 4c0cbf39ddb351045b065402043ed9813ecd3bb0..e7b3656cfd8e5e7e195a873924f65b92c95eefcb 100644 (file)
@@ -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