mirror of https://github.com/apache/cloudstack.git
CS-14682 - When invalid filter name is provided in ec2-describe-instances command , java.lang.reflect.InvocationTargetException is thrown.
Changes: - AxisFault was not being constructed in some cases
This commit is contained in:
parent
4c163bfab0
commit
0ca7bbe89f
|
|
@ -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" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue