Make parsing more robust, better error handling.
authorCharles du Jeu <charles.dujeu@gmail.com>
Mon, 27 Apr 2009 07:29:55 +0000 (07:29 +0000)
committerCharles du Jeu <charles.dujeu@gmail.com>
Mon, 27 Apr 2009 07:29:55 +0000 (07:29 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2377 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/NewLauncherApplet.js
server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Flow.js
server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Module.js
server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Value.js

index 38eeb25feb61cf758c6a4839f3f71b935368f493..e72bdf37e5382527b3e38730943a7ca365e628e0 100644 (file)
@@ -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);
index 017599ee6f2ce64999faf001ef5449a81458d9e4..449b1220fda460d109e6f3b4235a2b98471854a1 100644 (file)
@@ -36,7 +36,8 @@ qx.Class.define("org.argeo.slc.ria.execution.Flow", {
                 * The values to init the ExecutionSpec\r
                 */\r
                values : {\r
-                       check : "Node"\r
+                       check : "Node",\r
+                       nullable : true\r
                },\r
                /**\r
                 * Castor representation of the object \r
@@ -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)\r
                        });\r
                        var values = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_VALUES);\r
-                       this.setValues(values[0]);\r
+                       if(values[0]){\r
+                               this.setValues(values[0]);\r
+                       }\r
                },\r
                /**\r
                 * Get a given value inside the values map\r
index 5a3dd2d0de783c44f2839699411493f9a1d5bc3d..3337b3ca9799432cb50c49bf449e92f3e9beb961 100644 (file)
@@ -99,7 +99,7 @@ qx.Class.define("org.argeo.slc.ria.execution.Module", {
                 */\r
                _applyXmlNode : function(xmlNode){\r
                        // Parse now\r
-                       this.setName(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_NAME));\r
+                       this.setName(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_NAME) || "Not Found");\r
                        this.setVersion(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_VERSION));\r
                        // Parse Specs first\r
                        var specs = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_EXECUTION_SPECS);\r
index b5944a019ab09ac17b5d7309ecaa5ebdf1c9358d..eb56580b6bac5e54d28cb7f3157d86fa64e19c01 100644 (file)
@@ -79,13 +79,13 @@ qx.Class.define("org.argeo.slc.ria.execution.Value", {
                                if(child.nodeType != 1) continue;\r
                                if(child.nodeName == "slc:primitive-spec-attribute"){\r
                                        this.setSpecType("primitive");\r
-                                       this.setSpecSubType(org.argeo.ria.util.Element.getSingleNodeText(child, "@type"));\r
+                                       this.setSpecSubType(org.argeo.ria.util.Element.getSingleNodeText(child, "@type")||"");\r
                                        if(org.argeo.ria.util.Element.getSingleNodeText(child, ".")){\r
                                                this.setValue(org.argeo.ria.util.Element.getSingleNodeText(child, "."));\r
                                        }\r
                                }else if(child.nodeName == "slc:ref-spec-attribute"){\r
                                        this.setSpecType("ref");\r
-                                       this.setSpecSubType(org.argeo.ria.util.Element.getSingleNodeText(child, "@targetClassName"));\r
+                                       this.setSpecSubType(org.argeo.ria.util.Element.getSingleNodeText(child, "@targetClassName")||"");\r
                                }\r
                                this.set({\r
                                        parameter : (org.argeo.ria.util.Element.getSingleNodeText(child, "@isParameter")=="true"?true:false),\r