Change in ovirt-engine[master]: findbugs: use Math.abs for more accurate floating point comp...

shavivi at redhat.com shavivi at redhat.com
Wed May 29 11:58:33 UTC 2013


Hello ovirt-engine-commits,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/15157

to review the following change.

Change subject: findbugs: use Math.abs for more accurate floating point comparison
......................................................................

findbugs: use Math.abs for more accurate floating point comparison

findbugs reason:findbugs reason:findbugs
FE: Test for floating point equality (FE_FLOATING_POINT_EQUALITY)

Change-Id: I6ce08ed47a51db05b61b56ea6facf3e9a7d33645
Signed-off-by: Shahar Havivi <shavivi at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelInputWithSlider.java
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/15157/1

diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
index 493ed38..ee161a7 100644
--- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
+++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
@@ -985,7 +985,7 @@
                     if (QuotaStorage.UNLIMITED.equals(quotaStorage.getStorageSizeGB())) {
                         storageLimit = QuotaStorage.UNLIMITED; // Do not break because usage is still counting
                     }
-                    if (storageLimit != QuotaStorage.UNLIMITED) {
+                    if (Math.abs(storageLimit) != QuotaStorage.UNLIMITED) {
                         storageLimit += quotaStorage.getStorageSizeGB();
                     }
                     storageUsage += quotaStorage.getStorageSizeGBUsage();
diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelInputWithSlider.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelInputWithSlider.java
index e130cc2..37c55a4 100644
--- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelInputWithSlider.java
+++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/EntityModelInputWithSlider.java
@@ -198,7 +198,7 @@
 
                     // checks if it is an enabled value
                     for (double i = slider.getMinValue(); i <= newValue; i += slider.getStepSize()) {
-                        if (i == newValue) {
+                        if (Math.abs(i) == Math.abs(newValue)) {
                             return true;
                         }
                     }


--
To view, visit http://gerrit.ovirt.org/15157
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ce08ed47a51db05b61b56ea6facf3e9a7d33645
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: ovirt-engine-commits <engine-commits at ovirt.org>



More information about the Engine-commits mailing list