Douglas Schilling Landgraf has posted comments on this change. Change subject: core: Adding RpmVersion utils ......................................................................
Patch Set 7: (3 comments) .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/RpmVersionUtils.java Line 16: * 0 - if two parts are equals Line 17: * 1 - if the 1st argument is bigger than the 2nd Line 18: * -1 - if the 1st argument is smaller than the 2nd Line 19: */ Line 20: public static int compareRpmPart(String part1, String part2) { Hi Yair, Let's say the values arrived here as: part1 = 20130212.0.fc18 part2 = 20130212.fc18 From: ISO has: ovirt-node-iso-2.6.0-20130212.0.fc18.iso Host has: oVirt Node 2.6.0 20130212.fc18 ISO has revision build higher then host and it will drop into else statement. My comment continue on else. Line 21: String[] comps1 = part1.split("\\."); Line 22: String[] comps2 = part2.split("\\."); Line 23: int i = 0; Line 24: while (i < comps1.length && i < comps2.length && comps1[i].equals(comps2[i])) { Line 36: else { Line 37: try Line 38: { Line 39: Long result1 = Long.parseLong(comps1[i]); Line 40: Long result2 = Long.parseLong(comps2[i]); it parses to: comps1[0] = 20130212 comps1[1] = 0 comps1[2] = fc18 comps2[0] = 20130212 comps2[1] = fc18 Line 41: return result1.compareTo(result2); Line 42: } catch (NumberFormatException ex) { Line 43: return comps1[i].compareTo(comps2[i]); Line 44: } Line 38: { Line 39: Long result1 = Long.parseLong(comps1[i]); Line 40: Long result2 = Long.parseLong(comps2[i]); Line 41: return result1.compareTo(result2); Line 42: } catch (NumberFormatException ex) { When comparing (comps1[1]) 0 to (comps2[1]) fc18 it retuns negative value. So users won't receive the alert for cases like that. Please correct me if I am wrong. Line 43: return comps1[i].compareTo(comps2[i]); Line 44: } Line 45: } Line 46: } -- To view, visit http://gerrit.ovirt.org/18370 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia82d09e755b767f254224c84abd16516592715ac Gerrit-PatchSet: 7 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Douglas Schilling Landgraf <dougsl...@redhat.com> Gerrit-Reviewer: Vojtech Szocs <vsz...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches