bug 12175 : perform data validation before queuing/executing command

This commit is contained in:
Kelven Yang 2011-11-28 11:28:28 -08:00
parent 4f7eb448e0
commit be87e3214e
1 changed files with 6 additions and 1 deletions

View File

@ -27,6 +27,7 @@ import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.RemoteAccessVpn;
@ -63,7 +64,11 @@ public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd {
@Override
public long getEntityOwnerId() {
if (ownerId == null) {
ownerId = _entityMgr.findById(RemoteAccessVpn.class, publicIpId).getAccountId();
RemoteAccessVpn vpnEntity = _entityMgr.findById(RemoteAccessVpn.class, publicIpId);
if(vpnEntity != null)
return vpnEntity.getAccountId();
throw new InvalidParameterValueException("The specified public ip is not allocated to any account");
}
return ownerId;
}