Browse Source

NPE using XmlLogger and antlib

check if the value of the name attribute is not null
set the taskname of the antlib task
PR: 31840
Obtained from: Mariano Benitez


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276965 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 20 years ago
parent
commit
6515402721
3 changed files with 7 additions and 0 deletions
  1. +3
    -0
      WHATSNEW
  2. +3
    -0
      src/main/org/apache/tools/ant/XmlLogger.java
  3. +1
    -0
      src/main/org/apache/tools/ant/taskdefs/Antlib.java

+ 3
- 0
WHATSNEW View File

@@ -132,6 +132,9 @@ Fixed bugs:
* Concat task instance could not be run twice. * Concat task instance could not be run twice.
Bugzilla report 31814. Bugzilla report 31814.


* NPE using XmlLogger and antlib.
Bugzilla report 31840.

Changes from Ant 1.6.1 to Ant 1.6.2 Changes from Ant 1.6.1 to Ant 1.6.2
=================================== ===================================




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

@@ -291,6 +291,9 @@ public class XmlLogger implements BuildLogger {


Task task = event.getTask(); Task task = event.getTask();
String name = event.getTask().getTaskName(); String name = event.getTask().getTaskName();
if (name == null) {
name = "";
}
taskElement.element.setAttribute(NAME_ATTR, name); taskElement.element.setAttribute(NAME_ATTR, name);
taskElement.element.setAttribute(LOCATION_ATTR, taskElement.element.setAttribute(LOCATION_ATTR,
event.getTask().getLocation().toString()); event.getTask().getLocation().toString());


+ 1
- 0
src/main/org/apache/tools/ant/taskdefs/Antlib.java View File

@@ -82,6 +82,7 @@ public class Antlib extends Task implements TaskContainer {
Antlib antlib = new Antlib(); Antlib antlib = new Antlib();
antlib.setProject(project); antlib.setProject(project);
antlib.setLocation(ue.getLocation()); antlib.setLocation(ue.getLocation());
antlib.setTaskName("antlib");
antlib.init(); antlib.init();
ue.configure(antlib); ue.configure(antlib);
return antlib; return antlib;


Loading…
Cancel
Save