From: Julien HENRY Date: Wed, 26 Jun 2013 07:12:47 +0000 (+0200) Subject: Fix version comparison to make it work with SNAPSHOT and RC X-Git-Tag: 2.5-rc1~122 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d1f00d91748c776b3b360221cc667e5d49dbb1a6;p=sonar-scanner-cli.git Fix version comparison to make it work with SNAPSHOT and RC --- diff --git a/sonar-runner-batch/src/main/java/org/sonar/runner/batch/VersionUtils.java b/sonar-runner-batch/src/main/java/org/sonar/runner/batch/VersionUtils.java index e26e918..01ba896 100644 --- a/sonar-runner-batch/src/main/java/org/sonar/runner/batch/VersionUtils.java +++ b/sonar-runner-batch/src/main/java/org/sonar/runner/batch/VersionUtils.java @@ -37,6 +37,6 @@ class VersionUtils { } private static boolean isVersion(String version, String prefix) { - return version.startsWith(prefix + ".") || version.equals(prefix); + return version.startsWith(prefix) || version.equals(prefix); } } diff --git a/sonar-runner-batch/src/test/java/org/sonar/runner/batch/VersionUtilsTest.java b/sonar-runner-batch/src/test/java/org/sonar/runner/batch/VersionUtilsTest.java index 3838311..3d02317 100644 --- a/sonar-runner-batch/src/test/java/org/sonar/runner/batch/VersionUtilsTest.java +++ b/sonar-runner-batch/src/test/java/org/sonar/runner/batch/VersionUtilsTest.java @@ -31,6 +31,7 @@ public class VersionUtilsTest { assertThat(VersionUtils.isLessThan37("3.0")).isTrue(); assertThat(VersionUtils.isLessThan37("3.0.1")).isTrue(); assertThat(VersionUtils.isLessThan37("3.6")).isTrue(); + assertThat(VersionUtils.isLessThan37("3.6-SNAPSHOT")).isTrue(); assertThat(VersionUtils.isLessThan37("3.7")).isFalse(); assertThat(VersionUtils.isLessThan37("4.0")).isFalse(); }