Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure proper messaging when a classreader attempts to visit either a corrupted class file, or a class file compiled on different version than current asm supports #417

Merged
merged 1 commit into from Aug 16, 2019

Conversation

@NeumimTo
Copy link
Contributor

commented Aug 9, 2019

When Sponge scans mod folder to find plugin candidates and it encounters a corrupted .class file, or a class file compiled with java, which currently used ASM does not support the entire sponge process would exit wihout any meaningful message

[12:54:20] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepowered.server.launch.VanillaServerTweaker
[12:54:20] [main/INFO] [LaunchWrapper]: Using primary tweak class name org.spongepowered.server.launch.VanillaServerTweaker
[12:54:20] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.server.launch.VanillaServerTweaker
[12:54:20] [main/INFO] [Sponge]: Initializing Sponge...
[12:54:20] [main/DEBUG] [Sponge]: Applying runtime de-obfuscation...
[12:54:20] [main/INFO] [Sponge]: De-obfuscation mappings are provided by MCP (http://www.modcoderpack.com)
[12:54:21] [main/DEBUG] [Sponge]: Registering access transformers...
[12:54:21] [main/DEBUG] [Sponge]: Initializing Mixin environment...
[12:54:21] [main/DEBUG] [mixin]: MixinService [LaunchWrapper] was successfully booted in sun.misc.Launcher$AppClassLoader@18b4aac2
[12:54:21] [main/INFO] [mixin]: SpongePowered MIXIN Subsystem Version=0.7.11 Source=file:/S:/server/spongevanilla-1.12.2-7.1.6.jar Service=LaunchWrapper Env=UNKNOWN
[12:54:21] [main/DEBUG] [mixin]: Adding new mixin transformer proxy #1
[12:54:21] [main/DEBUG] [mixin]: Initialising Mixin Platform Manager
[12:54:21] [main/DEBUG] [mixin]: Mixin platform: primary container is file:/S:/server/spongevanilla-1.12.2-7.1.6.jar
[12:54:21] [main/DEBUG] [mixin]: Adding mixin platform agents for container file:/S:/server/spongevanilla-1.12.2-7.1.6.jar
[12:54:21] [main/DEBUG] [mixin]: Instancing new MixinPlatformAgentFML for file:/S:/server/spongevanilla-1.12.2-7.1.6.jar
[12:54:21] [main/INFO] [mixin]: FML platform manager could not load class cpw.mods.fml.relauncher.CoreModManager. Proceeding without FML support.
[12:54:21] [main/DEBUG] [mixin]: Instancing new MixinPlatformAgentDefault for file:/S:/server/spongevanilla-1.12.2-7.1.6.jar
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/access-bridge-64.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/cldrdata.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/dnsns.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/jaccess.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/localedata.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/nashorn.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/sunec.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/sunjce_provider.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/sunmscapi.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/sunpkcs11.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Scanning file:/S:/java/java-8/jre/lib/ext/zipfs.jar for mixin tweaker
[12:54:21] [main/DEBUG] [mixin]: Processing prepare() for PlatformAgent[MixinPlatformAgentFML:file:/S:/server/spongevanilla-1.12.2-7.1.6.jar]
[12:54:21] [main/DEBUG] [mixin]: Processing prepare() for PlatformAgent[MixinPlatformAgentDefault:file:/S:/server/spongevanilla-1.12.2-7.1.6.jar]
[12:54:21] [main/INFO] [mixin]: Compatibility level set to JAVA_8
[12:54:21] [main/DEBUG] [Sponge]: Searching for plugins...
[12:54:21] [main/INFO] [Sponge]: Searching for plugins...
[12:54:21] [main/ERROR] [LaunchWrapper]: Unable to launch
java.lang.IllegalArgumentException: null
	at org.objectweb.asm.ClassReader.<init>(Unknown Source) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at org.objectweb.asm.ClassReader.<init>(Unknown Source) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at org.objectweb.asm.ClassReader.<init>(Unknown Source) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at org.spongepowered.server.launch.plugin.PluginScanner.scanClassFile(PluginScanner.java:341) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at org.spongepowered.server.launch.plugin.PluginScanner.scanJar(PluginScanner.java:245) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at org.spongepowered.server.launch.plugin.PluginScanner.scanDirectory(PluginScanner.java:173) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at org.spongepowered.server.launch.plugin.VanillaLaunchPluginManager.findPlugins(VanillaLaunchPluginManager.java:66) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at org.spongepowered.server.launch.VanillaServerTweaker.searchPlugins(VanillaServerTweaker.java:172) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at org.spongepowered.server.launch.VanillaServerTweaker.injectIntoClassLoader(VanillaServerTweaker.java:94) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:115) ~[launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) ~[launchwrapper-1.12.jar:?]
	at org.spongepowered.server.launch.VanillaServerMain.main(VanillaServerMain.java:126) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]
	at org.spongepowered.server.launch.VersionCheckingMain.main(VersionCheckingMain.java:38) ~[spongevanilla-1.12.2-7.1.6.jar:1.12.2-7.1.6]

With java jingsaw modules slowly becoming more and more popular plugin developers might encerter this error, when would they attempt to shadow a jar library compiled on java 8, but with support of jingsaw modules.

The such JAR file contains classes under the META-INF directory. For example:
META-INF\versions\9***class

Classes which use Java 9 features are placed under META-INF\versions\9 as a way to provide
backward compatibility.

This patch will fix two errors:
1] denies sponge to search plugin candidates in a META-INF/ folder.
2] If there is a corrupted class file within the jar being scanned it throws an exception, which tells the user which .jar file could not be loaded

Ensure proper messaging when a classreader attempts to visit either a…
… corrupted class file, or a class file compiled on different version than current asm supports

@NeumimTo NeumimTo requested a review from Minecrell as a code owner Aug 9, 2019

@parlough parlough merged commit e0e033c into SpongePowered:stable-7 Aug 16, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.