From 398f4559cfea8a38fb4a20b2536bdeb2e8b8bdee Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Sun, 7 Apr 2019 00:23:48 -0700 Subject: [PATCH] Reverted to the old way of redirecting stderr and stdout. The try-resource method was closing the stream. --- src/main/java/net/thauvin/erik/mobibot/Mobibot.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/thauvin/erik/mobibot/Mobibot.java b/src/main/java/net/thauvin/erik/mobibot/Mobibot.java index 56bc199..36dd86d 100644 --- a/src/main/java/net/thauvin/erik/mobibot/Mobibot.java +++ b/src/main/java/net/thauvin/erik/mobibot/Mobibot.java @@ -335,8 +335,9 @@ public class Mobibot extends PircBot { // Redirect the stdout and stderr if (!line.hasOption(Commands.DEBUG_ARG.charAt(0))) { - try (final PrintStream stdout = new PrintStream(new FileOutputStream( - logsDir + channel.substring(1) + '.' + Utils.today() + ".log", true))) { + try { + final PrintStream stdout = new PrintStream(new FileOutputStream( + logsDir + channel.substring(1) + '.' + Utils.today() + ".log", true)); System.setOut(stdout); } catch (IOException e) { System.err.println("Unable to open output (stdout) log file."); @@ -344,9 +345,9 @@ public class Mobibot extends PircBot { System.exit(1); } - - try (final PrintStream stderr = new PrintStream( - new FileOutputStream(logsDir + nickname + ".err", true))) { + try { + final PrintStream stderr = new PrintStream( + new FileOutputStream(logsDir + nickname + ".err", true)); System.setErr(stderr); } catch (IOException e) { System.err.println("Unable to open error (stderr) log file.");