From 5ae14befdfa100eb6fd6cf17c8b39c1efb8ed34d Mon Sep 17 00:00:00 2001 From: Charles du Jeu Date: Mon, 27 Apr 2009 07:29:55 +0000 Subject: [PATCH] Make parsing more robust, better error handling. git-svn-id: https://svn.argeo.org/slc/trunk@2377 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../slc/class/org/argeo/slc/ria/NewLauncherApplet.js | 8 ++++++-- .../slc/class/org/argeo/slc/ria/execution/Flow.js | 7 +++++-- .../slc/class/org/argeo/slc/ria/execution/Module.js | 2 +- .../slc/class/org/argeo/slc/ria/execution/Value.js | 4 ++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/NewLauncherApplet.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/NewLauncherApplet.js index 38eeb25fe..e72bdf37e 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/NewLauncherApplet.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/NewLauncherApplet.js @@ -297,8 +297,12 @@ qx.Class.define("org.argeo.slc.ria.NewLauncherApplet", var req = org.argeo.slc.ria.SlcApi.getLoadExecutionDescriptorService(agentUuid,moduleData.name, moduleData.version); req.addListener("completed", function(response){ - var executionModule = new org.argeo.slc.ria.execution.Module(); - executionModule.setXmlNode(response.getContent()); + var executionModule = new org.argeo.slc.ria.execution.Module(); + try{ + executionModule.setXmlNode(response.getContent()); + }catch(e){ + this.error(e); + } var execFlows = executionModule.getExecutionFlows(); for(var key in execFlows){ var file = new qx.ui.tree.TreeFile(key); diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Flow.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Flow.js index 017599ee6..449b1220f 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Flow.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Flow.js @@ -36,7 +36,8 @@ qx.Class.define("org.argeo.slc.ria.execution.Flow", { * The values to init the ExecutionSpec */ values : { - check : "Node" + check : "Node", + nullable : true }, /** * Castor representation of the object @@ -81,7 +82,9 @@ qx.Class.define("org.argeo.slc.ria.execution.Flow", { executionSpecName : org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_EXEC_SPEC_NAME) }); var values = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_VALUES); - this.setValues(values[0]); + if(values[0]){ + this.setValues(values[0]); + } }, /** * Get a given value inside the values map diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Module.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Module.js index 5a3dd2d0d..3337b3ca9 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Module.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Module.js @@ -99,7 +99,7 @@ qx.Class.define("org.argeo.slc.ria.execution.Module", { */ _applyXmlNode : function(xmlNode){ // Parse now - this.setName(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_NAME)); + this.setName(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_NAME) || "Not Found"); this.setVersion(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_VERSION)); // Parse Specs first var specs = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_EXECUTION_SPECS); diff --git a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js index b5944a019..eb56580b6 100644 --- a/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js +++ b/server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js @@ -79,13 +79,13 @@ qx.Class.define("org.argeo.slc.ria.execution.Value", { if(child.nodeType != 1) continue; if(child.nodeName == "slc:primitive-spec-attribute"){ this.setSpecType("primitive"); - this.setSpecSubType(org.argeo.ria.util.Element.getSingleNodeText(child, "@type")); + this.setSpecSubType(org.argeo.ria.util.Element.getSingleNodeText(child, "@type")||""); if(org.argeo.ria.util.Element.getSingleNodeText(child, ".")){ this.setValue(org.argeo.ria.util.Element.getSingleNodeText(child, ".")); } }else if(child.nodeName == "slc:ref-spec-attribute"){ this.setSpecType("ref"); - this.setSpecSubType(org.argeo.ria.util.Element.getSingleNodeText(child, "@targetClassName")); + this.setSpecSubType(org.argeo.ria.util.Element.getSingleNodeText(child, "@targetClassName")||""); } this.set({ parameter : (org.argeo.ria.util.Element.getSingleNodeText(child, "@isParameter")=="true"?true:false), -- 2.39.2