Skip to content

Commit 8676efa

Browse files
committed
fix: throwable.printStackTrace not removed in debug off mode
1 parent 9acb31b commit 8676efa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

memshell-party-common/src/main/java/com/reajason/javaweb/buddy/LogRemoveMethodVisitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public MethodVisitor wrap(@NotNull TypeDescription instrumentedType,
4747
@Override
4848
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) {
4949
if ((opcode == INVOKEVIRTUAL && owner.equals("java/io/PrintStream") && name.equals("println"))
50-
|| (opcode == INVOKEVIRTUAL && owner.endsWith("Exception") && name.equals("printStackTrace"))
50+
|| (opcode == INVOKEVIRTUAL && owner.endsWith("Exception") && name.equals("printStackTrace") && descriptor.equals("()V"))
51+
|| (opcode == INVOKEVIRTUAL && owner.equals("java/lang/Throwable") && name.equals("printStackTrace") && descriptor.equals("()V"))
5152
|| (opcode == INVOKEVIRTUAL && owner.equals("java/util/logging/Logger") && (name.equals("info") || name.equals("warning")))
5253
) {
5354
String[] args = descriptor.substring(1, descriptor.indexOf(')')).split(";");

0 commit comments

Comments
 (0)