WorldEdit

WorldEdit

43M Downloads

An unexpected error while handling a WorldEdit command java.lang.reflect.InvocationTargetException

LadyCailinBot opened this issue ยท 4 comments

commented

WORLDEDIT-3364 - Reported by Bronner

[16:55:22] [Client thread/INFO]: [CHAT] Please report this error: [See console]
[16:55:22] [Client thread/INFO]: [CHAT] java.lang.reflect.InvocationTargetException: null

[16:55:22 INFO]: brthr issued server command: /remove blabla 123
[16:55:22 ERROR]: [WorldEdit] An unexpected error while handling a WorldEdit command
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
        at com.sk89q.worldedit.util.command.parametric.ParametricCallable.call(ParametricCallable.java:243) ~[worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar:?]
        at com.sk89q.worldedit.util.command.SimpleDispatcher.call(SimpleDispatcher.java:125) ~[worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar:?]
        at com.sk89q.worldedit.extension.platform.CommandManager.handleCommand(CommandManager.java:225) [worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_60]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_60]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_60]
        at com.sk89q.worldedit.util.eventbus.MethodEventHandler.dispatch(MethodEventHandler.java:58) [worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar:?]
        at com.sk89q.worldedit.util.eventbus.EventHandler.handleEvent(EventHandler.java:73) [worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar:?]
        at com.sk89q.worldedit.util.eventbus.EventBus.dispatch(EventBus.java:187) [worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar:?]
        at com.sk89q.worldedit.util.eventbus.EventBus.post(EventBus.java:173) [worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar:?]
        at com.sk89q.worldedit.bukkit.WorldEditPlugin.onCommand(WorldEditPlugin.java:242) [worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar:?]
        at com.sk89q.bukkit.util.DynamicPluginCommand.execute(DynamicPluginCommand.java:54) [worldedit-bukkit-6.1.1-SNAPSHOT-dist.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at org.bukkit.craftbukkit.v1_7_R4.CraftServer.dispatchCommand(CraftServer.java:740) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.PlayerConnection.handleCommand(PlayerConnection.java:957) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:818) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:47) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:157) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.ServerConnection.c(SourceFile:134) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:667) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:258) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:558) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:469) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
        at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [craftbukkit-devBuild3116.jar:git-Bukkit-1.7.9-R0.2-24-g07d4558-b3116jnks]
Caused by: com.sk89q.minecraft.util.commands.CommandException: Acceptable types: projectiles, items, paintings, itemframes, boats, minecarts, tnt, xp, or all
        at com.sk89q.worldedit.command.util.EntityRemover.fromString(EntityRemover.java:137) ~[?:?]
        at com.sk89q.worldedit.command.UtilityCommands.remove(UtilityCommands.java:468) ~[?:?]
        ... 30 more

This error may happen with any command that throws CommandException. Not happen if the error instance of WorldEditException

For example if you'll create an empty command that just throws CommandException with some message
instead of showing cause message from this exception to player it will throw this exception to the console.

All WorldEdit 6.0+ versions

My temporary fix is in here com/sk89q/worldedit/util/command/parametric/ParametricCallable.java:258

        } catch (InvocationTargetException e) {
+           if (e.getCause() instanceof CommandException) {
+               throw (CommandException) e.getCause();
+           }
            for (ExceptionConverter converter : builder.getExceptionConverters()) {
                converter.convert(e.getCause());
            }
            throw new WrappedCommandException(e);
        } catch (IllegalArgumentException e) {
commented

Comment by wizjany

what version are you using? as per the linked issue, this was fixed 30 some builds ago.

commented

Comment by Bronner

@wizjany any versions from WE6.0 beta 1 to WE6.1.1#3399-b19cd9be. In fact, this is not the same problem but a little related to it

commented

Comment by Bronner

@wizjany The problem in linked issue was that /remove drops 25 - a valid command, throws an exception. My problem is that /remove blabla 123 - not a valid entity type, throws CommandException that can't be caught properly

commented

Comment by wizjany

got it, I think i know what's wrong