CommandHelper

CommandHelper

46.5k Downloads

No checking length of message when using throw [java.lang.StringIndexOutOfBoundsException]

LadyCailinBot opened this issue ยท 4 comments

commented

CMDHELPER-2863 - Reported by janwil

No checking if length of message is too long in command throw()

When using throw(PluginInternalException,'No correct request found, are you sure BungeeCord did not change the plugin msg format? See http://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel')

you dont get a msg, only the following in console:
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:442) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:530) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:259) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:647) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.PacketPlayInCustomPayload.handle(PacketPlayInCustomPayload.java:43) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.PacketPlayInCustomPayload.a(PacketPlayInCustomPayload.java:31) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java:1805) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at org.bukkit.plugin.messaging.StandardMessenger.dispatchIncomingMessage(StandardMessenger.java:427) [spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at com.laytonsmith.commandhelper.CommandHelperMessageListener.onPluginMessageReceived(CommandHelperMessageListener.java:26) ~[?:?]
01.01 23:16:32 [Server] INFO at com.laytonsmith.core.events.EventUtils.TriggerListener(EventUtils.java:193) ~[?:?]
01.01 23:16:32 [Server] INFO at com.laytonsmith.core.events.EventUtils.FireListeners(EventUtils.java:212) ~[?:?]
01.01 23:16:32 [Server] INFO at com.laytonsmith.core.exceptions.ConfigRuntimeException.React(ConfigRuntimeException.java:168) ~[?:?]
01.01 23:16:32 [Server] INFO at com.laytonsmith.core.exceptions.ConfigRuntimeException.React(ConfigRuntimeException.java:184) ~[?:?]
01.01 23:16:32 [Server] INFO at com.laytonsmith.core.exceptions.ConfigRuntimeException.DoReport(ConfigRuntimeException.java:271) ~[?:?]
01.01 23:16:32 [Server] INFO at com.laytonsmith.core.exceptions.ConfigRuntimeException.DoReport(ConfigRuntimeException.java:262) ~[?:?]
01.01 23:16:32 [Server] INFO at com.laytonsmith.abstraction.bukkit.BukkitMCPlayer.sendMessage(BukkitMCPlayer.java:260) ~[?:?]
01.01 23:16:32 [Server] INFO at org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer.sendMessage(CraftPlayer.java:146) ~[spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer.sendRawMessage(CraftPlayer.java:138) ~[spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at org.bukkit.craftbukkit.v1_7_R1.util.CraftChatMessage.fromString(CraftChatMessage.java:153) ~[spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at org.bukkit.craftbukkit.v1_7_R1.util.CraftChatMessage$FromString.(CraftChatMessage.java:20) ~[spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at org.bukkit.craftbukkit.v1_7_R1.util.CraftChatMessage$FromString.(CraftChatMessage.java:91) ~[spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at org.bukkit.craftbukkit.v1_7_R1.util.CraftChatMessage$FromString.checkUrl(CraftChatMessage.java:116) ~[spigot_1170.jar:git-Spigot-1170]
01.01 23:16:32 [Server] INFO at java.lang.StringBuilder.delete(Unknown Source) ~[?:1.7.0_21]
01.01 23:16:32 [Server] INFO at java.lang.AbstractStringBuilder.delete(Unknown Source) ~[?:1.7.0_21]
01.01 23:16:32 [Server] INFO java.lang.StringIndexOutOfBoundsException: String index out of range: -67
01.01 23:16:32 [Server] INFO [23:16:32 WARN]: Could not pass incoming plugin message to CommandHelper v3.3.1-SNAPSHOT:2390-a79107a,master
01.01 23:16:32 [Server] INFO [23:16:32 INFO]: PluginInternalException: No correct request found, are you sure BungeeCord did not change the plugin msg format? See http://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel

commented

Comment by EntityReborn

Can I see the whole code block you are using this in?
I can't see why we'd need to limit the size of the message of throw(), yet I do believe the issue is elsewhere, possibly not catching exceptions properly.

commented

Comment by janwil

ow, sorry i just shortened the string and its working. Don't have that code anymore

commented

Comment by janwil

so this works?: throw(PluginInternalException,'No correct request found, are you sure BungeeCord did not change the plugin msg format? See http://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel')

commented

Comment by EntityReborn

This seems to work as expected now.