Skip to content

Commit

Permalink
CAMEL-5426: System streams should never be closed.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/camel/branches/camel-2.9.x@1412776 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
davsclaus committed Nov 23, 2012
1 parent b9ffe2c commit 00d3723
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,12 @@ private synchronized void closeStream(boolean force) throws Exception {
// never close a standard stream (system.out or system.err)
// always close a 'header' stream (unless it's a system stream)
boolean systemStream = outputStream != System.out || outputStream != System.err;
boolean headerStream = "header".equals(uri) && !systemStream;
boolean headerStream = "header".equals(uri);
boolean reachedLimit = endpoint.getAutoCloseCount() > 0 && count.decrementAndGet() <= 0;
boolean expiredStream = force || headerStream || reachedLimit; // evaluation order is important!

if (expiredStream) {
// never ever close a system stream
if (!systemStream && expiredStream) {
outputStream.close();
outputStream = null;
LOG.debug("Closed stream '{}'", endpoint.getEndpointKey());
Expand Down

0 comments on commit 00d3723

Please sign in to comment.