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