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 2014/09/26 11:48:21 UTC
[45/50] [abbrv] git commit: Refacoter CLI code. Remove redundant
variables.
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/1d91cf6b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/1d91cf6b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/1d91cf6b
Branch: refs/heads/master
Commit: 1d91cf6ba8b6a2c1fa832aea6a75d1c8b1297278
Parents: edb4a80
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Thu Sep 25 09:22:59 2014 +0000
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Fri Sep 26 05:31:48 2014 +0000
----------------------------------------------------------------------
.../stratos/cli/RestCommandLineService.java | 25 ++++----------------
1 file changed, 4 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/1d91cf6b/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 85ffb05..1b73a41 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
@@ -217,7 +217,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;
@@ -769,8 +769,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) {
@@ -957,7 +956,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) {
@@ -1013,7 +1012,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1054,7 +1052,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1083,7 +1080,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1112,7 +1108,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1141,7 +1136,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1170,7 +1164,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1331,7 +1324,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch ( Exception e) {
@@ -1360,7 +1352,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1389,7 +1380,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1447,7 +1437,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1476,7 +1465,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -1961,7 +1949,6 @@ public class RestCommandLineService {
String resultString = getHttpResponseString(response);
ExceptionMapper exception = gson.fromJson(resultString, ExceptionMapper.class);
System.out.println(exception);
- return;
}
} catch (Exception e) {
@@ -2258,11 +2245,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);