-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Issue 9130: Pulsar-admin sinks create: bad error message "java.lang.NullPointerException: path is 'null'." in case of missing "--name" parameter #9131
Conversation
…ullPointerException: path is 'null'." in case of missing "--name" parameter
@@ -232,6 +233,10 @@ public void createSink(SinkConfig sinkConfig, String fileName) throws PulsarAdmi | |||
@Override | |||
public CompletableFuture<Void> createSinkAsync(SinkConfig sinkConfig, String fileName) { | |||
final CompletableFuture<Void> future = new CompletableFuture<>(); | |||
if (StringUtils.isBlank(sinkConfig.getName())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need a better story here to validate the parameters? For example, what if tenant or namespace is null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sijie I have added validation for all of the methods in SinksImpl for sinkname, namespace and tenant.
PTAL
/pulsarbot rerun-failure-tests |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
@eolivelli Can you rebase to the latest master? |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
Fixes #9130
Motivation
Return a better error to the user
Modifications
Add an explicit validation and do not let WebTarget#path throw an internal error.
The validation covers tenant,namespace and sinkname in all of the functions regarding sinks.
We must do the validation here because we have to prevent code to pass bad values to JAX-RS client
Verifying this change
This change added unit tests