MINOR: Fix use of ConfigException in AbstractConfig class#11349
Merged
Conversation
tombentley
reviewed
Sep 24, 2021
| } catch (ClassNotFoundException e) { | ||
| log.error("ClassNotFoundException exception occurred: " + entry.getValue()); | ||
| throw new ConfigException("Invalid config:" + entry.getValue() + " ClassNotFoundException exception occurred", e); | ||
| throw new ConfigException(providerClassProperty(entry.getKey()), entry.getValue(), "ClassNotFoundException exception occurred"); |
Member
There was a problem hiding this comment.
What if the class that's not found isn't the config provider but some dependency of it? Because the CNFE message isn't logged nor passed to the ConfigException this info would be lost.
Contributor
Author
There was a problem hiding this comment.
Good point; I've updated the log line above to include the entire stack trace. It'd be nice if there were a variant of ConfigException that took in a cause argument but there is none at the moment and it's probably not worth it to add one just for this use case.
Member
|
Failing test is unrelated. |
Member
|
Thanks @C0urante! |
3 tasks
xdgrulez
pushed a commit
to xdgrulez/kafka
that referenced
this pull request
Dec 22, 2021
* Log full trace for class-not-found errors, improve accuracy of error messages Reviewers: Tom Bentley <tbentley@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The two-arg variant is intended to take a property name and value, not an exception message and a cause.
As-is, this leads to confusing log messages like:
Committer Checklist (excluded from commit message)