You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ma...@apache.org on 2013/12/12 16:16:33 UTC

[1/2] git commit: Error handling in CLI

Updated Branches:
  refs/heads/master 842562471 -> 939f673f3


Error handling in CLI


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

Branch: refs/heads/master
Commit: 51dbd33ce14485a66235fb6c9b92cbfa4d01003d
Parents: 69e3690
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Thu Dec 12 20:45:54 2013 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Thu Dec 12 20:45:54 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/51dbd33c/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 9f0b696..defc011 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
@@ -37,6 +37,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.ConnectException;
+import java.net.SocketException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -172,12 +173,17 @@ public class RestCommandLineService {
 
             String resultString = getHttpResponseString(response);
 
+            if (resultString == null) {
+                return;
+            }
+
             GsonBuilder gsonBuilder = new GsonBuilder();
             Gson gson = gsonBuilder.create();
             CartridgeList cartridgeList = gson.fromJson(resultString, CartridgeList.class);
 
             if (cartridgeList == null) {
                 System.out.println("Available cartridge list is null");
+                return;
             }
 
             CartridgeList multiTelentCartridgeList = new CartridgeList();
@@ -239,7 +245,7 @@ public class RestCommandLineService {
                 System.out.println();
             }
         } catch (Exception e) {
-                e.printStackTrace();
+            e.printStackTrace();
         }
     }
 
@@ -258,6 +264,7 @@ public class RestCommandLineService {
 
             if (cartridgeList == null) {
                 System.out.println("Subscribe cartridge list is null");
+                return;
             }
 
             Cartridge[] cartridges = new Cartridge[cartridgeList.getCartridge().size()];
@@ -464,7 +471,6 @@ public class RestCommandLineService {
 
             String result = getHttpResponseString(response);
             String responseCode = "" + response.getStatusLine().getStatusCode();
-            System.out.println(responseCode);
 
             if (responseCode.equals(CliConstants.RESPONSE_AUTHORIZATION_FAIL)) {
                 System.out.println("Invalid operation. Authorization failed");
@@ -644,6 +650,9 @@ public class RestCommandLineService {
                 result += output;
             }
             return result;
+        } catch (SocketException e) {
+            System.out.println("Connection problem");
+            return null;
         } catch (IOException e) {
             e.printStackTrace();
             return null;


[2/2] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by ma...@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/939f673f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/939f673f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/939f673f

Branch: refs/heads/master
Commit: 939f673f3f27731dcab2085f6af93ef8d9e0a4fe
Parents: 51dbd33 8425624
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Thu Dec 12 20:46:16 2013 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Thu Dec 12 20:46:16 2013 +0530

----------------------------------------------------------------------
 .../tenancy/SubscriptionSingleTenantBehaviour.java           | 8 ++++++++
 .../apache/stratos/messaging/domain/topology/Cluster.java    | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------