- Timestamp:
- 2018-08-01T19:21:43+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Logging.java
r14062 r14070 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 /** … … 76 83 final Handler prioritizedHandler 77 84 ) { 85 super(); 86 superCompleted = true; 78 87 this.outputStreamSupplier = outputStreamSupplier; 79 88 this.prioritizedHandler = prioritizedHandler; … … 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
Note:
See TracChangeset
for help on using the changeset viewer.