-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Null checked for source when calling sourceRef #21431
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
Conversation
|
Hi @thanhtien522 Thanks for the PR. Any chance we can add a failing unit test that passes with your fix in place? |
javanna
left a comment
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.
thanks for the PR! I left a small comment, would it also be possible to have a small unit test for this added to InternalSearchHitTests?
| @Override | ||
| public BytesReference sourceRef() { | ||
| if (this.source == null) | ||
| return 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.
could you please add the curly brackets around this statement? we tend to use them although not needed around a single, for better readability.
- add the curly brackets around statement - add unit test for this case
|
retest this please |
|
@elasticmachine test this please |
javanna
left a comment
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.
thanks @thanhtien522 !
…#21431) Add null check in InternalSearchHit#sourceRef to prevent NPE Closes elastic#19279
…#21431) Add null check in InternalSearchHit#sourceRef to prevent NPE Closes elastic#19279
…#21431) Add null check in InternalSearchHit#sourceRef to prevent NPE Closes elastic#19279
* master: (516 commits) Avoid angering Log4j in TransportNodesActionTests Add trace logging when aquiring and releasing operation locks for replication requests Fix handler name on message not fully read Remove accidental import. Improve log message in TransportNodesAction Clean up of Script. Update Joda Time to version 2.9.5 (#21468) Remove unused ClusterService dependency from SearchPhaseController (#21421) Remove max_local_storage_nodes from elasticsearch.yml (#21467) Wait for all reindex subtasks before rethrottling Correcting a typo-Maan to Man-in README.textile (#21466) Fix InternalSearchHit#hasSource to return the proper boolean value (#21441) Replace all index date-math examples with the URI encoded form Fix typos (#21456) Adapt ES_JVM_OPTIONS packaging test to ubuntu-1204 Add null check in InternalSearchHit#sourceRef to prevent NPE (#21431) Add VirtualBox version check (#21370) Export ES_JVM_OPTIONS for SysV init Skip reindex rethrottle tests with workers Make forbidden APIs be quieter about classpath warnings (#21443) ...
sourceRefalways throwNullPointerExceptionwhensourceisnullCloses #19279