Repository: airavata
Updated Branches:
  refs/heads/master febe2f925 -> 4f4c79963


validating experiment id when cancelling


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

Branch: refs/heads/master
Commit: 483e9274db29454b3719b2cccbfab2eb02966fbf
Parents: 1b84883
Author: Chathuri Wimalasena <[email protected]>
Authored: Tue May 12 17:10:09 2015 -0400
Committer: Chathuri Wimalasena <[email protected]>
Committed: Tue May 12 17:10:09 2015 -0400

----------------------------------------------------------------------
 .../api/server/handler/AiravataServerHandler.java   | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/483e9274/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git 
a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
 
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index c3039d9..e64a4bd 100644
--- 
a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ 
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -1693,8 +1693,20 @@ public class AiravataServerHandler implements 
Airavata.Iface {
      */
     @Override
     public void terminateExperiment(String airavataExperimentId, String 
tokenId) throws InvalidRequestException, ExperimentNotFoundException, 
AiravataClientException, AiravataSystemException, TException {
-       Client client = getOrchestratorClient();
-       client.terminateExperiment(airavataExperimentId, tokenId);
+        try {
+            if (!(registry.isExist(RegistryModelType.EXPERIMENT, 
airavataExperimentId))){
+                logger.error("Experiment does not exist.Please provide a valid 
experiment id...");
+                throw new 
AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+            }
+            Client client = getOrchestratorClient();
+            client.terminateExperiment(airavataExperimentId, tokenId);
+        } catch (RegistryException e) {
+            logger.errorId(airavataExperimentId, "Error while cancelling the 
experiment...", e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error while cancelling the experiment. More 
info : " + e.getMessage());
+            throw exception;
+        }
     }
 
     /**

Reply via email to