Skip to content

Commit

Permalink
fix the bug that non numeric version number will cause crash
Browse files Browse the repository at this point in the history
  • Loading branch information
kezong committed Jun 8, 2020
1 parent 4f16a30 commit ad38dcc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/src/main/groovy/com/kezong/fataar/Utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ class Utils {
if (v1.equals(v2)) {
return 0
}
String[] version1Array = v1.split("[._]")
String[] version2Array = v2.split("[._]")

String[] version1 = v1.split("-")
String[] version2 = v2.split("-")
String[] version1Array = version1[0].split("[._]")
String[] version2Array = version2[0].split("[._]")

int index = 0
int minLen = Math.min(version1Array.length, version2Array.length)
long diff = 0
Expand Down

0 comments on commit ad38dcc

Please sign in to comment.