Repository: cloudstack Updated Branches: refs/heads/master eb9fba4fe -> e8a54f471
CID-1114606 use of MAX_VALUE and longValue() on Integer Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e8a54f47 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e8a54f47 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e8a54f47 Branch: refs/heads/master Commit: e8a54f471c3c2b8c0dc7bc0105646456ad7c317a Parents: eb9fba4 Author: Daan Hoogland <d...@onecht.net> Authored: Tue Jan 6 16:24:29 2015 +0100 Committer: Daan Hoogland <d...@onecht.net> Committed: Tue Jan 6 16:24:29 2015 +0100 ---------------------------------------------------------------------- .../cloud/configuration/ConfigurationManagerImpl.java | 12 ++++++------ server/src/com/cloud/vm/UserVmManagerImpl.java | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8a54f47/server/src/com/cloud/configuration/ConfigurationManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 3d5214d..d1a0887 100644 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -2020,14 +2020,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } } - if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.intValue() > 2147483647))) { - throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and 2147483647"); + if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.longValue() > Integer.MAX_VALUE))) { + throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and " + Integer.MAX_VALUE); } - if ((cpuSpeed != null) && ((cpuSpeed.intValue() < 0) || (cpuSpeed.intValue() > 2147483647))) { - throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu speed value between 1 and 2147483647"); + if ((cpuSpeed != null) && ((cpuSpeed.intValue() < 0) || (cpuSpeed.longValue() > Integer.MAX_VALUE))) { + throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu speed value between 0 and " + Integer.MAX_VALUE); } - if ((memory != null) && ((memory.intValue() < 32) || (memory.intValue() > 2147483647))) { - throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 32 and 2147483647 MB"); + if ((memory != null) && ((memory.intValue() < 32) || (memory.longValue() > Integer.MAX_VALUE))) { + throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 32 and " + Integer.MAX_VALUE + " MB"); } // check if valid domain http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8a54f47/server/src/com/cloud/vm/UserVmManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 605306e..170c612 100644 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -882,7 +882,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (serviceOffering.getCpu() == null) { String cpuNumber = customParameters.get(UsageEventVO.DynamicParameters.cpuNumber.name()); if ((cpuNumber == null) || (NumbersUtil.parseInt(cpuNumber, -1) <= 0)) { - throw new InvalidParameterValueException("Invalid cpu cores value, specify a value between 1 and 2147483647"); + throw new InvalidParameterValueException("Invalid cpu cores value, specify a value between 1 and " + Integer.MAX_VALUE); } } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuNumber.name())) { throw new InvalidParameterValueException("The cpu cores of this offering id:" + serviceOffering.getId() @@ -892,7 +892,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (serviceOffering.getSpeed() == null) { String cpuSpeed = customParameters.get(UsageEventVO.DynamicParameters.cpuSpeed.name()); if ((cpuSpeed == null) || (NumbersUtil.parseInt(cpuSpeed, -1) <= 0)) { - throw new InvalidParameterValueException("Invalid cpu speed value, specify a value between 1 and 2147483647"); + throw new InvalidParameterValueException("Invalid cpu speed value, specify a value between 1 and " + Integer.MAX_VALUE); } } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuSpeed.name())) { throw new InvalidParameterValueException("The cpu speed of this offering id:" + serviceOffering.getId() @@ -902,7 +902,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (serviceOffering.getRamSize() == null) { String memory = customParameters.get(UsageEventVO.DynamicParameters.memory.name()); if (memory == null || (NumbersUtil.parseInt(memory, -1) < 32)) { - throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and 2147483647 MB"); + throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and " + Integer.MAX_VALUE + " MB"); } } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.memory.name())) { throw new InvalidParameterValueException("The memory of this offering id:" + serviceOffering.getId() + " is not customizable. This is predefined in the template.");