X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.jcr%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fjcr%2Fexecution%2FJcrExecutionProcess.java;h=526b5ebc4e5fb10add998c3b635088423dd59031;hb=6ced86c7baa54ed65d2bb2d7df6664a2dc47450c;hp=998027e8efbc44265dbc9f5d9e68f99ef511bd97;hpb=a181e3d059185a9dc108e81f38c66f48f4e4aac8;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionProcess.java b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionProcess.java index 998027e8e..526b5ebc4 100644 --- a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionProcess.java +++ b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionProcess.java @@ -3,6 +3,8 @@ package org.argeo.slc.jcr.execution; import javax.jcr.Node; import javax.jcr.RepositoryException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.argeo.jcr.JcrUtils; import org.argeo.slc.SlcException; import org.argeo.slc.execution.ExecutionProcess; @@ -10,6 +12,7 @@ import org.argeo.slc.jcr.SlcNames; /** Execution process implementation based on a JCR node. */ public class JcrExecutionProcess implements ExecutionProcess { + private Log log = LogFactory.getLog(JcrExecutionProcess.class); private final Node node; public JcrExecutionProcess(Node node) { @@ -28,13 +31,20 @@ public class JcrExecutionProcess implements ExecutionProcess { try { return node.getProperty(SlcNames.SLC_STATUS).getString(); } catch (RepositoryException e) { - throw new SlcException("Cannot get uuid for " + node, e); + log.error("Cannot get status: " + e); + // we should re-throw exception because this information can + // probably used for monitoring in case there are already unexpected + // exceptions + return UNKOWN; } } public void setStatus(String status) { try { node.setProperty(SlcNames.SLC_STATUS, status); + // last modified properties needs to be manually updated + // see https://issues.apache.org/jira/browse/JCR-2233 + JcrUtils.updateLastModified(node); node.getSession().save(); } catch (RepositoryException e) { try { @@ -42,7 +52,10 @@ public class JcrExecutionProcess implements ExecutionProcess { } catch (RepositoryException e1) { // silent } - throw new SlcException("Cannot get uuid for " + node, e); + // we should re-throw exception because this information can + // probably used for monitoring in case there are already unexpected + // exceptions + log.error("Cannot set status " + status + ": " + e); } }