Skip to content

Commit 9631df8

Browse files
committed
Fix CID 1127021 Operands don't affect results
int can never be bigger than maxint. Auto unboxing of Integer, not need for intValue()
1 parent f611c24 commit 9631df8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎server/src/com/cloud/vm/UserVmManagerImpl.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,19 +2739,19 @@ protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOf
27392739
if (offering.isDynamic()) {
27402740
//insert the custom value of dynamic parameters
27412741
if (offering.getCpu() == null) {
2742-
if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.intValue() > 2147483647))) {
2742+
if ((cpuNumber != null) && (cpuNumber <= 0)) {
27432743
throw new InvalidParameterValueException("Invalid CPU number value, specify a value between 1 and 2147483647");
27442744
}
27452745
}
27462746

27472747
if (offering.getSpeed() == null) {
2748-
if ((cpuSpeed != null) && ((cpuSpeed.intValue() <= 0) || (cpuSpeed.intValue() > 2147483647))) {
2748+
if ((cpuSpeed != null) && (cpuSpeed <= 0)) {
27492749
throw new InvalidParameterValueException("Invalid CPU speed value, specify a value between 1 and 2147483647");
27502750
}
27512751
}
27522752

27532753
if (offering.getRamSize() == null) {
2754-
if ((memory != null) && ((memory.intValue() < 32) || (memory.intValue() > 2147483647))) {
2754+
if ((memory != null) && (memory < 32)) {
27552755
throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and 2147483647 MB");
27562756
}
27572757
}

0 commit comments

Comments
 (0)