summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java10
-rw-r--r--BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java20
2 files changed, 28 insertions, 2 deletions
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java
index c33d6f08..2cf5db79 100644
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Configurator.java
@@ -266,7 +266,7 @@ public class Configurator {
int majorEndOld = oldVersion.indexOf("-SNAPSHOT"); // 1.0.10-SNAPSHOT-r438, 1.2.12-pinguin-1-SNAPSHOT-r635
if (majorEndOld < 0) {
preRelease = false;
- majorEndOld = oldVersion.lastIndexOf('-'); // 1.0.10-r439, 1.2.12-pinguin-1-r635
+ majorEndOld = oldVersion.lastIndexOf('-'); // 1.0.10-r439, 1.2.12-pinguin-1-r635, 1.3.0-RC2-r611
if (majorEndOld < 0) {
majorEndOld = oldVersion.length();
}
@@ -282,7 +282,13 @@ public class Configurator {
}
}
- xOld = Integer.valueOf(oldVersion.substring(fromInd, majorEndOld));
+ try {
+ xOld = Integer.valueOf(oldVersion.substring(fromInd, majorEndOld));
+ } catch (NumberFormatException ex) {
+ log.warn("{} seems to be a branch version, do not update", oldVersion);
+ log.debug(ex.getMessage(), ex);
+ return false;
+ }
boolean hasMoreDigitsMin = true;
nextIndMin = minVersion.indexOf('.', fromInd);
if (nextIndMin < 0) {
diff --git a/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java
index 12b17a44..c97197c6 100644
--- a/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java
+++ b/BKUWebStart/src/test/java/at/gv/egiz/bku/webstart/ConfiguratorTest.java
@@ -176,6 +176,26 @@ public class ConfiguratorTest {
result = Configurator.updateRequired(oldVersion, minVersion);
assertEquals(expResult, result);
+ //no update for branch versions
+ oldVersion = "1.2.13-pinguin-1";
+ minVersion = "1.2.14";
+ expResult = false;
+ result = Configurator.updateRequired(oldVersion, minVersion);
+ assertEquals(expResult, result);
+
+ //... but for major version changes
+ oldVersion = "1.2.13-pinguin-1";
+ minVersion = "1.3.0";
+ expResult = true;
+ result = Configurator.updateRequired(oldVersion, minVersion);
+ assertEquals(expResult, result);
+
+ oldVersion = "1.3.0-RC2-r611";
+ minVersion = "1.3.0";
+ expResult = false;
+ result = Configurator.updateRequired(oldVersion, minVersion);
+ assertEquals(expResult, result);
+
oldVersion = "1";
minVersion = "2";
expResult = true;