Author: jkf
Date: Thu Feb  2 12:08:32 2006
New Revision: 374482

URL: http://svn.apache.org/viewcvs?rev=374482&view=rev
Log:
38458 removed log implementation of Task to allow logging from tasks outside a 
project. The base class has the logging behaviour we need. This does not 
guarantee that (all) tasks are working outside an project, but at least will 
not break just because of logging.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
    ant/core/trunk/src/main/org/apache/tools/ant/Task.java

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/WHATSNEW?rev=374482&r1=374481&r2=374482&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Feb  2 12:08:32 2006
@@ -4,6 +4,9 @@
 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.
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java?rev=374482&r1=374481&r2=374482&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java Thu Feb  
2 12:08:32 2006
@@ -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 @@
      *                 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 ).

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Task.java
URL: 
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/Task.java?rev=374482&r1=374481&r2=374482&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Task.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Task.java Thu Feb  2 12:08:32 
2006
@@ -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.
@@ -333,18 +333,6 @@
      */
     public void log(String msg) {
         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 <code>null</code>.
-     * @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);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to