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: fix NPE in CLI if not username supplied #4312

Merged

Conversation

big-andy-coates
Copy link
Contributor

Description

Fixes NPE when running the CLI with no arguments. Was throwing NPE on line:

if (!options.getUserName().isEmpty() && !options.isPasswordSet()) {

in Ksql.java, as options.getUserName() was returning null.

Refactored so that username and password are never null, only empty.

Also refactored so that server will default to http://localhost:8088, even if other params are supplied. Previously, it only defaulted to this if no params supplied.

Testing done

Added tests and manual

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

Fixes NPE when running the CLI with no arguments. Was throwing NPE on line:

```java
if (!options.getUserName().isEmpty() && !options.isPasswordSet()) {
```

in Ksql.java, as `options.getUserName()` was returning `null`.

Refactored so that username and password are never null, only empty.

Also refactored so that server will default to `http://localhost:8088`, even if other params are supplied.  Previously, it only defaulted to this if no params supplied.
@big-andy-coates big-andy-coates requested a review from a team as a code owner January 14, 2020 16:46
Copy link
Member

@spena spena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. LGTM

@big-andy-coates big-andy-coates merged commit 0b6da0b into confluentinc:master Jan 14, 2020
@big-andy-coates big-andy-coates deleted the fix_cli_password branch January 14, 2020 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants