3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

skip printStackTrace when finding caller

Dieser Commit ist enthalten in:
Jason Penilla 2023-11-05 17:27:00 -07:00
Ursprung f9e368621d
Commit bbc57469ab
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0E75A301420E48F8

Datei anzeigen

@ -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 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 new file mode 100644
index 0000000000000000000000000000000000000000..1995639aee39627d2e0cf8ca9c4b4fa38b64da50 index 0000000000000000000000000000000000000000..64b8bf47162811334a934136d6aaa6c71a0f47ee
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java +++ b/src/main/java/io/papermc/paper/logging/SysoutCatcher.java
@@ -0,0 +1,227 @@ @@ -0,0 +1,229 @@
+package io.papermc.paper.logging; +package io.papermc.paper.logging;
+ +
+import java.io.FilterOutputStream; +import java.io.FilterOutputStream;
@ -66,7 +66,9 @@ index 0000000000000000000000000000000000000000..1995639aee39627d2e0cf8ca9c4b4fa3
+ final Class<?> clazz = STACK_WALKER.walk(stream -> { + final Class<?> clazz = STACK_WALKER.walk(stream -> {
+ return stream.filter(it -> { + return stream.filter(it -> {
+ final Class<?> declr = it.getDeclaringClass(); + 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() + }).findFirst()
+ .map(StackWalker.StackFrame::getDeclaringClass) + .map(StackWalker.StackFrame::getDeclaringClass)
+ .orElseThrow(); + .orElseThrow();