From 2092972bbbc79f491dc9e2b68a708561a4a09a4b Mon Sep 17 00:00:00 2001 From: Michael Kraxner Date: Wed, 3 Sep 2014 15:01:40 +0200 Subject: [PATCH] fixes #236, crash after enabling discarded alternative * when importing a plan links from values to scales have been established only for enabled alternatives. But alternatives can be discarded when they are (partially) evaluated. therefore the links for all values have to be established. --- .../java/eu/scape_project/planning/xml/PlanParser.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/planning-core/src/main/java/eu/scape_project/planning/xml/PlanParser.java b/planning-core/src/main/java/eu/scape_project/planning/xml/PlanParser.java index 3ac2a40e..193874b3 100644 --- a/planning-core/src/main/java/eu/scape_project/planning/xml/PlanParser.java +++ b/planning-core/src/main/java/eu/scape_project/planning/xml/PlanParser.java @@ -274,9 +274,11 @@ public List importProjects(final InputStream in) throws PlatoException { String projectName = plan.getPlanProperties().getName(); if ((projectName != null) && (!"".equals(projectName))) { /* - * establish links from values to scales + * establish links from values to scales. For all(!) + * alternatives: An alternative could have be discarded + * after some measurements have already been added. */ - plan.getTree().initValues(plan.getAlternativesDefinition().getConsideredAlternatives(), + plan.getTree().initValues(plan.getAlternativesDefinition().getAlternatives(), plan.getSampleRecordsDefinition().getRecords().size(), true); /* * establish references of Experiment.uploads @@ -520,7 +522,7 @@ private static void addRules(Digester digester) throws ParserConfigurationExcept digester.addSetNext("*/experiment", "setExperiment"); digester.addCallMethod("*/experiment/description", "setDescription", 0); digester.addCallMethod("*/experiment/settings", "setSettings", 0); - PlanParser.addCreateUpload(digester, "*/experiment/workflow", "setWorkflow", DigitalObject.class); + PlanParser.addCreateUpload(digester, "*/experiment/workflow", "setWorkflow", DigitalObject.class); PlanParser.addCreateUpload(digester, "*/experiment/results/result", null, DigitalObject.class); PlanParser.addCreateUpload(digester, "*/result/xcdlDescription", "setXcdlDescription", XcdlDescription.class);