diff --git a/WHATSNEW b/WHATSNEW index 9f5212f26..a8bb68085 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -4,6 +4,9 @@ Changes from current Ant 1.6.5 version to current RCS version Changes that could break older environments: -------------------------------------------- +* Task will now log correctly even if no project is set. + Bugzilla report 38458. + * Use alternative names for the command line arguments in javac. Bugzilla Report 37546. diff --git a/src/main/org/apache/tools/ant/ProjectComponent.java b/src/main/org/apache/tools/ant/ProjectComponent.java index ba5a3c9b2..71f192e18 100644 --- a/src/main/org/apache/tools/ant/ProjectComponent.java +++ b/src/main/org/apache/tools/ant/ProjectComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2004,2006 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,8 +75,8 @@ public abstract class ProjectComponent { * to be logged. */ public void log(String msg, int msgLevel) { - if (project != null) { - project.log(msg, msgLevel); + if (getProject() != null) { + getProject().log(msg, msgLevel); } else { // 'reasonable' default, if the component is used without // a Project ( for example as a standalone Bean ). diff --git a/src/main/org/apache/tools/ant/Task.java b/src/main/org/apache/tools/ant/Task.java index f275d0b64..8105c26df 100644 --- a/src/main/org/apache/tools/ant/Task.java +++ b/src/main/org/apache/tools/ant/Task.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2005 The Apache Software Foundation + * Copyright 2000-2006 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -335,18 +335,6 @@ public abstract class Task extends ProjectComponent { log(msg, Project.MSG_INFO); } - /** - * Logs a message with the given priority. This delegates - * the actual logging to the project. - * - * @param msg The message to be logged. Should not be null. - * @param msgLevel The message priority at which this message is to - * be logged. - */ - public void log(String msg, int msgLevel) { - getProject().log(this, msg, msgLevel); - } - /** * Performs this task if it's still valid, or gets a replacement * version and performs that otherwise.