diff --git a/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java b/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java index 0f0e309db88..6958248a5c8 100644 --- a/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java +++ b/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java @@ -81,6 +81,7 @@ import com.cloud.bridge.service.core.ec2.EC2Volume; import com.cloud.bridge.service.core.ec2.EC2VolumeFilterSet; import com.cloud.bridge.service.exception.EC2ServiceException; import com.cloud.bridge.service.exception.EC2ServiceException.ClientError; +import com.cloud.bridge.service.exception.EC2ServiceException.ServerError; import com.cloud.bridge.util.EC2RestAuth; @@ -247,7 +248,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface { request.setAttribute(ImageAttribute.launchPermission); return toDescribeImageAttributeResponse( engine.describeImageAttribute( request )); } - else throw new EC2ServiceException( "Unsupported - only description or launchPermission supported", 501 ); + else throw new EC2ServiceException( ClientError.Unsupported, "Unsupported - only description or launchPermission supported" ); } @@ -292,7 +293,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface { request.addInstanceId( diat.getInstanceId()); return toDescribeInstanceAttributeResponse( engine.describeInstances( request )); } - throw new EC2ServiceException( "Unsupported - only instanceType supported", 501 ); + throw new EC2ServiceException( ClientError.Unsupported, "Unsupported - only instanceType supported"); } @@ -484,7 +485,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface { } return toModifyImageAttributeResponse( engine.modifyImageAttribute( request )); } - throw new EC2ServiceException( "Unsupported - can only modify image description or launchPermission", 501 ); + throw new EC2ServiceException( ClientError.Unsupported, "Unsupported - can only modify image description or launchPermission"); } private void setAccountOrGroupList(LaunchPermissionItemType[] items, EC2ModifyImageAttribute request){ @@ -586,7 +587,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface { request.setLaunchPermOperation(EC2ModifyImageAttribute.Operation.reset); return toResetImageAttributeResponse( engine.modifyImageAttribute( request )); } - throw new EC2ServiceException( "Unsupported - can only reset image launchPermission", 501 ); + throw new EC2ServiceException( ClientError.Unsupported, "Unsupported - can only reset image launchPermission" ); } /** diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java index 8cd697c9b6f..d0a44de0e0b 100644 --- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java +++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java @@ -55,10 +55,10 @@ public class EC2InstanceFilterSet { String value = (String) filterTypes.get( filterName ); if (null == value) - throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 1", 501 ); + throw new EC2ServiceException( "Unsupported filter [" + filterName + "]", 501 ); if (null != value && value.equalsIgnoreCase( "null" )) - throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 2", 501 ); + throw new EC2ServiceException( "Unsupported filter [" + filterName + "]", 501 ); // ToDo we could add checks to make sure the type of a filters value is correct (e.g., an integer) filterSet.add( param ); diff --git a/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java b/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java index de6446a7c2f..8b26d61d40c 100644 --- a/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java +++ b/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java @@ -29,7 +29,7 @@ public class EC2ServiceException extends RuntimeException { InsufficientInstanceCapacity("Server.InsufficientInstanceCapacity", 500), InsufficientReservedInstanceCapacity("Server.InsufficientReservedInstanceCapacity", 500), InternalError("Server.InternalError", 500), - Unavailable("Server.Unavailable", 500); + Unavailable("Server.Unavailable", 501); private String errorString; private int httpErrorCode; @@ -126,7 +126,7 @@ public class EC2ServiceException extends RuntimeException { } public EC2ServiceException(String message, int errorCode) { - super(message); + super(message, new AxisFault(message, new QName("Error"))); this.httpErrorCode = errorCode; }