Fixed issues found when undeploying a non existing application

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

Branch: refs/heads/master
Commit: b5b6eed4d506d2351e18094406cafecf5631d858
Parents: 11bc6bb
Author: Dinithi <[email protected]>
Authored: Wed May 20 10:11:49 2015 +0530
Committer: Lahiru Sandaruwan <[email protected]>
Committed: Wed May 20 15:38:41 2015 +0530

----------------------------------------------------------------------
 .../org/apache/stratos/cli/RestCommandLineService.java | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/b5b6eed4/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
index 01bc45d..edca089 100644
--- 
a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
+++ 
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
@@ -1559,20 +1559,11 @@ public class RestCommandLineService {
         try {
             HttpResponse response = restClient.doPost(httpClient, 
restClient.getBaseURL()
                     + ENDPOINT_UNDEPLOY_APPLICATION.replace("{id}", 
applicationId), "");
-
-            String responseCode = "" + 
response.getStatusLine().getStatusCode();
+            String result = getHttpResponseString(response);
 
             GsonBuilder gsonBuilder = new GsonBuilder();
             Gson gson = gsonBuilder.create();
-
-            if (Integer.parseInt(responseCode) < 300 && 
Integer.parseInt(responseCode) >= 200) {
-                System.out.println("You have successfully undeployed 
application: " + applicationId);
-            } else {
-                String resultString = CliUtils.getHttpResponseString(response);
-                ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
-                System.out.println(exception);
-            }
-
+            System.out.println(gson.fromJson(result, 
ResponseMessageBean.class).getMessage());
         } catch (Exception e) {
             String message = "Could not undeploy application: " + 
applicationId;
             printError(message, e);

Reply via email to