Fixing the exception
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/833f3609 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/833f3609 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/833f3609 Branch: refs/heads/master Commit: 833f3609b842b0cd30066d252db709923b847ecc Parents: 6cddb02 Author: Vishanth <[email protected]> Authored: Thu May 14 00:15:08 2015 +0530 Committer: Vishanth <[email protected]> Committed: Thu May 14 00:15:08 2015 +0530 ---------------------------------------------------------------------- .../stratos/autoscaler/registry/RegistryManager.java | 8 +++++--- .../autoscaler/services/impl/AutoscalerServiceImpl.java | 10 +++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/833f3609/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java index 61a73ac..e16d3f5 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java @@ -350,7 +350,7 @@ public class RegistryManager { } - public void updateServiceGroup(ServiceGroup serviceGroup) throws InvalidServiceGroupException { + public void updateServiceGroup(ServiceGroup serviceGroup) throws InvalidServiceGroupException, RegistryException { try { if (serviceGroup == null || StringUtils.isEmpty(serviceGroup.getName())) { throw new IllegalArgumentException("Cartridge group or group name cannot be null"); @@ -366,8 +366,10 @@ public class RegistryManager { log.debug(String.format("Updated cartridge group: [group-name] %s", serviceGroup.getName())); } } catch (Exception e) { - log.error((String.format("Unable to update cartridge group [group-name] %s", - serviceGroup.getName())), e); + String message = (String.format("Unable to update cartridge group [group-name] %s", + serviceGroup.getName())); + log.error(message, e); + throw new RegistryException(message, e); } } http://git-wip-us.apache.org/repos/asf/stratos/blob/833f3609/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java index 248b2a4..cd7e7dc 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java @@ -702,7 +702,15 @@ public class AutoscalerServiceImpl implements AutoscalerService { } } - RegistryManager.getInstance().updateServiceGroup(cartridgeGroup); + try { + RegistryManager.getInstance().updateServiceGroup(cartridgeGroup); + } catch (org.wso2.carbon.registry.core.exceptions.RegistryException e) { + String message = (String.format("Cannot update cartridge group: [group-name] %s", + cartridgeGroup.getName())); + throw new RuntimeException(message, e); + } + + if (log.isInfoEnabled()) { log.info(String.format("Cartridge group successfully updated: [group-name] %s", cartridgeGroup.getName())); }
