Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit 0214b7d

Browse files
Marek PotociarGerrit Code Review
authored andcommitted
Merge "JERSEY-2843 (PR#138) Reverted as it conflicts with JAX-RS specification."
2 parents 98da766 + d69e2d5 commit 0214b7d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

core-common/src/main/java/org/glassfish/jersey/message/internal/InboundMessageContext.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ public void setWorkers(MessageBodyWorkers workers) {
743743
* {@code false} otherwise.
744744
*/
745745
public boolean hasEntity() {
746+
entityContent.ensureNotClosed();
747+
746748
try {
747749
return !entityContent.isEmpty();
748750
} catch (IllegalStateException ex) {

tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/client/ResponseCloseTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import org.glassfish.jersey.test.JerseyTest;
5050

5151
import org.junit.Test;
52-
import static org.junit.Assert.assertFalse;
5352
import static org.junit.Assert.fail;
5453

5554
/**
@@ -160,10 +159,10 @@ public void testHasEntityAfterClose() {
160159
final Response response = target().path("simple").request().get(Response.class);
161160
response.close();
162161
try {
163-
final boolean hasEntity = response.hasEntity();
164-
assertFalse("Should return false when the connection is already closed", hasEntity);
165-
} catch (final IllegalStateException ex) {
162+
response.hasEntity();
166163
fail("IllegalStateException should have been caught inside hasEntity.");
164+
} catch (final IllegalStateException ex) {
165+
// expected
167166
}
168167
}
169168
}

0 commit comments

Comments
 (0)