Add plugin details to zip file errors (#12580)

Helps debug classloading across plugin boundaries. Zip file errors
can be thrown for multiple reasons, and they are capable of
affecting other plugins' classloading.
This commit is contained in:
A248 🇵🇸🇪🇭
2025-05-24 14:18:41 -05:00
committed by GitHub
parent a3909f5486
commit 7774243d11

View File

@@ -206,7 +206,16 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
if (result == null) {
String path = name.replace('.', '/').concat(".class");
JarEntry entry = jar.getJarEntry(path);
// Add details to zip file errors - help debug classloading
JarEntry entry;
try {
entry = jar.getJarEntry(path);
} catch (IllegalStateException zipFileClosed) {
if (plugin == null) {
throw zipFileClosed;
}
throw new IllegalStateException("The plugin classloader for " + plugin.getName() + " has thrown a zip file error.", zipFileClosed);
}
if (entry != null) {
byte[] classBytes;