From 49e47485cd7f15b8498ec382fdcad342ea29fe5c Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Thu, 17 Jan 2013 21:50:21 +0000 Subject: [PATCH 1/1] Fix bug when test are in error git-svn-id: https://svn.argeo.org/slc/trunk@6042 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../java/org/argeo/slc/jcr/JcrTestResult.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 45de6597a..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,22 +127,22 @@ public class JcrTestResult implements TestResult, SlcNames, AttachmentsEnabled { public void addResultPart(TestResultPart testResultPart) { Node node = getNode(); - + try { - - // error - if (testResultPart.getExceptionMessage() != null) - JcrUtils.discardQuietly(node.getSession()); + // 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); resultPartNode.setProperty(SLC_SUCCESS, testResultPart.getStatus() == TestStatus.PASSED); - // if (testResultPart.getMessage() != null) - // resultPartNode.setProperty(SLC_MESSAGE, - // testResultPart.getMessage()); + if (testResultPart.getMessage() != null) + resultPartNode.setProperty(SLC_MESSAGE, + testResultPart.getMessage()); if (testResultPart.getStatus() == TestStatus.ERROR) { resultPartNode.setProperty(SLC_ERROR_MESSAGE, (testResultPart.getExceptionMessage() == null) ? "" @@ -204,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); } } -- 2.39.2