CommandHelper

CommandHelper

46.5k Downloads

Stacktraces with parse_int()

LadyCailinBot opened this issue ยท 1 comments

commented

CMDHELPER-2800 - Reported by Hekta

If radix is greater than 36 or less than 2:

parse_int('a', 37)
on or around E:\Documents\Desktop\afaire\serv\bukkit\RequiCraft\plugins\CommandHelper\LocalPackages\RequiCraft\extensions\Dev\extension.library\commands.ms:1.
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:2379-ea4f97f,master. Here's the stacktrace:
java.lang.NumberFormatException: radix 37 greater than Character.MAX_RADIX
	at java.lang.Long.parseLong(Unknown Source)
	at com.laytonsmith.core.functions.DataHandling$parse_int.exec(DataHandling.java:2678)
	at com.laytonsmith.core.Script.eval(Script.java:300)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.Script.seval(Script.java:210)
	at com.laytonsmith.core.functions.Meta$eval.execs(Meta.java:420)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1489)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
	at com.laytonsmith.core.constructs.CClosure.execute(CClosure.java:142)
	at com.laytonsmith.core.functions.DataHandling$execute.exec(DataHandling.java:2366)
	at com.laytonsmith.core.Script.eval(Script.java:300)
	at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:383)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.Script.seval(Script.java:210)
	at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:388)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.Procedure.execute(Procedure.java:179)
	at com.laytonsmith.core.Procedure.cexecute(Procedure.java:149)
	at com.laytonsmith.core.Script.eval(Script.java:237)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:383)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	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:164)
	at com.laytonsmith.core.events.AbstractEvent.execute(AbstractEvent.java:70)
	at com.laytonsmith.core.events.BoundEvent.execute(BoundEvent.java:302)
	at com.laytonsmith.core.events.BoundEvent.trigger(BoundEvent.java:261)
	at com.laytonsmith.core.events.EventUtils.FireListeners(EventUtils.java:205)
	at com.laytonsmith.core.events.EventUtils.TriggerListener(EventUtils.java:193)
	at com.laytonsmith.chadvanced.events.ServerCommand.triggerServerCommand(ServerCommand.java:31)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.laytonsmith.core.events.EventUtils.TriggerExternal(EventUtils.java:267)
	at com.laytonsmith.commandhelper.CommandHelperServerListener.onServerCommand(CommandHelperServerListener.java:33)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.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)```

```2013-09-10 13:40:15 [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:
parse_int('1', 1)
on or around E:\Documents\Desktop\afaire\serv\bukkit\RequiCraft\plugins\CommandHelper\LocalPackages\RequiCraft\extensions\Dev\extension.library\commands.ms:1.
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:2379-ea4f97f,master. Here's the stacktrace:
java.lang.NumberFormatException: radix 1 less than Character.MIN_RADIX
	at java.lang.Long.parseLong(Unknown Source)
	at com.laytonsmith.core.functions.DataHandling$parse_int.exec(DataHandling.java:2678)
	at com.laytonsmith.core.Script.eval(Script.java:300)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.Script.seval(Script.java:210)
	at com.laytonsmith.core.functions.Meta$eval.execs(Meta.java:420)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1489)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
	at com.laytonsmith.core.constructs.CClosure.execute(CClosure.java:142)
	at com.laytonsmith.core.functions.DataHandling$execute.exec(DataHandling.java:2366)
	at com.laytonsmith.core.Script.eval(Script.java:300)
	at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:383)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.Script.seval(Script.java:210)
	at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:388)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.Procedure.execute(Procedure.java:179)
	at com.laytonsmith.core.Procedure.cexecute(Procedure.java:149)
	at com.laytonsmith.core.Script.eval(Script.java:237)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:383)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	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:164)
	at com.laytonsmith.core.events.AbstractEvent.execute(AbstractEvent.java:70)
	at com.laytonsmith.core.events.BoundEvent.execute(BoundEvent.java:302)
	at com.laytonsmith.core.events.BoundEvent.trigger(BoundEvent.java:261)
	at com.laytonsmith.core.events.EventUtils.FireListeners(EventUtils.java:205)
	at com.laytonsmith.core.events.EventUtils.TriggerListener(EventUtils.java:193)
	at com.laytonsmith.chadvanced.events.ServerCommand.triggerServerCommand(ServerCommand.java:31)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.laytonsmith.core.events.EventUtils.TriggerExternal(EventUtils.java:267)
	at com.laytonsmith.commandhelper.CommandHelperServerListener.onServerCommand(CommandHelperServerListener.java:33)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.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)```


If the string is not properly formatted:
```2013-09-10 13:39:28 [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:
parse_int('a', 8)
on or around E:\Documents\Desktop\afaire\serv\bukkit\RequiCraft\plugins\CommandHelper\LocalPackages\RequiCraft\extensions\Dev\extension.library\commands.ms:1.
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:2379-ea4f97f,master. Here's the stacktrace:
java.lang.NumberFormatException: For input string: "a"
	at java.lang.NumberFormatException.forInputString(Unknown Source)
	at java.lang.Long.parseLong(Unknown Source)
	at com.laytonsmith.core.functions.DataHandling$parse_int.exec(DataHandling.java:2678)
	at com.laytonsmith.core.Script.eval(Script.java:300)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.Script.seval(Script.java:210)
	at com.laytonsmith.core.functions.Meta$eval.execs(Meta.java:420)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1489)
	at com.laytonsmith.core.MethodScriptCompiler.execute(MethodScriptCompiler.java:1454)
	at com.laytonsmith.core.constructs.CClosure.execute(CClosure.java:142)
	at com.laytonsmith.core.functions.DataHandling$execute.exec(DataHandling.java:2366)
	at com.laytonsmith.core.Script.eval(Script.java:300)
	at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:383)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.Script.seval(Script.java:210)
	at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:388)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.Procedure.execute(Procedure.java:179)
	at com.laytonsmith.core.Procedure.cexecute(Procedure.java:149)
	at com.laytonsmith.core.Script.eval(Script.java:237)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	at com.laytonsmith.core.functions.BasicLogic$ifelse.execs(BasicLogic.java:383)
	at com.laytonsmith.core.Script.eval(Script.java:256)
	at com.laytonsmith.core.Script.eval(Script.java:264)
	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:164)
	at com.laytonsmith.core.events.AbstractEvent.execute(AbstractEvent.java:70)
	at com.laytonsmith.core.events.BoundEvent.execute(BoundEvent.java:302)
	at com.laytonsmith.core.events.BoundEvent.trigger(BoundEvent.java:261)
	at com.laytonsmith.core.events.EventUtils.FireListeners(EventUtils.java:205)
	at com.laytonsmith.core.events.EventUtils.TriggerListener(EventUtils.java:193)
	at com.laytonsmith.chadvanced.events.ServerCommand.triggerServerCommand(ServerCommand.java:31)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.laytonsmith.core.events.EventUtils.TriggerExternal(EventUtils.java:267)
	at com.laytonsmith.commandhelper.CommandHelperServerListener.onServerCommand(CommandHelperServerListener.java:33)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.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)```


Also, in the to_radix() function, maybe would it be better to throw a RangeException if radix is greater than 36 or less than 2, instead of returning the number as if everything is working fine ?
commented

Comment by LadyCailin

Will be fixed in the next build. Thanks!