Repository: stratos
Updated Branches:
  refs/heads/master e7b60f781 -> 6ba4fae38


Refacoter CLI code. Remove redundant variables.


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

Branch: refs/heads/master
Commit: 6ba4fae38d335513c0ac896ebc153e38806f633d
Parents: e7b60f7
Author: Manula Thantriwatte <[email protected]>
Authored: Thu Sep 25 09:22:59 2014 +0000
Committer: Manula Thantriwatte <[email protected]>
Committed: Thu Sep 25 09:22:59 2014 +0000

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     | 25 ++++----------------
 1 file changed, 4 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/6ba4fae3/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 c661ee6..c5fadd8 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
@@ -214,7 +214,7 @@ public class RestCommandLineService {
 
     public Cartridge listCartridge(String cartridgeType) throws 
CommandException{
         DefaultHttpClient httpClient = new DefaultHttpClient();
-        HttpResponse response = null;
+        HttpResponse response;
 
         try {
             String endpoint = restClient.getBaseURL() + 
getListAvailableCartridgeInfoRestEndPoint + "/" + cartridgeType;
@@ -766,8 +766,7 @@ public class RestCommandLineService {
                GsonBuilder gsonBuilder = new GsonBuilder();
                Gson gson = gsonBuilder.create();
 
-               Cluster cluster = gson.fromJson(resultString, Cluster.class);
-               return cluster;
+        return gson.fromJson(resultString, Cluster.class);
        }
        
        private ArrayList<Cluster> getClusterListObjectFromString(String 
resultString) {
@@ -954,7 +953,7 @@ public class RestCommandLineService {
 
             System.out.format("You have successfully subscribed to %s 
cartridge with alias %s.%n", cartridgeType, alias);
 
-            String repoURL = null;
+            String repoURL;
             String hostnames = null;
             String hostnamesLabel = null;
             if (subcriptionInfo != null) {
@@ -1010,7 +1009,6 @@ public class RestCommandLineService {
                String resultString = getHttpResponseString(response);
                ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1039,7 +1037,6 @@ public class RestCommandLineService {
                 String resultString = getHttpResponseString(response);
                 ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                 System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1068,7 +1065,6 @@ public class RestCommandLineService {
                 String resultString = getHttpResponseString(response);
                 ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                 System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1097,7 +1093,6 @@ public class RestCommandLineService {
                 String resultString = getHttpResponseString(response);
                 ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                 System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1193,7 +1188,6 @@ public class RestCommandLineService {
                  String resultString = getHttpResponseString(response);
                  ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                  System.out.println(exception);
-                 return;
             }
 
         } catch ( Exception e) {
@@ -1222,7 +1216,6 @@ public class RestCommandLineService {
                 String resultString = getHttpResponseString(response);
                 ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                 System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1251,7 +1244,6 @@ public class RestCommandLineService {
                 String resultString = getHttpResponseString(response);
                 ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                 System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1309,7 +1301,6 @@ public class RestCommandLineService {
                 String resultString = getHttpResponseString(response);
                 ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                 System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1338,7 +1329,6 @@ public class RestCommandLineService {
                 String resultString = getHttpResponseString(response);
                 ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                 System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1367,7 +1357,6 @@ public class RestCommandLineService {
                 String resultString = getHttpResponseString(response);
                 ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                 System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1463,7 +1452,6 @@ public class RestCommandLineService {
                 String resultString = getHttpResponseString(response);
                 ExceptionMapper exception = gson.fromJson(resultString, 
ExceptionMapper.class);
                 System.out.println(exception);
-                return;
             }
 
         } catch (Exception e) {
@@ -1823,7 +1811,6 @@ public class RestCommandLineService {
                                String resultString = 
getHttpResponseString(response);
                                ExceptionMapper exception = 
gson.fromJson(resultString, ExceptionMapper.class);
                                System.out.println(exception);
-                               return;
                        }
 
                } catch (Exception e) {
@@ -2104,11 +2091,7 @@ public class RestCommandLineService {
                 }
             }
 
-            if (multiTenetCartridge.size() > 0) {
-                return true;
-            } else {
-                return false;
-            }
+            return multiTenetCartridge.size() > 0;
 
         } catch (Exception e) {
             handleException("Exception in listing available cartridges", e);

Reply via email to