Merge pull request #4290 from eclipse/jetty-9.4.x-4269-restore-PrintWriter-contract
Issue #4269 - Restoring PrintWriter contract on errors
This commit is contained in:
commit
d99ae19201
|
@ -128,10 +128,13 @@ public class ResponseWriter extends PrintWriter
|
|||
private void isOpen() throws IOException
|
||||
{
|
||||
if (_ioException != null)
|
||||
throw new RuntimeIOException(_ioException);
|
||||
throw _ioException;
|
||||
|
||||
if (_isClosed)
|
||||
throw new EofException("Stream closed");
|
||||
{
|
||||
_ioException = new EofException("Stream closed");
|
||||
throw _ioException;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -54,7 +54,6 @@ import org.eclipse.jetty.http.HttpVersion;
|
|||
import org.eclipse.jetty.http.MetaData;
|
||||
import org.eclipse.jetty.io.AbstractEndPoint;
|
||||
import org.eclipse.jetty.io.ByteArrayEndPoint;
|
||||
import org.eclipse.jetty.io.RuntimeIOException;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ErrorHandler;
|
||||
|
@ -711,7 +710,7 @@ public class ResponseTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWriteRuntimeIOException() throws Exception
|
||||
public void testWriteCheckError() throws Exception
|
||||
{
|
||||
Response response = getResponse();
|
||||
|
||||
|
@ -725,8 +724,8 @@ public class ResponseTest
|
|||
writer.println("test");
|
||||
assertTrue(writer.checkError());
|
||||
|
||||
RuntimeIOException e = assertThrows(RuntimeIOException.class, () -> writer.println("test"));
|
||||
assertEquals(cause, e.getCause());
|
||||
writer.println("test"); // this should not cause an Exception
|
||||
assertTrue(writer.checkError());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue