Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,6 @@ public void setWorkers(MessageBodyWorkers workers) {
* {@code false} otherwise.
*/
public boolean hasEntity() {
entityContent.ensureNotClosed();

try {
return !entityContent.isEmpty();
} catch (IllegalStateException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import org.glassfish.jersey.test.JerseyTest;

import org.junit.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;

/**
Expand Down Expand Up @@ -160,10 +162,10 @@ public void testHasEntityAfterClose() {
final Response response = target().path("simple").request().get(Response.class);
response.close();
try {
response.hasEntity();
fail("IllegalStateException expected when reading a buffered entity after response has been closed.");
boolean hasEntity = response.hasEntity();
assertFalse("Should return false when the connection is already closed", hasEntity);
} catch (IllegalStateException ex) {
// expected
fail("IllegalStateException should have been caught inside hasEntity.");
}
}
}