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

KAFKA-8866; Return exceptions as Optional<ApiException> in authorizer API #7294

Merged
merged 3 commits into from
Sep 5, 2019

Conversation

rajinisivaram
Copy link
Contributor

Follow up on review comment in PR #7268

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Contributor

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

Changes look good, just one question below.

*/
public ApiException exception() {
return exception;
public Optional<ApiException> exception() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is failed() below still useful enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ijuma Thanks for the review. Agree failed() is unnecessary, removed.

@@ -44,8 +46,8 @@ private AclDeleteResult(Collection<AclBindingDeleteResult> deleteResults, ApiExc
/**
* Returns any exception while attempting to match ACL filter to delete ACLs.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we update this javadoc in the same way you did the AclCreateResult one?

if (result.failed) {
println(s"Error while adding ACLs: ${result.exception.getMessage}")
println(Utils.stackTrace(result.exception))
result.exception.ifPresent { exception =>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this doesn't work with Scala 2.11. You probably have to convert to the Scala option before you can use lambdas. There are utility methods for that in scala-java8-compat.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ijuma Thank you, updated.

Copy link
Contributor

@omkreddy omkreddy left a comment

Choose a reason for hiding this comment

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

@rajinisivaram Thanks for the PR. LGTM.

public ApiException exception() {
return exception;
public Optional<ApiException> exception() {
return exception == null ? Optional.empty() : Optional.of(exception);
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we remove deleted() also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@omkreddy Thanks for the review. Makes sense, removed deleted() as well.

@rajinisivaram
Copy link
Contributor Author

@ijuma @omkreddy Thanks for the reviews, merging to trunk.

@rajinisivaram rajinisivaram merged commit b66ea87 into apache:trunk Sep 5, 2019
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.

3 participants