From 7f3924a7cbc26828bbd92b0d14ccce61c84eaf11 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Tue, 5 Mar 2019 21:06:14 +0100 Subject: [PATCH] fix version check --- .../info/nightscout/androidaps/utils/VersionChecker.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/utils/VersionChecker.java b/app/src/main/java/info/nightscout/androidaps/utils/VersionChecker.java index ea5c15cbec..fd636b4596 100644 --- a/app/src/main/java/info/nightscout/androidaps/utils/VersionChecker.java +++ b/app/src/main/java/info/nightscout/androidaps/utils/VersionChecker.java @@ -43,7 +43,6 @@ public class VersionChecker { if (inputStream != null) { String result = findLine(inputStream); if (result != null) { - result = result.replace("version", "").replace("\"", "").replace("\\s+", "").trim(); int compare = result.compareTo(BuildConfig.VERSION_NAME.replace("\"", "")); if (compare == 0) { log.debug("Version equal to master"); @@ -75,14 +74,14 @@ public class VersionChecker { private static String findLine(InputStream inputStream) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String line; - String regex = "(.*)version(.*)\"(\\d+)\\.(\\d+)\"(.*)"; + String regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)"; Pattern p = Pattern.compile(regex); while ((line = bufferedReader.readLine()) != null) { Matcher m = p.matcher(line); if (m.matches()) { log.debug("+++ " + line); - return line; + return m.group(3); } else { log.debug("--- " + line); }