private static PowerVmOpResponse checkPowerVmOpResponse(PowerVmOpResponse powerVmOpResponse) throws RpcException {
  logger.info("Checking {}",powerVmOpResponse);
switch (powerVmOpResponse.getResult()) {
case OK:
    break;
case INVALID_VM_POWER_STATE:
  throw new InvalidVmPowerStateException(powerVmOpResponse.getError());
case SYSTEM_ERROR:
throw new SystemErrorException(powerVmOpResponse.getError());
case VM_NOT_FOUND:
throw new VmNotFoundException(powerVmOpResponse.getError());
default :
throw new RpcException(String.format("Unknown result: %s",powerVmOpResponse.getResult()));
}
return powerVmOpResponse;
}

private static PowerVmOpResponse checkPowerVmOpResponse ( PowerVmOpResponse powerVmOpResponse ) throws RpcException { logger . info ( "Checking {}" , powerVmOpResponse ) ; switch ( powerVmOpResponse . getResult ( ) ) { case OK : break ; case INVALID_VM_POWER_STATE : throw new InvalidVmPowerStateException ( powerVmOpResponse . getError ( ) ) ; case SYSTEM_ERROR : throw new SystemErrorException ( powerVmOpResponse . getError ( ) ) ; case VM_NOT_FOUND : throw new VmNotFoundException ( powerVmOpResponse . getError ( ) ) ; default : throw new RpcException ( String . format ( "Unknown result: %s" , powerVmOpResponse . getResult ( ) ) ) ; } return powerVmOpResponse ; }
this method validates a powervmopresponse object , raising an exception if the response reflects an operation failure .
