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
Avoid NPE when getting build information #27442
Conversation
When the Elasticsearch code is loaded in an unusual classloading environment (e.g., when using the high-level REST client) in Jetty, the code source can be null and we trip with an NPE. This commit addresses this.
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.
One suggestion, but looks fine as is.
* Returns path to elasticsearch codebase path | ||
* The location of the code source for Elasticsearch | ||
* | ||
* @return the location of the code source for Elasticsearch which may be null | ||
*/ | ||
static URL getElasticsearchCodebase() { |
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.
Maybe just change this to return String so the null handling is completely inside here?
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.
This was a good suggestion to pursue but we still need the URL
instance so we will keep it like this.
When the Elasticsearch code is loaded in an unusual classloading environment (e.g., when using the high-level REST client) in Jetty, the code source can be null and we trip with an NPE. This commit addresses this. Relates #27442
When the Elasticsearch code is loaded in an unusual classloading environment (e.g., when using the high-level REST client) in Jetty, the code source can be null and we trip with an NPE. This commit addresses this. Relates #27442
When the Elasticsearch code is loaded in an unusual classloading environment (e.g., when using the high-level REST client) in Jetty, the code source can be null and we trip with an NPE. This commit addresses this. Relates #27442
When the Elasticsearch code is loaded in an unusual classloading environment (e.g., when using the high-level REST client in Jetty), the code source can be null and we trip with an NPE. This commit addresses this.