Change in ovirt-engine[master]: core: sorted getJsonDiskDescription()

amureini at redhat.com amureini at redhat.com
Sat Jan 10 19:22:14 UTC 2015


Allon Mureinik has submitted this change and it was merged.

Change subject: core: sorted getJsonDiskDescription()
......................................................................


core: sorted getJsonDiskDescription()

ImagesHandler.getJsonDiskDescription() used a HashMap to serialize a
Disk's Alias and Description. Since the order of iteration of a HashMap
cannot be trusted, it made the method's behavior unpredictable in
different environments, specifically breaking the unit tests on the
default JDK8 supplied with Fedora 21.

This patch replaces the internal implementation from using a HashMap to
use a TreeMap, ensuring the keys are iterated by order, and thus
producing a reliable output:
{"DiskAlias":"some_alias","DiskDescription":"some_description}. The unit
tests have been fixed accordingly, making them agnostic to JDK upgrades.

Change-Id: Ic8496858a2cb5715ab9f84b8ae77f62b3e6097d4
Bug-Url: https://bugzilla.redhat.com/1180522
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java
M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/ImagesHandlerTest.java
2 files changed, 5 insertions(+), 4 deletions(-)

Approvals:
  Tal Nisan: Looks good to me, approved
  Allon Mureinik: Verified



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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic8496858a2cb5715ab9f84b8ae77f62b3e6097d4
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list