From 9631df8d0ec96085b03ba6a324089b9ca41edf0c Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Thu, 7 Nov 2013 13:23:22 +0100 Subject: [PATCH] Fix CID 1127021 Operands don't affect results int can never be bigger than maxint. Auto unboxing of Integer, not need for intValue() --- server/src/com/cloud/vm/UserVmManagerImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 3eaf33a6119..2d537bf5f97 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -2739,19 +2739,19 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (offering.isDynamic()) { //insert the custom value of dynamic parameters if (offering.getCpu() == null) { - if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.intValue() > 2147483647))) { + if ((cpuNumber != null) && (cpuNumber <= 0)) { throw new InvalidParameterValueException("Invalid CPU number value, specify a value between 1 and 2147483647"); } } if (offering.getSpeed() == null) { - if ((cpuSpeed != null) && ((cpuSpeed.intValue() <= 0) || (cpuSpeed.intValue() > 2147483647))) { + if ((cpuSpeed != null) && (cpuSpeed <= 0)) { throw new InvalidParameterValueException("Invalid CPU speed value, specify a value between 1 and 2147483647"); } } if (offering.getRamSize() == null) { - if ((memory != null) && ((memory.intValue() < 32) || (memory.intValue() > 2147483647))) { + if ((memory != null) && (memory < 32)) { throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and 2147483647 MB"); } }