compatible with 2024.1

This commit is contained in:
novice.li 2024-04-07 22:20:24 +08:00
parent 8f3f4fc44f
commit 2c4c8fafa4
1 changed files with 3 additions and 1 deletions

View File

@ -3,14 +3,16 @@ package com.novitechie.jetbra;
import net.bytebuddy.asm.Advice; import net.bytebuddy.asm.Advice;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.regex.Pattern;
public class VMOptionsAdvice { public class VMOptionsAdvice {
@Advice.OnMethodExit @Advice.OnMethodExit
public static void intercept(@Advice.Return(readOnly = false) Path r) throws Exception { public static void intercept(@Advice.Return(readOnly = false) Path r) throws Exception {
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()){
r = null; r = null;
break; break;
} }