kopia lustrzana https://github.com/gaul/s3proxy
Override PrintStream.write as well as print
args4j inconsistently uses both methods for output. Workaround for kohsuke/args4j#149.pull/95/merge
rodzic
84ec8e22da
commit
525c6e2275
|
@ -241,9 +241,27 @@ public final class Main {
|
|||
|
||||
private static PrintStream createLoggerErrorPrintStream() {
|
||||
return new PrintStream(System.err) {
|
||||
private final StringBuilder builder = new StringBuilder();
|
||||
|
||||
@Override
|
||||
public void print(final String string) {
|
||||
logger.error(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] buf, int off, int len) {
|
||||
for (int i = off; i < len; ++i) {
|
||||
char ch = (char) buf[i];
|
||||
if (ch == '\n') {
|
||||
if (builder.length() != 0) {
|
||||
print(builder.toString());
|
||||
builder.setLength(0);
|
||||
}
|
||||
} else {
|
||||
builder.append(ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue