You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/05/19 13:26:14 UTC
[2/3] stratos git commit: adding a proper response message when
trying to deploy a non existing application
adding a proper response message when trying to deploy 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/2830f3c9
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/2830f3c9
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/2830f3c9
Branch: refs/heads/master
Commit: 2830f3c9f97c2f500380f4b429cec4fb2e74f817
Parents: 36c0e12
Author: Dinithi <di...@wso2.com>
Authored: Tue May 19 15:32:46 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue May 19 16:56:07 2015 +0530
----------------------------------------------------------------------
.../org/apache/stratos/rest/endpoint/api/StratosApiV41.java | 7 ++++++-
.../apache/stratos/rest/endpoint/api/StratosApiV41Utils.java | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/2830f3c9/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
index 9f977ee..f62c193 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
@@ -800,7 +800,12 @@ public class StratosApiV41 extends AbstractApi {
return Response.status(Response.Status.CONFLICT).entity(new ResponseMessageBean(
ResponseMessageBean.ERROR, "Application policy already deployed")).build();
} catch (RestAPIException e) {
- throw e;
+ if (e.getMessage().contains("Application not found")) {
+ return Response.status(Response.Status.BAD_REQUEST).entity(new ResponseMessageBean(
+ ResponseMessageBean.ERROR, e.getMessage())).build();
+ } else {
+ throw e;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/2830f3c9/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index 4e90a0b..794907b 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -1622,7 +1622,7 @@ public class StratosApiV41Utils {
ApplicationContext application = autoscalerServiceClient.getApplication(applicationId);
if (application == null) {
- String message = String.format("Application is not found: [application-id] %s", applicationId);
+ String message = String.format("Application not found: [application-id] %s", applicationId);
log.error(message);
throw new RestAPIException(message);
}