Skip to content

Commit

Permalink
Fixed bug when parsing license key
Browse files Browse the repository at this point in the history
  • Loading branch information
skavanagh committed Apr 9, 2019
1 parent 9bdd49c commit b958a4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.bastillion</groupId>
<artifactId>bastillion</artifactId>
<version>3.06.00</version>
<version>3.06.01</version>
<packaging>war</packaging>
<name>Bastillion</name>
<properties>
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/io/bastillion/manage/util/LicenseUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public static boolean isValid(String license) {
String str = EncryptionUtil.decrypt(k, license);
if (StringUtils.isNotEmpty(str) && str.contains("@") && str.contains("-")) {
try {
Date expirationDt = sdf.parse(str.split("-")[1]);
int index = str.lastIndexOf("-");
Date expirationDt = sdf.parse(str.substring(index + 1));
if (expirationDt.before(Calendar.getInstance().getTime())) {
return false;
}
Expand All @@ -65,8 +66,9 @@ public static String getExpirationDt(String license) {
String str = EncryptionUtil.decrypt(k, license);
if (StringUtils.isNotEmpty(str) && str.contains("@") && str.contains("-")) {
try {
sdf.parse(str.split("-")[1]);
return str.split("-")[1];
int index = str.lastIndexOf("-");
sdf.parse(str.substring(index + 1));
return str.substring(index + 1);
} catch (ParseException ex) {
}
}
Expand Down

0 comments on commit b958a4a

Please sign in to comment.