Author: isudana
Date: Wed May 29 00:08:54 2019
New Revision: 1860309
URL: http://svn.apache.org/viewvc?rev=1860309&view=rev
Log:
Fix for SYNAPSE-1048 by Isuru Ranawaka
Modified:
synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java
Modified:
synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java?rev=1860309&r1=1860308&r2=1860309&view=diff
==============================================================================
---
synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java
(original)
+++
synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/TargetHandler.java
Wed May 29 00:08:54 2019
@@ -477,13 +477,24 @@ public class TargetHandler implements NH
}
public void exception(NHttpClientConnection conn, Exception e) {
+ ProtocolState state = TargetContext.getState(conn);
+
+ if (state == ProtocolState.REQUEST_HEAD || state ==
ProtocolState.REQUEST_BODY) {
+ informWriterError(conn);
+ log.warn("Exception occurred while writing the request data");
+ } else if (state == ProtocolState.RESPONSE_HEAD || state ==
ProtocolState.RESPONSE_BODY) {
+ informReaderError(conn);
+ log.warn("Exception occurred while reading the response data");
+ } else if (state == ProtocolState.REQUEST_DONE) {
+ log.warn("Exception occurred after writing the request data but
before reading the response data");
+ }
+
if (e instanceof HttpException) {
exception(conn, (HttpException) e);
} else if (e instanceof IOException) {
exception(conn, (IOException) e);
} else {
log.error("Unexpected exception encountered in TargetHandler", e);
- ProtocolState state = TargetContext.getState(conn);
MessageContext requestMsgCtx =
TargetContext.get(conn).getRequestMsgCtx();
if (requestMsgCtx != null) {
targetErrorHandler.handleError(requestMsgCtx,