Tomas Jelinek has uploaded a new change for review.

Change subject: engine: Time zones not ordered well (#850696)
......................................................................

engine: Time zones not ordered well (#850696)

https://bugzilla.redhat.com/850696

WebAdmin -> Virtual Machines tab -> new server/desktop ->
Initial Run -> Time Zone
The content of this check box is not ordered well if the
selected VM operating system is windows.

The problem was in GetTimeZonesQuery which had the
TimeZoneTimeExtractComperator not correctly implemented:
The compare method returned only 0 and 1, but never -1,
even when the second arg was smaller than the first one.

This worked in JDK6, but the JDK7's Collections.sort()
checks if the comparator is implemented correctly, and
if not, it does not sort the list at all.

Fixed by fixing the compare method to work according to
the contract.

Change-Id: Iecae3f868d6b3bc6663459367d1bd424b920a3fb
Signed-off-by: Tomas Jelinek <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetTimeZonesQuery.java
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/17/7417/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetTimeZonesQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetTimeZonesQuery.java
index 0c287dc..6fe8b10 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetTimeZonesQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetTimeZonesQuery.java
@@ -116,7 +116,12 @@
             if (match2.matches() && match2.groupCount() > 0) {
                 b = Integer.parseInt(match2.group(1).substring(3).replace(":", 
"").replace("+", ""));
             }
-            return (a > b) ? 1 : 0;
+
+            if (a == b) {
+                return 0;
+            }
+
+            return (a > b) ? 1 : -1;
         }
     }
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecae3f868d6b3bc6663459367d1bd424b920a3fb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to