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

デフォルトの発言先をグローバルに設定しようとすると、NullPointerExceptionが発生する #43

Closed
ucchyocean opened this Issue Aug 7, 2013 · 2 comments

Comments

Projects
None yet
1 participant
@ucchyocean
Owner

ucchyocean commented Aug 7, 2013

FindBugsによるバグ可能性の発見。

【再現方法】
グローバルチャンネルを設定せずに、チャンネルチャットを利用している環境において、
デフォルトの発言先をグローバルに設定(「/ch join !」または「/ch !」)
しようとしたときに、NullPointerExceptionが発生する。

【解析情報】
下記の箇所で、LunaChatAPI#setDefaultChannel(playerName, channelName) の第2引数にnullを設定しており、

api.setDefaultChannel(player.getName(), null);

下記の箇所で、channelName.toLowerCase() を実行している。
defaultChannels.put(playerName, channelName.toLowerCase());

【対策内容】
ChannelManager#setDefaultChannel(playerName, channelName) の最初の部分で、
channelName の null評価を行い、nullの場合はマップから該当データを削除してreturnする。

@ucchyocean

This comment has been minimized.

Show comment
Hide comment
@ucchyocean

ucchyocean Aug 7, 2013

Owner

再現することを確認。

2013-08-08 08:17:52 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'ch' in plugin LunaChat v2.3.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:191)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:523)
    at net.minecraft.server.v1_6_R2.PlayerConnection.handleCommand(PlayerConnection.java:954)
    at net.minecraft.server.v1_6_R2.PlayerConnection.chat(PlayerConnection.java:872)
    at net.minecraft.server.v1_6_R2.PlayerConnection.a(PlayerConnection.java:829)
    at net.minecraft.server.v1_6_R2.Packet3Chat.handle(SourceFile:49)
    at net.minecraft.server.v1_6_R2.NetworkManager.b(NetworkManager.java:296)
    at net.minecraft.server.v1_6_R2.PlayerConnection.e(PlayerConnection.java:116)
    at net.minecraft.server.v1_6_R2.ServerConnection.b(SourceFile:37)
    at net.minecraft.server.v1_6_R2.DedicatedServerConnection.b(SourceFile:30)
    at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:590)
    at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:226)
    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)
Caused by: java.lang.NullPointerException
    at com.github.ucchyocean.lc.ChannelManager.setDefaultChannel(ChannelManager.java:333)
    at com.github.ucchyocean.lc.command.JoinCommand.runCommand(JoinCommand.java:103)
    at com.github.ucchyocean.lc.command.LunaChatCommand.onCommand(LunaChatCommand.java:78)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
    ... 15 more
Owner

ucchyocean commented Aug 7, 2013

再現することを確認。

2013-08-08 08:17:52 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'ch' in plugin LunaChat v2.3.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:191)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:523)
    at net.minecraft.server.v1_6_R2.PlayerConnection.handleCommand(PlayerConnection.java:954)
    at net.minecraft.server.v1_6_R2.PlayerConnection.chat(PlayerConnection.java:872)
    at net.minecraft.server.v1_6_R2.PlayerConnection.a(PlayerConnection.java:829)
    at net.minecraft.server.v1_6_R2.Packet3Chat.handle(SourceFile:49)
    at net.minecraft.server.v1_6_R2.NetworkManager.b(NetworkManager.java:296)
    at net.minecraft.server.v1_6_R2.PlayerConnection.e(PlayerConnection.java:116)
    at net.minecraft.server.v1_6_R2.ServerConnection.b(SourceFile:37)
    at net.minecraft.server.v1_6_R2.DedicatedServerConnection.b(SourceFile:30)
    at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:590)
    at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:226)
    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)
Caused by: java.lang.NullPointerException
    at com.github.ucchyocean.lc.ChannelManager.setDefaultChannel(ChannelManager.java:333)
    at com.github.ucchyocean.lc.command.JoinCommand.runCommand(JoinCommand.java:103)
    at com.github.ucchyocean.lc.command.LunaChatCommand.onCommand(LunaChatCommand.java:78)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
    ... 15 more

ucchyocean added a commit that referenced this issue Aug 7, 2013

@ucchyocean

This comment has been minimized.

Show comment
Hide comment
@ucchyocean

ucchyocean Aug 7, 2013

Owner

Fixed.
修正確認OK

Owner

ucchyocean commented Aug 7, 2013

Fixed.
修正確認OK

@ucchyocean ucchyocean closed this Aug 7, 2013

@ghost ghost assigned ucchyocean Aug 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment