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 @@ + + + + + + + + + + + + + + + + + + + + + + + +