IDEMPIERE-4533 Problem when changing a plugin from AdempiereActivator to Incremental2PackActivator (#362)

This commit is contained in:
Carlos Ruiz 2020-11-09 07:20:37 +01:00 committed by GitHub
parent e105ed3385
commit e5a5f1233a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 4 deletions

View File

@ -40,10 +40,22 @@ public class Version implements Comparable<Version> {
String[] thatParts = that.get().split("\\."); String[] thatParts = that.get().split("\\.");
int length = Math.max(thisParts.length, thatParts.length); int length = Math.max(thisParts.length, thatParts.length);
for(int i = 0; i < length; i++) { for(int i = 0; i < length; i++) {
int thisPart = i < thisParts.length ? if (i < thisParts.length && i < thatParts.length && thisParts[i].equals(thatParts[i]))
Integer.parseInt(thisParts[i]) : 0; continue;
int thatPart = i < thatParts.length ? int thisPart;
Integer.parseInt(thatParts[i]) : 0; try {
thisPart = i < thisParts.length ?
Integer.parseInt(thisParts[i]) : 0;
} catch (NumberFormatException e) {
thisPart = -1;
}
int thatPart;
try {
thatPart = i < thatParts.length ?
Integer.parseInt(thatParts[i]) : 0;
} catch (NumberFormatException e) {
thatPart = -2; // above was determined that both parts are different
}
if(thisPart < thatPart) if(thisPart < thatPart)
return -1; return -1;
if(thisPart > thatPart) if(thisPart > thatPart)