From bbc57469ab28a7d3ae3ada6de5db2a4aced38861 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sun, 5 Nov 2023 17:27:00 -0700 Subject: [PATCH] skip printStackTrace when finding caller --- patches/server/0638-Add-System.out-err-catcher.patch | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/patches/server/0638-Add-System.out-err-catcher.patch b/patches/server/0638-Add-System.out-err-catcher.patch index 75e60dac1a..2ecd775d02 100644 --- a/patches/server/0638-Add-System.out-err-catcher.patch +++ b/patches/server/0638-Add-System.out-err-catcher.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add System.out/err catcher diff --git a/src/main/java/io/papermc/paper/logging/SysoutCatcher.java b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java new file mode 100644 -index 0000000000000000000000000000000000000000..1995639aee39627d2e0cf8ca9c4b4fa38b64da50 +index 0000000000000000000000000000000000000000..64b8bf47162811334a934136d6aaa6c71a0f47ee --- /dev/null +++ b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java -@@ -0,0 +1,227 @@ +@@ -0,0 +1,229 @@ +package io.papermc.paper.logging; + +import java.io.FilterOutputStream; @@ -66,7 +66,9 @@ index 0000000000000000000000000000000000000000..1995639aee39627d2e0cf8ca9c4b4fa3 + final Class clazz = STACK_WALKER.walk(stream -> { + return stream.filter(it -> { + final Class declr = it.getDeclaringClass(); -+ return !declr.equals(WrappedOutStream.class) && !declr.equals(PrintStream.class) && !declr.equals(FilterOutputStream.class); ++ return !declr.equals(WrappedOutStream.class) && !declr.equals(PrintStream.class) ++ && !declr.equals(FilterOutputStream.class) && !declr.getName().equals("java.lang.Throwable$WrappedPrintStream") ++ && !declr.equals(Throwable.class); + }).findFirst() + .map(StackWalker.StackFrame::getDeclaringClass) + .orElseThrow();