Skip to content

Conversation

@reta
Copy link
Member

@reta reta commented Jan 19, 2022

ResponseImpl#hasEntity returns 'false' when entity is buffered but entity stream is fully consumed with processing exception.

No new TCK test cases are failing:

Test results: passed: 2,631; failed: 32

@reta reta requested a review from andymc12 January 19, 2022 02:23
Object actualEntity = getActualEntity();
if (actualEntity == null) {
return false;
} else if (entityBufferred) {
Copy link
Member Author

Choose a reason for hiding this comment

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

When exception occurs while reading entity, it could happen that:

  • getActualEntity() return entity (since lastEntity is null)
  • but the entity 's InputStream is fully consumed and is not empty
  • however, reading over fully consumed stream in this case is equivalent to reading over empty stream: nothing left to read

As such, the hasEntity return false. Adding the short circuit logic to make sure that if entity was buffered successfully, the response is considered to have an entity.

…ed but entity stream is fully consumed with processing exception
@reta reta merged commit c047c2a into apache:master Jan 23, 2022
reta added a commit that referenced this pull request Jan 23, 2022
…ed but entity stream is fully consumed with processing exception (#893)

(cherry picked from commit c047c2a)
reta added a commit that referenced this pull request Jan 23, 2022
…ed but entity stream is fully consumed with processing exception (#893)

(cherry picked from commit c047c2a)
(cherry picked from commit 143a8c0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant