* Streaming: Throw chained IOE from streams to get correct location

This commit is contained in:
zzz
2013-05-07 13:09:03 +00:00
parent 0c03b6ba82
commit 16c8a19be8
3 changed files with 18 additions and 10 deletions

View File

@ -542,8 +542,9 @@ class Connection {
_context.simpleScheduler().addEvent(new DisconnectEvent(), DISCONNECT_TIMEOUT);
}
_resetReceived = true;
_outputStream.streamErrorOccurred(new IOException("Reset received"));
_inputStream.streamErrorOccurred(new IOException("Reset received"));
IOException ioe = new IOException("Reset received");
_outputStream.streamErrorOccurred(ioe);
_inputStream.streamErrorOccurred(ioe);
_connectionError = "Connection reset";
synchronized (_connectLock) { _connectLock.notifyAll(); }
}
@ -998,8 +999,9 @@ class Connection {
_log.debug(buf.toString());
}
_inputStream.streamErrorOccurred(new IOException("Inactivity timeout"));
_outputStream.streamErrorOccurred(new IOException("Inactivity timeout"));
IOException ioe = new IOException("Inactivity timeout");
_inputStream.streamErrorOccurred(ioe);
_outputStream.streamErrorOccurred(ioe);
// Clean disconnect if we have already scheduled one
// (generally because we already sent a close)
disconnect(_disconnectScheduledOn >= 0);

View File

@ -465,10 +465,13 @@ class MessageInputStream extends InputStream {
}
private void throwAnyError() throws IOException {
if (_streamError != null) {
IOException ioe = _streamError;
IOException ioe = _streamError;
if (ioe != null) {
_streamError = null;
throw ioe;
// constructor with cause not until Java 6
IOException ioe2 = new IOException("Input stream error");
ioe2.initCause(ioe);
throw ioe2;
}
}
}

View File

@ -446,10 +446,13 @@ class MessageOutputStream extends OutputStream {
public boolean getClosed() { return _closed; }
private void throwAnyError() throws IOException {
if (_streamError != null) {
IOException ioe = _streamError;
IOException ioe = _streamError;
if (ioe != null) {
_streamError = null;
throw ioe;
// constructor with cause not until Java 6
IOException ioe2 = new IOException("Output stream error");
ioe2.initCause(ioe);
throw ioe2;
}
}