FixResourceManagementIssues#2

This commit is contained in:
Adrian-Devries 2025-04-25 22:16:44 +02:00 committed by GitHub
parent 24509aae31
commit b323b6cc19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,10 +64,13 @@ public class Printer {
public static void writeErr(final Exception ex, final String message, final Object... params) {
writeErr(message, params);
if (ex != null) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
try ( StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw) ) {
ex.printStackTrace(pw);
writeErr(sw.toString());
} catch (IOException e) {
writeErr("Error while printing stack trace.");
}
}
}