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/3e12693a Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/3e12693a Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/3e12693a Branch: refs/heads/master Commit: 3e12693a76e1671a04ba85057e2a6b199f552b0d Parents: 924a8f6 Author: Dinithi <[email protected]> Authored: Wed May 20 10:11:49 2015 +0530 Committer: Dinithi <[email protected]> Committed: Wed May 20 10:11:49 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/3e12693a/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);
