replaced Integer reference comparsion with .equals By default only the Integers between -128..127 are cached (unless overridden by java.lang.Integer.IntegerCache.high system property) If the inbound or outbound values are higher, the reference comparison won't work.
Signed-off-by: Laszlo Hornyak <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d22b65f4 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d22b65f4 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d22b65f4 Branch: refs/heads/master Commit: d22b65f45f416e2da014f655a7e562cae2a5994a Parents: 3e3ded7 Author: Laszlo Hornyak <[email protected]> Authored: Sun Feb 9 18:39:03 2014 +0100 Committer: Laszlo Hornyak <[email protected]> Committed: Sun Feb 9 18:39:03 2014 +0100 ---------------------------------------------------------------------- .../com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d22b65f4/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java index 9fb63ce..9cf6a90 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java @@ -145,8 +145,9 @@ public class LibvirtDomainXMLParser { if ((bandwidth != null) && (bandwidth.getLength() != 0)) { Integer inbound = Integer.valueOf(getAttrValue("inbound", "average", (Element)bandwidth.item(0))); Integer outbound = Integer.valueOf(getAttrValue("outbound", "average", (Element)bandwidth.item(0))); - if (inbound == outbound) + if (inbound.equals(outbound)) { networkRateKBps = inbound; + } } if (type.equalsIgnoreCase("network")) { String network = getAttrValue("source", "network", nic);
