Updated Branches:
  refs/heads/master 21904cf33 -> fef8f6d4a

CS-15703: EC2 tag support, improve error handling. Component: AWSAPI.

Handle exceptions thrown when invalid syntax is used to create or delete tags.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/fef8f6d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/fef8f6d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/fef8f6d4

Branch: refs/heads/master
Commit: fef8f6d4af95dad57fe5e009133ac5c4338e2be3
Parents: 21904cf
Author: Likitha Shetty <[email protected]>
Authored: Mon Aug 27 15:45:55 2012 -0700
Committer: Prachi Damle <[email protected]>
Committed: Mon Aug 27 15:56:13 2012 -0700

----------------------------------------------------------------------
 .../cloud/bridge/service/EC2SoapServiceImpl.java   |    4 ++++
 .../service/exception/EC2ServiceException.java     |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fef8f6d4/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java 
b/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
index 38f80c8..c23a11d 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
@@ -259,6 +259,10 @@ public class EC2SoapServiceImpl implements 
AmazonEC2SkeletonInterface  {
             List<String> resourceTypeList = new ArrayList<String>();
             if (items != null) {
                 for( int i=0; i < items.length; i++ ) {
+                    if (!items[i].getResourceId().contains(":") || 
items[i].getResourceId().split(":").length != 2) {
+                        throw new EC2ServiceException( 
ClientError.InvalidResourceId_Format,
+                                "Invalid Format. ResourceId format is 
resource-type:resource-uuid");
+                    }
                     String resourceType = 
items[i].getResourceId().split(":")[0];
                     if (resourceTypeList.isEmpty())
                         resourceTypeList.add(resourceType);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/fef8f6d4/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java
----------------------------------------------------------------------
diff --git 
a/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java 
b/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java
index f40278d..e1f515a 100644
--- a/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java
+++ b/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java
@@ -78,6 +78,7 @@ public class EC2ServiceException extends RuntimeException {
                
InvalidPermission_Malformed("Client.InvalidPermission.Malformed", 400),
                
InvalidReservationID_Malformed("Client.InvalidReservationID.Malformed", 400),
                
InvalidReservationID_NotFound("Client.InvalidReservationID.NotFound", 400),
+               InvalidResourceId_Format("Client.InvalidResourceId.Format", 
400),
                
InvalidSnapshotID_Malformed("Client.InvalidSnapshotID.Malformed", 400),
                InvalidSnapshot_NotFound("Client.InvalidSnapshot.NotFound", 
400),
                InvalidUserID_Malformed("Client.InvalidUserID.Malformed", 400),

Reply via email to