commit
1493dcf0b8
|
@ -5,11 +5,13 @@ import java.util.Date;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class StackTraceRule {
|
public class StackTraceRule {
|
||||||
|
|
||||||
|
private static final Pattern PACKAGE_NAME_PATTERN = Pattern.compile("\\A\\p{ASCII}*\\z");
|
||||||
|
|
||||||
public static boolean check() {
|
public static boolean check() {
|
||||||
RuntimeException e = new RuntimeException();
|
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||||
Pattern pattern = Pattern.compile("\\A\\p{ASCII}*\\z");
|
for (StackTraceElement stackTraceElement : stackTrace) {
|
||||||
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
|
if (!PACKAGE_NAME_PATTERN.matcher(stackTraceElement.getMethodName()).matches()) {
|
||||||
if (!pattern.matcher(stackTraceElement.getMethodName()).matches()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,10 +19,9 @@ public class StackTraceRule {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date hook() {
|
public static Date hook() {
|
||||||
RuntimeException e = new RuntimeException();
|
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||||
Pattern pattern = Pattern.compile("\\A\\p{ASCII}*\\z");
|
for (StackTraceElement stackTraceElement : stackTrace) {
|
||||||
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
|
if (!PACKAGE_NAME_PATTERN.matcher(stackTraceElement.getMethodName()).matches()) {
|
||||||
if (!pattern.matcher(stackTraceElement.getMethodName()).matches()) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, 180);
|
calendar.add(Calendar.DAY_OF_MONTH, 180);
|
||||||
return calendar.getTime();
|
return calendar.getTime();
|
||||||
|
|
Loading…
Reference in New Issue