aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-06-26 09:12:47 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-06-26 09:12:47 +0200
commitd1f00d91748c776b3b360221cc667e5d49dbb1a6 (patch)
tree84cd5d79a6273456951757f805cf489dc749bee4
parent3ea6e19520c54014af84ebd4947a840dd1408fbf (diff)
downloadsonar-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.java2
-rw-r--r--sonar-runner-batch/src/test/java/org/sonar/runner/batch/VersionUtilsTest.java1
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();
}