Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix potential NPE when no source and no body
In recent changes, we added missing support for `source` parameter in some REST APIs: * #4892 : mget * #4900 : mpercolate * #4901 : msearch * #4902 : mtermvectors * #4903 : percolate ```java BytesReference content = null; if (request.hasContent()) { content = request.content(); } else { String source = request.param("source"); if (source != null) { content = new BytesArray(source); } } ``` It's definitely better to have: ```java BytesReference content = request.content(); if (!request.hasContent()) { String source = request.param("source"); if (source != null) { content = new BytesArray(source); } } ``` That said, it could be nice to have a single method to manage it for various REST actions. Closes #4924.
- Loading branch information
Showing
6 changed files
with
30 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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