Browse Source

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.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@374482 13f79535-47bb-0310-9956-ffa450edef68
master
Jacobus Martinus Kruithof 19 years ago
parent
commit
9a988bb81b
3 changed files with 7 additions and 16 deletions
  1. +3
    -0
      WHATSNEW
  2. +3
    -3
      src/main/org/apache/tools/ant/ProjectComponent.java
  3. +1
    -13
      src/main/org/apache/tools/ant/Task.java

+ 3
- 0
WHATSNEW View File

@@ -4,6 +4,9 @@ Changes from current Ant 1.6.5 version to current RCS version
Changes that could break older environments: 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 * Use alternative names for the command line arguments in javac. Bugzilla
Report 37546. Report 37546.




+ 3
- 3
src/main/org/apache/tools/ant/ProjectComponent.java View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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. * to be logged.
*/ */
public void log(String msg, int msgLevel) { public void log(String msg, int msgLevel) {
if (project != null) {
project.log(msg, msgLevel);
if (getProject() != null) {
getProject().log(msg, msgLevel);
} else { } else {
// 'reasonable' default, if the component is used without // 'reasonable' default, if the component is used without
// a Project ( for example as a standalone Bean ). // a Project ( for example as a standalone Bean ).


+ 1
- 13
src/main/org/apache/tools/ant/Task.java View File

@@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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); 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);
}

/** /**
* Performs this task if it's still valid, or gets a replacement * Performs this task if it's still valid, or gets a replacement
* version and performs that otherwise. * version and performs that otherwise.


Loading…
Cancel
Save