DiscordSRV

DiscordSRV

86.8k Downloads

NPE from invalid JSON

Scarsz opened this issue · 10 comments

commented

originally add snapshot ids to builds

commented

finished, build number is also injected into a public variable in DiscordSRV.java for usage in code + debug pastes @Androkai

commented

Great feature, good job! @Scarsz
Maybe add a /discord version command to simply show the version

Some suggestions for the new debug-part:

1.) Replace message of the day (MOTD) in first line of debug-output with servername from server.properties and maybe add MOTD in the next line.

2.) For a test I malformed my channels.json and create a NullPointerException. This can't be figured out with the resulting debug-message because the stacktrace is shortened and there is no additional information in channels.json-part like you can see here. Some idea from my side are adding parsing of channels.json and inform in the logs about (maybe also with the problematic position in code) + adding a 1:1 copy of channels.json to the debug-message to make us able helping incompetent admins. It would be also nice if the full stacktrace (every following line stating with a tab) is shown.

3.) The debug-message contains some information about the server. Maybe not everybody wants to have this public. I suggest to document that this happens then using /discord debug. Another idea is using a paste-system like ZeroBin. Sadly this is less pretty than hastebin.

commented

1 was already being done, 2 deserves a NPE exception catch near
https://github.com/Scarsz/DiscordSRV/blob/develop/src/main/java/com/scarsz/discordsrv/DiscordSRV.java#L201, 3 I don't care about

On Friday, August 19, 2016, Christoph Krüger [email protected]
wrote:

Great feature, good job! @Scarsz https://github.com/Scarsz

Some suggestions:

1.) Replace message of the day (MOTD) in first line of debug-output with
servername from server.properties and maybe add MOTD in the next line.

2.) For a test I malformed my channels.json and create a
NullPointerException. This can't be figured out with the resulting
debug-message because the stacktrace is shortened and there is no
additional information in channels.json-part like you can see here
http://hastebin.com/yukeginote. Some idea from my side are adding
parsing of channels.json and inform in the logs about (maybe also with the
problematic position in code) + adding a 1:1 copy of channels.json to the
debug-message to make us able helping incompetent admins. It would be also
nice if the full stacktrace (every following line stating with a tab) is
shown.

3.) The debug-message contains some information about the server. Maybe
not everybody wants to have this public. I suggest to document that this
happens then using /discord debug. Another idea is using a paste-system
like ZeroBin http://sebsauvage.net/wiki/doku.php?id=php:zerobin. Sadly
this is less pretty than hastebin.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#33 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHVe1LoBQPfd6h1dIRIXUrfuNJUiYlMrks5qhZ6dgaJpZM4Jjuqe
.

commented
commented

Works now also if it's a bit malformed but if the channel-IDs are ok and another part of the json is malformed (e.g. a comma after the last entry) it still throws a NullPointerException at startup without explanation.

Btw: @1.) it's still the MOTD for me: http://hastebin.com/owiwihapap
The correct server-name is "BigCraftDEV" for this server.

commented
commented

1.) looks good now: http://hastebin.com/iciricowez :)

commented

Still the NullPointerException

The malformed channels.json I use:

[
  {
    "channelname":"global",
    "channelid":"197831803615182848"
  },
  {
    "channelname":"Admin",
    "channelid":"197831841783218176"
  },
]
commented

todo: add a JSON verification before attempting to load it

commented

this is actually technically already done, not sure what can really be done about this