Skip to content
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

fix NPE #126

Merged
merged 2 commits into from
Jan 15, 2020
Merged

fix NPE #126

merged 2 commits into from
Jan 15, 2020

Conversation

gitseti
Copy link
Contributor

@gitseti gitseti commented Jan 8, 2020

Motivation

ContextSubscribeCommand with -s throws an NPE if the server closes the connection.

E.g:

hmq_joEz7_2_d34e54b40e8e39cddd9929189e78a12f@localhost> sub -t test1 -s
sss
sss
Server closed connection without DISCONNECT.
Press ENTER to resume:
java.lang.NullPointerException
	at com.hivemq.cli.commands.shell.ShellContextCommand.getKey(ShellContextCommand.java:73)
	at com.hivemq.cli.commands.shell.ContextSubscribeCommand.toString(ContextSubscribeCommand.java:166)
	at java.base/java.lang.String.valueOf(String.java:3352)
	at java.base/java.lang.StringBuilder.append(StringBuilder.java:166)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1738)
	at picocli.CommandLine.access$900(CommandLine.java:145)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2101)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2068)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1935)
	at picocli.CommandLine.execute(CommandLine.java:1864)
	at com.hivemq.cli.commands.shell.ShellCommand.interact(ShellCommand.java:153)
	at com.hivemq.cli.commands.shell.ShellCommand.run(ShellCommand.java:103)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1729)
	at picocli.CommandLine.access$900(CommandLine.java:145)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2101)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2068)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1935)
	at picocli.CommandLine.execute(CommandLine.java:1864)
	at com.hivemq.cli.MqttCLIMain.main(MqttCLIMain.java:59)
mqtt>
mqtt>

Changes

  • Add not null checks

@cla-bot cla-bot bot added the cla-signed label Jan 8, 2020
@gitseti gitseti requested a review from SgtSilvio January 9, 2020 09:58
@gitseti gitseti merged commit acbe3d7 into develop Jan 15, 2020
@gitseti gitseti deleted the fix-npe branch January 15, 2020 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants