Skip to content

Conversation

@neitomic
Copy link
Contributor

@neitomic neitomic commented Nov 9, 2016

sourceRef always throw NullPointerException when source is null

Closes #19279

@clintongormley clintongormley changed the title Null checked for source when calling sourceRef (issue #19279) Null checked for source when calling sourceRef Nov 9, 2016
@clintongormley clintongormley added :Core/Infra/REST API REST infrastructure and utilities >bug labels Nov 9, 2016
@clintongormley
Copy link
Contributor

Hi @thanhtien522

Thanks for the PR. Any chance we can add a failing unit test that passes with your fix in place?

Copy link
Member

@javanna javanna left a 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;
Copy link
Member

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.

@javanna javanna self-assigned this Nov 9, 2016
 - add the curly brackets around statement
 - add unit test for this case
@neitomic
Copy link
Contributor Author

retest this please

@javanna
Copy link
Member

javanna commented Nov 10, 2016

@elasticmachine test this please

Copy link
Member

@javanna javanna left a comment

Choose a reason for hiding this comment

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

thanks @thanhtien522 !

@javanna javanna merged commit 27a7b30 into elastic:master Nov 10, 2016
@javanna javanna added :Core/Infra/Transport API Transport client API v6.0.0-alpha1 v5.1.1 v5.0.1 and removed :Core/Infra/REST API REST infrastructure and utilities labels Nov 10, 2016
javanna pushed a commit to javanna/elasticsearch that referenced this pull request Nov 10, 2016
…#21431)

Add null check in InternalSearchHit#sourceRef to prevent NPE

Closes elastic#19279
javanna pushed a commit to javanna/elasticsearch that referenced this pull request Nov 10, 2016
…#21431)

Add null check in InternalSearchHit#sourceRef to prevent NPE

Closes elastic#19279
javanna pushed a commit to javanna/elasticsearch that referenced this pull request Nov 10, 2016
…#21431)

Add null check in InternalSearchHit#sourceRef to prevent NPE

Closes elastic#19279
@javanna javanna added the v2.4.2 label Nov 10, 2016
jasontedor added a commit that referenced this pull request Nov 11, 2016
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants