Check gateway exist before retrieve application interfaces.

Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/49e5201d
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/49e5201d
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/49e5201d

Branch: refs/heads/master
Commit: 49e5201d0d18700321df7efcb0ede7acb260bcac
Parents: e01f24f
Author: shamrath <[email protected]>
Authored: Wed Apr 15 18:43:50 2015 -0400
Committer: shamrath <[email protected]>
Committed: Wed Apr 15 18:43:50 2015 -0400

----------------------------------------------------------------------
 .../component/registry/JCRComponentRegistry.java      | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/49e5201d/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
----------------------------------------------------------------------
diff --git 
a/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
 
b/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
index bf844bc..84d3408 100644
--- 
a/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
+++ 
b/modules/workflow-model/workflow-model-component/src/main/java/org/apache/airavata/workflow/model/component/registry/JCRComponentRegistry.java
@@ -50,11 +50,15 @@ public class JCRComponentRegistry extends ComponentRegistry 
{
     public List<ComponentReference> getComponentReferenceList() {
         List<ComponentReference> tree = new ArrayList<ComponentReference>();
         try {
-            List<ApplicationInterfaceDescription> allApplicationInterfaces = 
client.getAllApplicationInterfaces(gatewayId);
-               for (ApplicationInterfaceDescription interfaceDescription : 
allApplicationInterfaces) {
-                       JCRComponentReference jcr = new 
JCRComponentReference(interfaceDescription.getApplicationName(),interfaceDescription);
-                tree.add(jcr);
-                       }
+            if (client.isGatewayExist(gatewayId)) {
+                List<ApplicationInterfaceDescription> allApplicationInterfaces 
= client.getAllApplicationInterfaces(gatewayId);
+                for (ApplicationInterfaceDescription interfaceDescription : 
allApplicationInterfaces) {
+                    JCRComponentReference jcr = new 
JCRComponentReference(interfaceDescription.getApplicationName(), 
interfaceDescription);
+                    tree.add(jcr);
+                }
+            } else {
+                log.error("Gateway {} Id is not exits", gatewayId);
+            }
         } catch (Exception e) {
             log.error(e.getMessage(), e);
                }

Reply via email to