Merge pull request #1664 from MilosKozak/AdrianLxM-patch-2
fix version check
This commit is contained in:
commit
39ddde5844
|
@ -43,7 +43,6 @@ public class VersionChecker {
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
String result = findLine(inputStream);
|
String result = findLine(inputStream);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
result = result.replace("version", "").replace("\"", "").replace("\\s+", "").trim();
|
|
||||||
int compare = result.compareTo(BuildConfig.VERSION_NAME.replace("\"", ""));
|
int compare = result.compareTo(BuildConfig.VERSION_NAME.replace("\"", ""));
|
||||||
if (compare == 0) {
|
if (compare == 0) {
|
||||||
log.debug("Version equal to master");
|
log.debug("Version equal to master");
|
||||||
|
@ -75,14 +74,14 @@ public class VersionChecker {
|
||||||
private static String findLine(InputStream inputStream) throws IOException {
|
private static String findLine(InputStream inputStream) throws IOException {
|
||||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
String line;
|
String line;
|
||||||
String regex = "(.*)version(.*)\"(\\d+)\\.(\\d+)\"(.*)";
|
String regex = "(.*)version(.*)\"(((\\d+)\\.)+(\\d+))\"(.*)";
|
||||||
Pattern p = Pattern.compile(regex);
|
Pattern p = Pattern.compile(regex);
|
||||||
|
|
||||||
while ((line = bufferedReader.readLine()) != null) {
|
while ((line = bufferedReader.readLine()) != null) {
|
||||||
Matcher m = p.matcher(line);
|
Matcher m = p.matcher(line);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
log.debug("+++ " + line);
|
log.debug("+++ " + line);
|
||||||
return line;
|
return m.group(3);
|
||||||
} else {
|
} else {
|
||||||
log.debug("--- " + line);
|
log.debug("--- " + line);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue