X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.jcr%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fjcr%2FJcrTestResult.java;h=0b419ccd7cad8e587d3e98c6f30bc76f1ecf9bac;hb=ce8f53763eec2a2b9e15e97f2eaa8468b551ea31;hp=a27217811938bc95310773dad8324abd74f19c42;hpb=89114859830f6e159a259937375bd063f25f80c9;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/JcrTestResult.java b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/JcrTestResult.java index a27217811..0b419ccd7 100644 --- a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/JcrTestResult.java +++ b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/JcrTestResult.java @@ -127,7 +127,14 @@ public class JcrTestResult implements TestResult, SlcNames, AttachmentsEnabled { public void addResultPart(TestResultPart testResultPart) { Node node = getNode(); + try { + // error : revert all unsaved changes on the resultNode to be sure + // it is in a consistant state + if (testResultPart.getExceptionMessage() != null) + JcrUtils.discardQuietly(node.getSession()); + node.getSession().save(); + // add the new result part, retrieving status information Node resultPartNode = node.addNode(SlcNames.SLC_RESULT_PART, SlcTypes.SLC_CHECK); @@ -197,7 +204,7 @@ public class JcrTestResult implements TestResult, SlcNames, AttachmentsEnabled { node.getSession().save(); } catch (Exception e) { JcrUtils.discardUnderlyingSessionQuietly(node); - throw new SlcException("Cannot get UUID from " + node, e); + throw new SlcException("Cannot add ResultPart to node " + node, e); } }