Compatible with 2024.1
This commit is contained in:
parent
2c4c8fafa4
commit
a7858ac83f
|
@ -4,16 +4,18 @@ import net.bytebuddy.asm.Advice;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class LicensingFacadeAdvice {
|
public class LicensingFacadeAdvice {
|
||||||
|
|
||||||
@Advice.OnMethodExit
|
@Advice.OnMethodExit
|
||||||
public static void intercept(@Advice.Return(readOnly = false) Date expirationDate) {
|
public static void intercept(@Advice.Return(readOnly = false) Date expirationDate) {
|
||||||
RuntimeException e = new RuntimeException();
|
RuntimeException e = new RuntimeException();
|
||||||
|
Pattern pattern = Pattern.compile("\\A\\p{ASCII}*\\z");
|
||||||
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
|
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
|
||||||
if (stackTraceElement.getFileName() == null){
|
if (!pattern.matcher(stackTraceElement.getMethodName()).matches()){
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, 50);
|
calendar.add(Calendar.DAY_OF_MONTH, 180);
|
||||||
expirationDate = calendar.getTime();
|
expirationDate = calendar.getTime();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue