Skip to content

Commit

Permalink
Merge pull request #2204 from malakaganga/fix_json_rst
Browse files Browse the repository at this point in the history
Clear buffered is and json stream in a Build failure
  • Loading branch information
malakaganga authored Jul 15, 2024
2 parents 2f3b65d + 8a024c7 commit 530ca4d
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.http.nio.NHttpServerConnection;
import org.apache.http.nio.reactor.IOSession;
import org.apache.synapse.commons.CorrelationConstants;
import org.apache.synapse.commons.json.JsonUtil;
import org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection;
import org.apache.synapse.transport.nhttp.NhttpConstants;
import org.apache.synapse.transport.passthru.PassThroughConstants;
Expand Down Expand Up @@ -219,8 +220,12 @@ public static void buildMessage(MessageContext messageContext, boolean earlyBuil
}
}
} catch (Exception e) {
//removing JSONstream from the message Context since it is outdated.
JsonUtil.removeJsonPayload(messageContext);
//Clearing the buffer when there is an exception occurred.
discardRequestMessage(messageContext);
//Clearing the buffered input stream when there is an build exception occurred.
messageContext.setProperty(PassThroughConstants.BUFFERED_INPUT_STREAM, null);
messageContext.setProperty(PassThroughConstants.MESSAGE_BUILDER_INVOKED, Boolean.TRUE);
handleException("Error while building Passthrough stream", e);
}
Expand Down

0 comments on commit 530ca4d

Please sign in to comment.