IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
61 | 61 | private final Supplier<OutputStream> outputStreamSupplier; |
62 | 62 | private final Handler prioritizedHandler; |
63 | 63 | private OutputStream outputStreamMemo; |
| 64 | /** |
| 65 | * This variables is set to true as soon as the superconstructor has completed. |
| 66 | * The superconstructor calls {@code setOutputStream(System.err)}, any subsequent call of |
| 67 | * {@link #setOutputStream(OutputStream)} would then flush and close {@link System#err}. To avoid this, |
| 68 | * we override {@link #setOutputStream(OutputStream)} to completely ignore all calls from the superconstructor. |
| 69 | */ |
| 70 | private boolean superCompleted = false; |
64 | 71 | |
65 | 72 | /** |
66 | 73 | * Construct a new {@link ReacquiringConsoleHandler}. |
… |
… |
|
75 | 82 | final Supplier<OutputStream> outputStreamSupplier, |
76 | 83 | final Handler prioritizedHandler |
77 | 84 | ) { |
| 85 | super(); |
| 86 | superCompleted = true; |
78 | 87 | this.outputStreamSupplier = outputStreamSupplier; |
79 | 88 | this.prioritizedHandler = prioritizedHandler; |
80 | 89 | |
… |
… |
|
97 | 106 | |
98 | 107 | @Override |
99 | 108 | public synchronized void setOutputStream(final OutputStream outputStream) { |
100 | | // this wouldn't be necessary if StreamHandler made it possible to see what the current |
101 | | // output stream is set to |
102 | | this.outputStreamMemo = outputStream; |
103 | | super.setOutputStream(outputStream); |
| 109 | // Ignore calls from superconstructor (see javadoc of the variable for details) |
| 110 | if (superCompleted) { |
| 111 | // this wouldn't be necessary if StreamHandler made it possible to see what the current |
| 112 | // output stream is set to |
| 113 | this.outputStreamMemo = outputStream; |
| 114 | super.setOutputStream(outputStream); |
| 115 | } |
104 | 116 | } |
105 | 117 | |
106 | 118 | @Override |