Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5399CE45C for ; Sat, 19 Jan 2013 00:00:31 +0000 (UTC) Received: (qmail 26818 invoked by uid 500); 19 Jan 2013 00:00:16 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 26731 invoked by uid 500); 19 Jan 2013 00:00:16 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 24827 invoked by uid 99); 19 Jan 2013 00:00:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Jan 2013 00:00:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 84A6181FA58; Sat, 19 Jan 2013 00:00:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ahuang@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [11/51] [abbrv] Clean up ApiServer, ApiServlet and ApiDispatcher flow to handle various CloudRuntimeException and CloudException in one place, and Introduced ApiErrorCode to handle CloudStack API error code to standard Http code mapping. Message-Id: <20130119000013.84A6181FA58@tyr.zones.apache.org> Date: Sat, 19 Jan 2013 00:00:13 +0000 (UTC) http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java index 8db731d..734b18b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.api.command.admin.offering; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -91,7 +92,7 @@ public class UpdateDiskOfferingCmd extends BaseCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update disk offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update disk offering"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java index 38220b9..9dddd7d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java @@ -89,7 +89,7 @@ public class UpdateServiceOfferingCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service offering"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java index 331968b..95d9e53 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java @@ -111,7 +111,7 @@ public class CreatePodCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create pod"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create pod"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java index 8c64a8d..4080a7c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.pod; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -70,7 +71,7 @@ public class DeletePodCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete pod"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete pod"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java index ca5e039..c99da9d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java @@ -110,7 +110,7 @@ public class UpdatePodCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update pod"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update pod"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java index 0e55918..97ec1dc 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java @@ -99,7 +99,7 @@ public class UploadCustomCertificateCmd extends BaseAsyncCmd { response.setObjectName("customcertificate"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upload custom certificate"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload custom certificate"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java index be6be26..766e19c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.router; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -120,7 +121,7 @@ public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd { routerResponse.setResponseName(getCommandName()); this.setResponseObject(routerResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure the virtual router provider"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the virtual router provider"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java index f6a7b74..54a8409 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java @@ -82,7 +82,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network"); } } @@ -93,7 +93,7 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java index 1157aaa..1645456 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.router; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -104,7 +105,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy router"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java index 9c50d2f..a095fce 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java @@ -98,7 +98,7 @@ public class RebootRouterCmd extends BaseAsyncCmd { response.setResponseName("router"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot router"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java index f1f3f68..595afc7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java @@ -102,7 +102,7 @@ public class StartRouterCmd extends BaseAsyncCmd { routerResponse.setResponseName(getCommandName()); this.setResponseObject(routerResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to start router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start router"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java index 2d1b609..571b2c1 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.router; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -109,7 +110,7 @@ public class StopRouterCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to stop router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop router"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java index e2b020e..f8742a2 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java @@ -81,7 +81,7 @@ public class UpgradeRouterCmd extends BaseCmd { routerResponse.setResponseName(getCommandName()); this.setResponseObject(routerResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upgrade router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java index 13f066a..ec62858 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java @@ -31,6 +31,7 @@ import static org.apache.cloudstack.api.BaseCmd.CommandType.STRING; import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN; import static com.cloud.user.Account.ACCOUNT_ID_SYSTEM; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -93,12 +94,12 @@ public final class AddS3Cmd extends BaseCmd { result = _resourceService.discoverS3(this); if (result == null) { - throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3."); } } catch (DiscoveryException e) { - throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage()); } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java index 24ef48b..59a2164 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.storage; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -107,7 +108,7 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel primary storage maintenance"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cancel primary storage maintenance"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java index 78a142a..b506811 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java @@ -122,17 +122,17 @@ public class CreateStoragePoolCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add storage pool"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add storage pool"); } } catch (ResourceUnavailableException ex1) { s_logger.warn("Exception: ", ex1); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex1.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex1.getMessage()); }catch (ResourceInUseException ex2) { s_logger.warn("Exception: ", ex2); - throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex2.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex2.getMessage()); } catch (UnknownHostException ex3) { s_logger.warn("Exception: ", ex3); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex3.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex3.getMessage()); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java index 1510f78..8cf4a4b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java @@ -78,9 +78,9 @@ public class DeletePoolCmd extends BaseCmd { } else { StoragePool pool = _storageService.getStoragePool(id); if (pool != null && pool.getStatus() == StoragePoolStatus.Removed) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed"); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete storage pool"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete storage pool"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java index 6a41755..ab9c226 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.storage; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -105,7 +106,7 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd { response.setResponseName("storagepool"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java index 806df56..b60ed7f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java @@ -78,7 +78,7 @@ public class UpdateStoragePoolCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update storage pool"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update storage pool"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java index 23a00ca..61f903e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java @@ -92,12 +92,12 @@ public class AddSwiftCmd extends BaseCmd { swiftResponse.setObjectName("swift"); this.setResponseObject(swiftResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Swift"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Swift"); } } catch (DiscoveryException ex) { String errMsg = "Failed to add Swift due to " + ex.toString(); s_logger.warn(errMsg, ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, errMsg); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errMsg); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java index ad0f09c..dc53ea7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java @@ -95,7 +95,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to destroy system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to destroy system vm"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java index dd844ac..909fe20 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.systemvm; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -116,20 +117,20 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate the system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate the system vm"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } catch (ManagementServerException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } catch (VirtualMachineMigrationException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java index 49e895b..2e7b530 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.systemvm; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -105,7 +106,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java index 70ab5f3..40f9d62 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.systemvm; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -109,7 +110,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to start system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to start system vm"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java index af2bd3a..134043c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java @@ -112,7 +112,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to stop system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to stop system vm"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java index 290c360..14046f3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java @@ -94,7 +94,7 @@ public class UpgradeSystemVMCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java index 5dca9d2..a733624 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java @@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -123,7 +124,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network"); } } @@ -134,7 +135,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java index bb665fb..5269218 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java @@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.TrafficTypeResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -73,7 +74,7 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete traffic type"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete traffic type"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java index 279c2b8..fca0702 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.usage; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -95,7 +96,7 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update traffic type"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update traffic type"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java index 2045abf..1f1e3ab 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.user; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -137,7 +138,7 @@ public class CreateUserCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java index a43501e..74a073c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.user; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -76,7 +77,7 @@ public class DeleteUserCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java index f483e62..6b59de5 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.user; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -92,7 +93,7 @@ public class DisableUserCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable user"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java index e444aa3..bcd0f43 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java @@ -76,7 +76,7 @@ public class EnableUserCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable user"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java index 622b4e9..1b00bfd 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.user; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -77,7 +78,7 @@ public class LockUserCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to lock user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock user"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java index 170d852..00bfccc 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java @@ -132,7 +132,7 @@ public class UpdateUserCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update user"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java index c971748..9ac1e25 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java @@ -169,14 +169,14 @@ public class CreateVlanIpRangeCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vlan ip range"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vlan ip range"); } } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientCapacityException ex) { s_logger.info(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java index f12b217..d45082a 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java @@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.VlanIpRangeResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -70,7 +71,7 @@ public class DeleteVlanIpRangeCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete vlan ip range"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vlan ip range"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java index 3482ec7..525e8d7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java @@ -101,14 +101,14 @@ public class AssignVMCmd extends BaseCmd { try { UserVm userVm = _userVmService.moveVMToUser(this); if (userVm == null){ - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to move vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm"); } UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0); response.setResponseName(DeployVMCmd.getResultObjectName()); this.setResponseObject(response); }catch (Exception e){ e.printStackTrace(); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to move vm " + e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm " + e.getMessage()); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java index 5bb694d..e1f20a8 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java @@ -150,20 +150,20 @@ public class MigrateVMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } catch (ManagementServerException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } catch (VirtualMachineMigrationException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java index f830861..be4d10b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.vm; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -77,7 +78,7 @@ public class RecoverVMCmd extends BaseCmd { recoverVmResponse.setResponseName(getCommandName()); this.setResponseObject(recoverVmResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recover vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recover vm"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java index 5bb76ab..392b627 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java @@ -21,6 +21,7 @@ import org.apache.cloudstack.api.response.VpcResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.BaseCmd; @@ -115,17 +116,17 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd { } catch (InsufficientCapacityException ex){ s_logger.info(ex); s_logger.trace(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } if (result != null) { this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private gateway"); } } @@ -138,7 +139,7 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private gateway"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java index 273f7c0..8ccb9d5 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java @@ -72,7 +72,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{ this.setEntityId(vpcOff.getId()); this.setEntityUuid(vpcOff.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a VPC offering"); } } @@ -84,7 +84,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPC offering"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java index 4a1e8d0..2b0e1a6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java @@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.PrivateGatewayResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -87,7 +88,7 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete private gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete private gateway"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java index 231f2ee..9a257c2 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java @@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -71,7 +72,7 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC offering"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java index 65df48e..c8fa77d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java @@ -90,7 +90,7 @@ public class UpdateVPCOfferingCmd extends BaseAsyncCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update VPC offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC offering"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java index e49f243..ae57fae 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.zone; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -156,7 +157,7 @@ public class CreateZoneCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a zone"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a zone"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java index d09c7ff..e9a02ac 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java @@ -71,7 +71,7 @@ public class DeleteZoneCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete zone"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete zone"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java index 816befb..59a37c9 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.zone; import org.apache.log4j.Logger; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; @@ -109,7 +110,7 @@ public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd { this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to mark the account with the default zone"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to mark the account with the default zone"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java index 0bfd1a3..143c8f7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java @@ -164,7 +164,7 @@ public class UpdateZoneCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update zone; internal error."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update zone; internal error."); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java index 889c369..f62be0b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java @@ -87,7 +87,7 @@ public class AddAccountToProjectCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add account to the project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add account to the project"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java index f9e967a..ef14d1a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java @@ -76,7 +76,7 @@ public class DeleteAccountFromProjectCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete account from the project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete account from the project"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java index 93bb240..4437191 100644 --- a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java @@ -21,6 +21,7 @@ import java.util.List; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.BaseCmd; @@ -219,15 +220,15 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { this.setEntityId(ip.getId()); this.setEntityUuid(ip.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to allocate ip address"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to allocate ip address"); } } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientAddressCapacityException ex) { s_logger.info(ex); s_logger.trace(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } } @@ -249,7 +250,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { ipResponse.setResponseName(getCommandName()); this.setResponseObject(ipResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to assign ip address"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign ip address"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java index 20ccd89..c208a1a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java @@ -75,7 +75,7 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disassociate ip address"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disassociate ip address"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java index e92721d..987d305 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java @@ -157,7 +157,7 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create AutoScale Policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create AutoScale Policy"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java index e3d47a0..400be5d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java @@ -159,7 +159,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); } } @@ -182,7 +182,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { } finally { if (!success || vmGroup == null) { _autoScaleService.deleteAutoScaleVmGroup(getEntityId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java index 25bb03b..39814e7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java @@ -22,6 +22,7 @@ import java.util.Map; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -231,7 +232,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile"); } } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java index 58926f2..89da234 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java @@ -22,6 +22,7 @@ import org.apache.cloudstack.api.response.DomainResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -74,7 +75,7 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd { this.setEntityId(condition.getId()); this.setEntityUuid(condition.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create condition."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create condition."); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java index 483a87a..aa236ee 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java @@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -92,7 +93,7 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd { this.setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale policy " + getId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete AutoScale Policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete AutoScale Policy"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java index 1d78fe8..54eb746 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java @@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -92,7 +93,7 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd { this.setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale vm group " + getId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete autoscale vm group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm group"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java index e49f0c8..726f006 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java @@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -91,7 +92,7 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { this.setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale vm profile " + getId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete autoscale vm profile"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm profile"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java index a1fba2e..5ce1ee2 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java @@ -21,6 +21,7 @@ import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -57,14 +58,14 @@ public class DeleteConditionCmd extends BaseAsyncCmd { result = _autoScaleService.deleteCondition(getId()); } catch (ResourceInUseException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage()); } if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { s_logger.warn("Failed to delete condition " + getId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete condition."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete condition."); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java index 2aba82c..f4f9212 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java @@ -20,6 +20,7 @@ package org.apache.cloudstack.api.command.user.autoscale; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -56,7 +57,7 @@ public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java index db7acdf..80ac818 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java @@ -52,7 +52,7 @@ public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java index 56d7107..6a55a4a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java @@ -23,6 +23,7 @@ import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; @@ -68,7 +69,7 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update autoscale policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale policy"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java index ea5b6a9..fc6a7c6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java @@ -75,7 +75,7 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update autoscale VmGroup"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale VmGroup"); } } http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java index c8ef8b1..570ed0b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java @@ -73,7 +73,7 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update autoscale vm profile"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale vm profile"); } }