// the idiom in Hudson is to use the returned writer for writing stack trace,
// so put the marker here to indicate an exception. if the stack trace isn't actually written,
// HudsonExceptionNote.annotate recovers gracefully.
try {
annotate(new HudsonExceptionNote());
} catch (IOException e) {
// for signature compatibility, we have to swallow this error
}
return new PrintWriter(
charset!=null ? new OutputStreamWriter(out,charset) : new OutputStreamWriter(out),true);