Skip to content

Commit

Permalink
Ignore the error when the stream is closed and try to continue
Browse files Browse the repository at this point in the history
(cherry picked from commit 7b8733e)
  • Loading branch information
rsvoboda authored and zakkak committed Nov 15, 2022
1 parent b53efb2 commit 3a51748
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 3a51748

Please sign in to comment.