From d1f00d91748c776b3b360221cc667e5d49dbb1a6 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 26 Jun 2013 09:12:47 +0200 Subject: [PATCH] Fix version comparison to make it work with SNAPSHOT and RC --- .../src/main/java/org/sonar/runner/batch/VersionUtils.java | 2 +- .../src/test/java/org/sonar/runner/batch/VersionUtilsTest.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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(); } -- 2.39.5