mirror of https://github.com/apache/cloudstack.git
CS-15703: EC2 tag support, improve error handling. Component: AWSAPI.
Handle exceptions thrown when invalid syntax is used to create or delete tags.
This commit is contained in:
parent
21904cf33b
commit
fef8f6d4af
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in New Issue