You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2014/02/14 12:13:44 UTC
[1/2] git commit: handling errors correctly at cli end;
simply passing the error json sent by backend after wrapping to an
object
Updated Branches:
refs/heads/master 029cca0e3 -> 621e7b8c3
handling errors correctly at cli end; simply passing the error json sent by backend after wrapping to an object
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/44223db1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/44223db1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/44223db1
Branch: refs/heads/master
Commit: 44223db10a48838ccc93e578ed84e2be8c78fd09
Parents: b2ba823
Author: Nirmal Fernando <ni...@apache.org>
Authored: Fri Feb 14 16:43:11 2014 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Fri Feb 14 16:43:11 2014 +0530
----------------------------------------------------------------------
.../stratos/cli/RestCommandLineService.java | 54 ++++++++++++--------
1 file changed, 33 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/44223db1/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 e503ffc..b693f16 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
@@ -208,18 +208,20 @@ public class RestCommandLineService {
restClientService.getUsername(), restClientService.getPassword());
String responseCode = "" + response.getStatusLine().getStatusCode();
- if ( ! responseCode.equals(CliConstants.RESPONSE_OK)) {
- System.out.println("Error occured while listing available cartridges");
- return;
- }
-
String resultString = getHttpResponseString(response);
if (resultString == null) {
- return;
+ return;
}
-
+
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.create();
+
+ if ( ! responseCode.equals(CliConstants.RESPONSE_OK)) {
+ ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
+ System.out.println(exception);
+ return;
+ }
+
CartridgeList cartridgeList = gson.fromJson(resultString, CartridgeList.class);
if (cartridgeList == null) {
@@ -300,18 +302,20 @@ public class RestCommandLineService {
restClientService.getUsername(), restClientService.getPassword());
String responseCode = "" + response.getStatusLine().getStatusCode();
- if ( ! responseCode.equals(CliConstants.RESPONSE_OK)) {
- System.out.println("Error occured while listing available cartridges");
- return;
- }
-
String resultString = getHttpResponseString(response);
if (resultString == null) {
- return;
+ return;
}
-
+
GsonBuilder gsonBuilder = new GsonBuilder();
Gson gson = gsonBuilder.create();
+
+ if ( ! responseCode.equals(CliConstants.RESPONSE_OK)) {
+ ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
+ System.out.println(exception);
+ return;
+ }
+
CartridgeList cartridgeList = gson.fromJson(resultString, CartridgeList.class);
if (cartridgeList == null) {
@@ -342,15 +346,17 @@ public class RestCommandLineService {
restClientService.getUsername(), restClientService.getPassword());
String responseCode = "" + response.getStatusLine().getStatusCode();
+ String resultString = getHttpResponseString(response);
+
+ GsonBuilder gsonBuilder = new GsonBuilder();
+ Gson gson = gsonBuilder.create();
+
if ( ! responseCode.equals(CliConstants.RESPONSE_OK)) {
- System.out.println("Error occured while listing subscribe cartridges");
+ ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
+ System.out.println(exception);
return;
}
- String resultString = getHttpResponseString(response);
-
- GsonBuilder gsonBuilder = new GsonBuilder();
- Gson gson = gsonBuilder.create();
CartridgeList cartridgeList = gson.fromJson(resultString, CartridgeList.class);
if (cartridgeList == null) {
@@ -605,8 +611,12 @@ public class RestCommandLineService {
restClientService.getUsername(), restClientService.getPassword());
String responseCode = "" + response.getStatusLine().getStatusCode();
+
+ Gson gson = new Gson();
if ( ! responseCode.equals(CliConstants.RESPONSE_OK)) {
- System.out.println("Error occured while listing members of a cluster");
+ String resultString = getHttpResponseString(response);
+ ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
+ System.out.println(exception);
return null;
}
@@ -854,7 +864,9 @@ public class RestCommandLineService {
System.out.println("Error occured while creating tenant");
return;
} else {
- System.out.println ("Unhandle error");
+ String resultString = getHttpResponseString(response);
+ ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
+ System.out.println(exception);
return;
}
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos
Posted by ni...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/621e7b8c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/621e7b8c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/621e7b8c
Branch: refs/heads/master
Commit: 621e7b8c3951d4f51070c8d1a3e21ee1fe090c5a
Parents: 44223db 029cca0
Author: Nirmal Fernando <ni...@apache.org>
Authored: Fri Feb 14 16:43:19 2014 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Fri Feb 14 16:43:19 2014 +0530
----------------------------------------------------------------------
.../controllers/cartridgeSubscribeSubmit.jag | 10 ++++
.../theme1/partials/subscribe_cartridge.hbs | 46 ++++++++++++++++---
.../theme1/renderers/configure_stratos.js | 7 ---
.../renderers/configure_stratos_wizard.js | 48 ++++++++++++++------
.../console/themes/theme1/renderers/index.js | 1 +
.../theme1/renderers/subscribe_cartridge.js | 3 --
.../console/util/utility.jag | 6 +--
.../apache/stratos/manager/dto/Cartridge.java | 10 ++++
.../rest/endpoint/services/ServiceUtils.java | 22 ++++-----
.../rest/endpoint/services/StratosAdmin.java | 23 +++++-----
.../main/webapp/stratos/WEB-INF/cxf-servlet.xml | 2 +-
11 files changed, 121 insertions(+), 57 deletions(-)
----------------------------------------------------------------------