fix: This fixes a bug in our RestHelpers that would result into empty string returned from reading a http response content. Which subsequently cause exception while parsing the json #2046
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.
This fixes a bug in our RestHelpers that would result into empty string returned from reading a http response content. Which subsequently cause exception while parsing the json.
Related Issues/PRs
#xxx
What changes are proposed in this pull request?
Issue: There is a bug in RestHelpers.parseResult in calling org.apache.commons.io.IOUtils.toString. There is two problem, first it misses on handling exceptions(NullPointerException, IOException, and UnsupportedCharactersetException) and second is the empty http response content. When this happens we are returning an empty string which does not confirm with json format.
The subsequent parsing throws the following exception.
"spray.json.JsonParser$ParsingException: Unexpected end-of-input at input index 0 (line 1, position 1), expected JSON Value:
^"
Proposed mitigation: Return an empty json "{}" in such situation.
How is this patch tested?
Does this PR change any dependencies?
Does this PR add a new feature? If so, have you added samples on website?
website/docs/documentation
folder.Make sure you choose the correct class
estimators/transformers
and namespace.DocTable
points to correct API link.yarn run start
to make sure the website renders correctly.<!--pytest-codeblocks:cont-->
before each python code blocks to enable auto-tests for python samples.WebsiteSamplesTests
job pass in the pipeline.