From dca0b63f0b0869f77ff0b8264f35a8bdaf3d3533 Mon Sep 17 00:00:00 2001 From: James Perkins Date: Fri, 19 Jan 2018 09:22:13 -0800 Subject: [PATCH] [LOGMGR-185] Handle a possible null value being passed to the ConsoleHandler.setTarget(). --- .../java/org/jboss/logmanager/handlers/ConsoleHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/logmanager/handlers/ConsoleHandler.java b/src/main/java/org/jboss/logmanager/handlers/ConsoleHandler.java index 05bf8aba..41b79e8c 100644 --- a/src/main/java/org/jboss/logmanager/handlers/ConsoleHandler.java +++ b/src/main/java/org/jboss/logmanager/handlers/ConsoleHandler.java @@ -108,7 +108,8 @@ public ConsoleHandler(final Target target, final Formatter formatter) { * @param target the target to write to, or {@code null} to clear the target */ public void setTarget(Target target) { - switch (target) { + final Target t = (target == null ? console == null ? Target.SYSTEM_OUT : Target.CONSOLE : target); + switch (t) { case SYSTEM_OUT: setOutputStream(wrap(out)); break; case SYSTEM_ERR: setOutputStream(wrap(err)); break; case CONSOLE: setWriter(wrap(console)); break;