From 5b4a0d8e4b7f813d6d6ccc52f6479dd663bf91bc Mon Sep 17 00:00:00 2001 From: mikaelpeltier Date: Thu, 25 Jun 2015 16:02:25 +0200 Subject: Update version comparison - versions with 0 in release and sub-release code are not comparables. - versions with engineering kind are not comparables Change-Id: Id8169577ba2c8e4392f2dcfc8a5fb5157c3758d9 (cherry picked from commit dd5c19eefff3487aac2000e4cfdcf4f02e1fe879) --- sched/src/com/android/sched/util/Version.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sched/src/com/android/sched/util/Version.java b/sched/src/com/android/sched/util/Version.java index c1b7746..3128edd 100644 --- a/sched/src/com/android/sched/util/Version.java +++ b/sched/src/com/android/sched/util/Version.java @@ -202,14 +202,12 @@ public class Version { } int compareTo(@Nonnull Version other) throws UncomparableVersion { - if ((subReleaseKind == SubReleaseKind.ENGINEERING - && other.getSubReleaseKind() != SubReleaseKind.ENGINEERING) - || releaseCode < 0 - || subReleaseCode < 0 - || (subReleaseKind != SubReleaseKind.ENGINEERING - && other.getSubReleaseKind() == SubReleaseKind.ENGINEERING) - || other.getReleaseCode() < 0 - || other.getSubReleaseCode() < 0) { + if (subReleaseKind == SubReleaseKind.ENGINEERING + || releaseCode <= 0 + || subReleaseCode <= 0 + || other.getSubReleaseKind() == SubReleaseKind.ENGINEERING + || other.getReleaseCode() <= 0 + || other.getSubReleaseCode() <= 0) { throw new UncomparableVersion( getVerboseVersion() + " is not comparable with " + other.getVerboseVersion()); } -- cgit v1.1