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 15:06:00 UTC

[1/2] stratos git commit: This closes #342 on GitHub

Repository: stratos
Updated Branches:
  refs/heads/master 6cbe1e378 -> b421b81a2


This closes #342 on GitHub


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

Branch: refs/heads/master
Commit: b421b81a2e0d1b5cb7ca48eb63ea6c9901cfe5ca
Parents: 33f742d
Author: Imesh Gunaratne <im...@apache.org>
Authored: Tue May 19 18:35:55 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue May 19 18:35:55 2015 +0530

----------------------------------------------------------------------

----------------------------------------------------------------------



[2/2] stratos git commit: Fixed issues found when adding a user with a non existing user role

Posted by im...@apache.org.
Fixed issues found when adding a user with a non existing user role


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

Branch: refs/heads/master
Commit: 33f742d12e131d755b3b1feef345286150bb2264
Parents: 6cbe1e3
Author: Dinithi <di...@wso2.com>
Authored: Tue May 19 18:07:14 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Tue May 19 18:35:55 2015 +0530

----------------------------------------------------------------------
 .../org/apache/stratos/cli/RestCommandLineService.java   | 11 +++++------
 .../manager/user/management/StratosUserManagerUtils.java |  2 +-
 .../stratos/rest/endpoint/api/StratosApiV41Utils.java    |  3 +--
 3 files changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/33f742d1/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 f878e5f..30b332e 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
@@ -63,6 +63,8 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 
+import static org.apache.stratos.cli.utils.CliUtils.getHttpResponseString;
+
 public class RestCommandLineService {
 
     private static final Logger log = LoggerFactory.getLogger(RestCommandLineService.class);
@@ -685,12 +687,9 @@ public class RestCommandLineService {
             HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
                     + ENDPOINT_ADD_USER, jsonString);
 
-            int responseCode = response.getStatusLine().getStatusCode();
-            if (responseCode < 200 || responseCode >= 300) {
-                CliUtils.printError(response);
-            } else {
-                System.out.println("User added successfully: " + userName);
-            }
+            String result = getHttpResponseString(response);
+            System.out.println(gson.fromJson(result, ResponseMessageBean.class).getMessage());
+
         } catch (Exception e) {
             String message = "Could not add user: " + userName;
             printError(message, e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/33f742d1/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java
index 5ca089d..0f9deeb 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/user/management/StratosUserManagerUtils.java
@@ -71,7 +71,7 @@ public class StratosUserManagerUtils {
         } catch (UserStoreException e) {
             String msg = "Error in adding user " + userInfoBean.getUserName() + " to User Store";
             log.error(msg, e);
-            throw new UserManagerException(msg, e);
+            throw new UserManagerException(e.getMessage());
         }
 
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/33f742d1/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 35d2668..70f18ef 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
@@ -3243,9 +3243,8 @@ public class StratosApiV41Utils {
         } catch (UserManagerException e) {
             String msg = "Error in adding User";
             log.error(msg, e);
-            throw new RestAPIException(msg, e);
+            throw new RestAPIException(e.getMessage());
         }
-
     }