From 0d28f563f4f17a875d9df852f3b33c1fac6b9137 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 14 Sep 2016 16:24:32 +0200 Subject: [PATCH] fix for java version "9-ea" --- source/net/yacy/yacy.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java index 44803ec6e..62619a9e9 100644 --- a/source/net/yacy/yacy.java +++ b/source/net/yacy/yacy.java @@ -153,9 +153,10 @@ public final class yacy { final String javaVersion = System.getProperty("java.version"); if (javaVersion != null) { // unknown property !? int pos = javaVersion.indexOf('.'); + if (pos < 0) pos = javaVersion.indexOf('-'); // i.e. "9-ea" int count = 1; - for (; pos < javaVersion.length() && count < 2; pos++) { - if (javaVersion.charAt(pos + 1) == '.') count++; + for (; pos >= 0 && pos < javaVersion.length() && count < 2; pos++) { + if (javaVersion.charAt(pos + 1) == '.' || javaVersion.charAt(pos + 1) == '-') count++; } Double dVersion = Double.parseDouble(javaVersion.substring(0, pos)); if (dVersion < 1.7) { // required min java 1.7