From 2d3188c5d2663c29f46ad7e0d865b185263a7ff5 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Fri, 12 Mar 2004 09:00:30 +0000 Subject: [PATCH] NPE while useing -listener for commons logger. There is a difference between using a -logger and -listener. The former may use a log file and the latter does not get this set. The commons logger code assumes that it is passed the log stream in both cases. The fix is just to initialize the out and err streams in the commons logger class. PR: 27373 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276225 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 2 ++ .../org/apache/tools/ant/listener/CommonsLoggingListener.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index a9114062e..5cf33cace 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -82,6 +82,8 @@ Fixed bugs: * regression from ant 1.5, exec task outputted two redundant trailing newlines. Bugzilla Report 27546. +* NPE when running commons listener. Bugzilla Report 27373. + Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java b/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java index 04bf808f5..6e6b33f71 100644 --- a/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java +++ b/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java @@ -279,8 +279,8 @@ public class CommonsLoggingListener implements BuildListener, BuildLogger { System.setErr(tmpErr); } - PrintStream out; - PrintStream err; + PrintStream out = System.out; + PrintStream err = System.err; public void setMessageOutputLevel(int level) { // Use the logger config