CommandHelper

CommandHelper

46.5k Downloads

Stacktraces with color()

LadyCailinBot opened this issue ยท 3 comments

commented

CMDHELPER-2777 - Reported by Hekta

eval(color(''))
on or around E:\Documents\Desktop\afaire\serv\bukkit\RequiCraft\plugins\CommandHelper\LocalPackages\RequiCraft\extensions\Dev\aliases.msa:5.
Please report this error to the developers, and be sure to include the version numbers: Server version: 1.6.2-R0.2-SNAPSHOT; CommandHelper version: 3.3.1-SNAPSHOT:2346-92111b3,master. Here's the stacktrace:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(Unknown Source)
	at com.laytonsmith.core.functions.Echoes$color.exec(Echoes.java:274)
	at com.laytonsmith.core.MethodScriptCompiler.optimize(MethodScriptCompiler.java:1423)
	at com.laytonsmith.core.MethodScriptCompiler.optimize(MethodScriptCompiler.java:1295)
	at com.laytonsmith.core.MethodScriptCompiler.optimize(MethodScriptCompiler.java:1295)
	at com.laytonsmith.core.MethodScriptCompiler.compile(MethodScriptCompiler.java:1171)
	at com.laytonsmith.core.functions.Meta$eval.execs(Meta.java:407)
	at com.laytonsmith.core.Script.eval(Script.java:257)
	at com.laytonsmith.core.Script.eval(Script.java:265)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1489)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
	at com.laytonsmith.core.Script.run(Script.java:165)
	at com.laytonsmith.core.AliasCore.alias(AliasCore.java:140)
	at com.laytonsmith.commandhelper.CommandHelperServerListener.onServerCommand(CommandHelperServerListener.java:41)
	at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
	at net.minecraft.server.v1_6_R2.DedicatedServer.ar(DedicatedServer.java:258)
	at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:227)
	at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486)
	at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419)
	at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)```



```Java2013-08-11 21:19:14 [SEVERE] Uh oh! You've found an error in CommandHelper. This is an error caused by your code, so you may be able to find a workaround, but is ultimately an error in CommandHelper itself. The line of code that caused the error was this:
eval(color(null))
on or around E:\Documents\Desktop\afaire\serv\bukkit\RequiCraft\plugins\CommandHelper\LocalPackages\RequiCraft\extensions\Dev\aliases.msa:5.
Please report this error to the developers, and be sure to include the version numbers: Server version: 1.6.2-R0.2-SNAPSHOT; CommandHelper version: 3.3.1-SNAPSHOT:2346-92111b3,master. Here's the stacktrace:
java.lang.NullPointerException
	at java.util.TreeMap.getEntry(Unknown Source)
	at java.util.TreeMap.containsKey(Unknown Source)
	at com.laytonsmith.core.functions.Echoes$color.exec(Echoes.java:234)
	at com.laytonsmith.core.MethodScriptCompiler.optimize(MethodScriptCompiler.java:1423)
	at com.laytonsmith.core.MethodScriptCompiler.optimize(MethodScriptCompiler.java:1295)
	at com.laytonsmith.core.MethodScriptCompiler.optimize(MethodScriptCompiler.java:1295)
	at com.laytonsmith.core.MethodScriptCompiler.compile(MethodScriptCompiler.java:1171)
	at com.laytonsmith.core.functions.Meta$eval.execs(Meta.java:407)
	at com.laytonsmith.core.Script.eval(Script.java:257)
	at com.laytonsmith.core.Script.eval(Script.java:265)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1489)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
	at com.laytonsmith.core.Script.run(Script.java:165)
	at com.laytonsmith.core.AliasCore.alias(AliasCore.java:140)
	at com.laytonsmith.commandhelper.CommandHelperServerListener.onServerCommand(CommandHelperServerListener.java:41)
	at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
	at net.minecraft.server.v1_6_R2.DedicatedServer.ar(DedicatedServer.java:258)
	at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:227)
	at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486)
	at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419)
	at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)```



And if the script with this errors is hardcoded:

```Java2013-08-11 21:23:10 [SEVERE] java.lang.RuntimeException: While processing a script, (E:\Documents\Desktop\afaire\serv\bukkit\RequiCraft\plugins\CommandHelper\aliases.msa) an unexpected exception occurred. (No further information is available, unfortunately.)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.AliasCore$LocalPackage.compileMSA(AliasCore.java:506)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.AliasCore.reload(AliasCore.java:325)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.commandhelper.CommandHelperPlugin.onCommand(CommandHelperPlugin.java:317)
2013-08-11 21:23:10 [SEVERE] 	at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
2013-08-11 21:23:10 [SEVERE] 	at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:191)
2013-08-11 21:23:10 [SEVERE] 	at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:523)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.abstraction.bukkit.BukkitMCServer.dispatchCommand(BukkitMCServer.java:66)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.functions.Meta$run.exec(Meta.java:307)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.Script.eval(Script.java:301)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.Script.eval(Script.java:265)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1489)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.Script.run(Script.java:165)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.AliasCore.alias(AliasCore.java:140)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.functions.Meta$call_alias.exec(Meta.java:546)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.Script.eval(Script.java:301)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1489)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.Script.run(Script.java:165)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.AliasCore.alias(AliasCore.java:140)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.commandhelper.CommandHelperServerListener.onServerCommand(CommandHelperServerListener.java:41)
2013-08-11 21:23:10 [SEVERE] 	at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
2013-08-11 21:23:10 [SEVERE] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-08-11 21:23:10 [SEVERE] 	at java.lang.reflect.Method.invoke(Unknown Source)
2013-08-11 21:23:10 [SEVERE] 	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
2013-08-11 21:23:10 [SEVERE] 	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
2013-08-11 21:23:10 [SEVERE] 	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
2013-08-11 21:23:10 [SEVERE] 	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
2013-08-11 21:23:10 [SEVERE] 	at net.minecraft.server.v1_6_R2.DedicatedServer.ar(DedicatedServer.java:258)
2013-08-11 21:23:10 [SEVERE] 	at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:227)
2013-08-11 21:23:10 [SEVERE] 	at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:486)
2013-08-11 21:23:10 [SEVERE] 	at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:419)
2013-08-11 21:23:10 [SEVERE] 	at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
2013-08-11 21:23:10 [SEVERE] Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
2013-08-11 21:23:10 [SEVERE] 	at java.lang.String.charAt(Unknown Source)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.functions.Echoes$color.exec(Echoes.java:274)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.MethodScriptCompiler.optimize(MethodScriptCompiler.java:1423)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.MethodScriptCompiler.optimize(MethodScriptCompiler.java:1295)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.MethodScriptCompiler.compile(MethodScriptCompiler.java:1171)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.Script.compileRight(Script.java:741)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.Script.compile(Script.java:511)
2013-08-11 21:23:10 [SEVERE] 	at com.laytonsmith.core.AliasCore$LocalPackage.compileMSA(AliasCore.java:499)
2013-08-11 21:23:10 [SEVERE] 	... 32 more```
commented

Comment by jb_aero

Why would you even want to do that?

commented

Comment by Hekta

I got this error once a long time ago because I have in my script a 'color(get_value ())', and once I got a wrong value, I hardcoded to reproduce this.
I know this is a mistake in my script, but I report it just to signal that it sends a Java exception instead of a CH exception.

commented

Comment by LadyCailin

Fixed in next build.