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/17 20:42:56 UTC

stratos git commit: Updating update network partition API method to return the actual error message to the client

Repository: stratos
Updated Branches:
  refs/heads/master 7503728f0 -> 1fb43bce7


Updating update network partition API method to return the actual error message to the client


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

Branch: refs/heads/master
Commit: 1fb43bce73b9f70cfa5a0f09faa57eb7945b9d8f
Parents: 7503728
Author: Imesh Gunaratne <im...@apache.org>
Authored: Mon May 18 00:12:44 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Mon May 18 00:12:44 2015 +0530

----------------------------------------------------------------------
 .../services/impl/CloudControllerServiceImpl.java |  8 +++-----
 .../rest/endpoint/api/StratosApiV41Utils.java     | 18 ++++++------------
 2 files changed, 9 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/1fb43bce/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
index 542641b..8df0919 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java
@@ -1449,7 +1449,6 @@ public class CloudControllerServiceImpl implements CloudControllerService {
                         networkPartition.getId()));
             }
         } catch (Exception e) {
-            // Use the actual error message when throwing the exception to the client
             String message = e.getMessage();
             log.error(message);
             throw new CloudControllerException(message, e);
@@ -1480,7 +1479,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
                         networkPartitionId));
             }
         } catch (Exception e) {
-            String message = "Could not remove network partition";
+            String message = e.getMessage();
             log.error(message);
             throw new CloudControllerException(message, e);
         }
@@ -1530,13 +1529,12 @@ public class CloudControllerServiceImpl implements CloudControllerService {
                 log.info(String.format("Network partition updated successfully: [network-partition-id] %s",
                         networkPartition.getId()));
             }
+            return true;
         } catch (Exception e) {
-            String message = String.format("Could not update network partition: [network-partition-id] %s",
-                    networkPartition.getId());
+            String message = e.getMessage();
             log.error(message);
             throw new CloudControllerException(message, e);
         }
-        return true;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/stratos/blob/1fb43bce/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 dde1f32..d86ab0c 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
@@ -2604,7 +2604,6 @@ public class StratosApiV41Utils {
             serviceClient.addNetworkPartition(
                     ObjectConverter.convertNetworkPartitionToCCStubNetworkPartition(networkPartitionBean));
         } catch (RemoteException e) {
-            // Use the actual error message when returning the error to the client
             String message = e.getMessage();
             log.error(message);
             throw new RestAPIException(message, e);
@@ -2623,7 +2622,7 @@ public class StratosApiV41Utils {
                     serviceClient.getNetworkPartitions();
             return ObjectConverter.convertCCStubNetworkPartitionsToNetworkPartitions(networkPartitions);
         } catch (RemoteException e) {
-            String message = "Could not get network partitions";
+            String message = e.getMessage();
             log.error(message);
             throw new RestAPIException(message, e);
         }
@@ -2640,9 +2639,7 @@ public class StratosApiV41Utils {
             CloudControllerServiceClient serviceClient = CloudControllerServiceClient.getInstance();
             serviceClient.removeNetworkPartition(networkPartitionId);
         } catch (RemoteException e) {
-            String message = String.format(
-                    "Could not remove network partition: [network-partition-id] %s",
-                    networkPartitionId);
+            String message = e.getMessage();
             log.error(message);
             throw new RestAPIException(message, e);
         }
@@ -2661,9 +2658,7 @@ public class StratosApiV41Utils {
                     serviceClient.getNetworkPartition(networkPartitionId);
             return ObjectConverter.convertCCStubNetworkPartitionToNetworkPartition(networkPartition);
         } catch (RemoteException e) {
-            String message = String.format(
-                    "Could not get network partition: [network-partition-id] %s",
-                    networkPartitionId);
+            String message = e.getMessage();
             log.error(message);
             throw new RestAPIException(message, e);
         }
@@ -2681,8 +2676,7 @@ public class StratosApiV41Utils {
             serviceClient.updateNetworkPartition(ObjectConverter.
                     convertNetworkPartitionToCCStubNetworkPartition(networkPartition));
         } catch (RemoteException e) {
-            String message = String.format("Could not update network partition: [network-partition-id] %s,",
-                    networkPartition.getId());
+            String message = e.getMessage();
             log.error(message);
             throw new RestAPIException(message, e);
         }
@@ -2713,11 +2707,11 @@ public class StratosApiV41Utils {
                         deployementPolicyDefinitionBean.getId()));
             }
         } catch (RemoteException e) {
-            String msg = "Could not add deployment policy.";
+            String msg = e.getMessage();
             log.error(msg, e);
             throw new RestAPIException(msg, e);
         } catch (AutoscalerServiceRemoteExceptionException e) {
-            String msg = "Could not add deployment policy.";
+            String msg = e.getMessage();
             log.error(msg, e);
             throw new RestAPIException(msg, e);
         }