13
0
geforkt von Mirrors/Paper

Fix stacktrace deobf when running as a bundler jar

Dieser Commit ist enthalten in:
Kyle Wood 2021-11-26 00:33:08 -06:00
Ursprung 9809c9e47b
Commit 6e9e17aec1

Datei anzeigen

@ -326,6 +326,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import it.unimi.dsi.fastutil.ints.IntArrayList;
+import it.unimi.dsi.fastutil.ints.IntList;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
@ -465,7 +466,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ };
+ try {
+ final ClassReader reader = new ClassReader(key.getName());
+ final @Nullable InputStream inputStream = StacktraceDeobfuscator.class.getClassLoader()
+ .getResourceAsStream(key.getName().replace('.', '/') + ".class");
+ if (inputStream == null) {
+ throw new IllegalStateException("Could not find class file: " + key.getName());
+ }
+ final byte[] classData;
+ try (inputStream) {
+ classData = inputStream.readAllBytes();
+ }
+ final ClassReader reader = new ClassReader(classData);
+ reader.accept(classVisitor, 0);
+ } catch (final IOException ex) {
+ throw new RuntimeException(ex);