Compatible with 2024.1

This commit is contained in:
novice.li 2024-04-07 22:24:41 +08:00
parent 8be6cfa8ae
commit b0518db532
1 changed files with 5 additions and 2 deletions

View File

@ -2,12 +2,14 @@ package com.novitechie;
import java.util.Calendar;
import java.util.Date;
import java.util.regex.Pattern;
public class StackTraceRule {
public static boolean check() {
RuntimeException e = new RuntimeException();
Pattern pattern = Pattern.compile("\\A\\p{ASCII}*\\z");
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
if (stackTraceElement.getFileName() == null) {
if (!pattern.matcher(stackTraceElement.getMethodName()).matches()) {
return true;
}
}
@ -16,8 +18,9 @@ public class StackTraceRule {
public static Date hook() {
RuntimeException e = new RuntimeException();
Pattern pattern = Pattern.compile("\\A\\p{ASCII}*\\z");
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
if (stackTraceElement.getFileName() == null) {
if (!pattern.matcher(stackTraceElement.getMethodName()).matches()) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, 180);
return calendar.getTime();