[EC2 Query API] AuthorizeSecurityGroupIngress fails with 'Server.InternalError 431 Invalid protocol' error.

https://reviews.apache.org/r/8468

Before making the AuthorizeSecurityGroupIngress CloudStack API call, parse the string arguments 'FromPort' and 'ToPort' as an integer.
This commit is contained in:
Likitha Shetty 2013-01-31 11:29:40 -08:00 committed by Prachi Damle
parent bea669d091
commit b514735c7b
1 changed files with 5 additions and 3 deletions

View File

@ -762,11 +762,13 @@ public class EC2RestServlet extends HttpServlet {
else break;
String[] fromPort = request.getParameterValues( "IpPermissions." + nCount + ".FromPort" );
if (null != fromPort && 0 < fromPort.length) perm.setProtocol( fromPort[0] );
if ( null != fromPort && 0 < fromPort.length)
perm.setFromPort( Integer.parseInt( fromPort[0]));
String[] toPort = request.getParameterValues( "IpPermissions." + nCount + ".ToPort" );
if (null != toPort && 0 < toPort.length) perm.setProtocol( toPort[0] );
if ( null != toPort && 0 < toPort.length)
perm.setToPort( Integer.parseInt( toPort[0]));
// -> list: IpPermissions.n.IpRanges.m.CidrIp
int mCount = 1;
do