From 6aa0a70ff793a6d40e7463c528b98f6ac064b22a Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Sun, 5 Feb 2012 07:30:49 +0000 Subject: [PATCH] make sure Project#createTask has read defaults.properties. PR 50788 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1240669 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 6 ++- .../org/apache/tools/ant/ComponentHelper.java | 8 +++ src/tests/antunit/core/createtask-test.xml | 50 +++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 src/tests/antunit/core/createtask-test.xml diff --git a/WHATSNEW b/WHATSNEW index 566586809..f82e28fb5 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -123,7 +123,11 @@ Fixed bugs: fields rather than UTF-8 filenames and the EFS-Flag. * Access to DirectoryScanner's default excludes wasn't synchronized. - BigZilla Report 52188. + Bugzilla Report 52188. + + * When a Project instance was created by a custom tasks its + createTask method didn't work. + Bugzilla Report 50788. Other changes: -------------- diff --git a/src/main/org/apache/tools/ant/ComponentHelper.java b/src/main/org/apache/tools/ant/ComponentHelper.java index 368a3b125..ad32faf63 100644 --- a/src/main/org/apache/tools/ant/ComponentHelper.java +++ b/src/main/org/apache/tools/ant/ComponentHelper.java @@ -855,6 +855,14 @@ public class ComponentHelper { return; // Already processed } checkedNamespaces.add(uri); + + if (antTypeTable.size() == 0) { + // Project instance doesn't know the tasks and types + // defined in defaults.properties, likely created by the + // user - without those definitions it cannot parse antlib + // files as taskdef, typedef and friends are unknown + initDefaultDefinitions(); + } Typedef definer = new Typedef(); definer.setProject(project); definer.init(); diff --git a/src/tests/antunit/core/createtask-test.xml b/src/tests/antunit/core/createtask-test.xml new file mode 100644 index 000000000..b69633b30 --- /dev/null +++ b/src/tests/antunit/core/createtask-test.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + +