This repository was archived by the owner on May 28, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
core-common/src/main/java/org/glassfish/jersey/message/internal
tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/client Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -743,8 +743,6 @@ public void setWorkers(MessageBodyWorkers workers) {
743743 * {@code false} otherwise.
744744 */
745745 public boolean hasEntity () {
746- entityContent .ensureNotClosed ();
747-
748746 try {
749747 return !entityContent .isEmpty ();
750748 } catch (IllegalStateException ex ) {
Original file line number Diff line number Diff line change 4949import org .glassfish .jersey .test .JerseyTest ;
5050
5151import org .junit .Test ;
52+
53+ import static org .junit .Assert .assertFalse ;
5254import static org .junit .Assert .fail ;
5355
5456/**
@@ -160,10 +162,10 @@ public void testHasEntityAfterClose() {
160162 final Response response = target ().path ("simple" ).request ().get (Response .class );
161163 response .close ();
162164 try {
163- response .hasEntity ();
164- fail ( "IllegalStateException expected when reading a buffered entity after response has been closed." );
165+ boolean hasEntity = response .hasEntity ();
166+ assertFalse ( "Should return false when the connection is already closed" , hasEntity );
165167 } catch (IllegalStateException ex ) {
166- // expected
168+ fail ( "IllegalStateException should have been caught inside hasEntity." );
167169 }
168170 }
169171}
You can’t perform that action at this time.
0 commit comments