diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2013-06-26 09:12:47 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2013-06-26 09:12:47 +0200 |
commit | d1f00d91748c776b3b360221cc667e5d49dbb1a6 (patch) | |
tree | 84cd5d79a6273456951757f805cf489dc749bee4 | |
parent | 3ea6e19520c54014af84ebd4947a840dd1408fbf (diff) | |
download | sonar-scanner-cli-d1f00d91748c776b3b360221cc667e5d49dbb1a6.tar.gz sonar-scanner-cli-d1f00d91748c776b3b360221cc667e5d49dbb1a6.zip |
Fix version comparison to make it work with SNAPSHOT and RC
-rw-r--r-- | sonar-runner-batch/src/main/java/org/sonar/runner/batch/VersionUtils.java | 2 | ||||
-rw-r--r-- | sonar-runner-batch/src/test/java/org/sonar/runner/batch/VersionUtilsTest.java | 1 |
2 files changed, 2 insertions, 1 deletions
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(); } |