Skip to content

Commit

Permalink
Merge pull request quarkusio#28810 from rsvoboda/OutputFilter.ignore.…
Browse files Browse the repository at this point in the history
…stream.closed.error

Ignore the error when the stream is closed and try to continue
  • Loading branch information
geoand authored Oct 25, 2022
2 parents ccd206a + 7b8733e commit b977abb
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
import java.io.InputStreamReader;
import java.util.function.Function;

import org.jboss.logging.Logger;

public class OutputFilter implements Function<InputStream, Runnable> {
private final StringBuilder builder = new StringBuilder();
private static final Logger log = Logger.getLogger(OutputFilter.class);

@Override
public Runnable apply(InputStream is) {
Expand All @@ -20,7 +23,11 @@ public Runnable apply(InputStream is) {
builder.append(line);
}
} catch (IOException e) {
throw new RuntimeException("Error reading stream.", e);
if (e.getMessage().contains("Stream closed")) {
log.warn("Stream is closed, ignoring and trying to continue");
} else {
throw new RuntimeException("Error reading stream.", e);
}
}
};
}
Expand Down

0 comments on commit b977abb

Please sign in to comment.