Browse Source

#38056: NPE when using presetdef under obscure circumstances.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@359329 13f79535-47bb-0310-9956-ffa450edef68
master
Jesse N. Glick 19 years ago
parent
commit
7917d87521
4 changed files with 17 additions and 3 deletions
  1. +2
    -1
      WHATSNEW
  2. +9
    -0
      src/etc/testcases/taskdefs/presetdef.xml
  3. +2
    -2
      src/main/org/apache/tools/ant/UnknownElement.java
  4. +4
    -0
      src/testcases/org/apache/tools/ant/taskdefs/PreSetDefTest.java

+ 2
- 1
WHATSNEW View File

@@ -67,7 +67,8 @@ Changes that could break older environments:

Fixed bugs:
-----------
* Some potential NullPointerExceptions, Bugzilla Report 37765

* Some potential NullPointerExceptions, Bugzilla Reports 37765 and 38056

* Problem when adding multiple filter files, Bugzilla Report 37341



+ 9
- 0
src/etc/testcases/taskdefs/presetdef.xml View File

@@ -118,4 +118,13 @@
</javac>
</target>

<target name="presetdef-with-nested-element-twice">
<copy todir=".">
<fileset dir="." includes="nonexistent"/>
</copy>
<presetdef name="copy">
<copy verbose="true"/>
</presetdef>
</target>

</project>

+ 2
- 2
src/main/org/apache/tools/ant/UnknownElement.java View File

@@ -41,7 +41,7 @@ public class UnknownElement extends Task {
/**
* Holds the namespace of the element.
*/
private String namespace;
private String namespace = "";

/**
* Holds the namespace qname of the element.
@@ -111,7 +111,7 @@ public class UnknownElement extends Task {
getProject());
namespace = helper.getCurrentAntlibUri();
}
this.namespace = namespace;
this.namespace = namespace == null ? "" : namespace;
}

/** Return the qname of the XML element associated with this component.


+ 4
- 0
src/testcases/org/apache/tools/ant/taskdefs/PreSetDefTest.java View File

@@ -80,6 +80,10 @@ public class PreSetDefTest extends BuildFileTest {
"correct_taskname_badel", "element message", "javac doesn't support the");
}
public void testPresetdefWithNestedElementTwice() { // #38056
executeTarget("presetdef-with-nested-element-twice");
executeTarget("presetdef-with-nested-element-twice");
}
/**
* A test class to check default properties


Loading…
Cancel
Save