Bug 34466 - [Readme]NPE in task when contributed via extension point
Summary: [Readme]NPE in task when contributed via extension point
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
: 35106 35153 49647 62623 105063 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-10 16:04 EST by Darin Wright CLA Friend
Modified: 2005-08-01 13:25 EDT (History)
7 users (show)

See Also:


Attachments
zip of plugin (1.58 KB, application/octet-stream)
2003-03-10 16:05 EST, Darin Wright CLA Friend
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA Friend 2003-03-10 16:04:12 EST
When I contribute the task defined in bug 34442 as an extension in a plug-in, 
the task generates an NPE when referenced at runtime. For some reason, 
it's "proejct" field is null. However, when I add the task (the same class) 
manually via the preferences, there is no NPE.

I will attach the plug-in
Comment 1 Darin Wright CLA Friend 2003-03-10 16:05:26 EST
Created attachment 3965 [details]
zip of plugin

The plug-in defines one task via the org.eclipse.ant.core.antTasks extension
point.
Comment 2 Darin Wright CLA Friend 2003-03-10 16:06:05 EST
At runimte, I get this output:

Buildfile: D:\testspaces\test-space\Car\date.xml

main:
        [date] Error in class Date
        [date] BUILD FAILED: file:D:/testspaces/test-space/Car/date.xml:3: 
java.lang.NullPointerException
Total time: 52 seconds

The build file is:

<project name="Task development" default="main">
	<target  name="main">
		<date></date>
	</target>
</project>
Comment 3 Eric Van Norman CLA Friend 2003-03-11 14:17:20 EST
I have moved up to RC2 and am seeing the same behaviour with our plugin's Ant 
tasks which extend via an extension point.

project is null
Comment 4 Darin Swanson CLA Friend 2003-03-11 14:29:02 EST
Eric, is this a regression within RC2, that is, it worked in previous builds of 
Eclipse?
Comment 5 Eric Van Norman CLA Friend 2003-03-11 14:59:47 EST
Yes, this is a regression.  I just verified by reloading RC1 and our plugins.  
They work fine there.

Eric VN
Comment 6 Darin Swanson CLA Friend 2003-03-11 15:02:27 EST
Thanks. Can you try one more thing if you have the time?
Can you try RC2 with Ant 1.5.1 set as Ant home (note you will need to remove 
the Xerces JARs from the Ant home install)?
No problem if you can't we will be looking into this more very soon.
Comment 7 Darin Swanson CLA Friend 2003-03-13 16:17:32 EST
This is a readme item.
The root of the problem is that the custom task is getting loaded via the 
plugin classloader instead of the Ant classloader.

From the work / changes on the Ant classloader required for:
bug 33664 and bug 33117
it has made more restrictive for developing using tasks defined via the 
extension points.
Key points:
when self hosting you have two options
    -add the org.eclipse.ant.core plugin as source to your workspace and add 
your custom task prefix to the list of prefixes defined in the static 
initializer. This will disallow the plugin classloader parents from loading the 
task.
    -do not have task class on the build path for the plugin

For generating your plugin, you must ensure that the class file for the custom 
Ant task is not included in the plugin library.

Eric can you verify that this is your case?
Comment 8 Darin Swanson CLA Friend 2003-03-16 14:29:06 EST
*** Bug 35106 has been marked as a duplicate of this bug. ***
Comment 9 Gary Karasiuk CLA Friend 2003-03-16 15:31:37 EST
The easiest work around for me, was to make sure that my build file
didn't include any of my ant task classes in my plugin's main jar file. 

This was easier then creating yet another project, just for the ant classes. 
Comment 10 Darin Swanson CLA Friend 2003-03-17 14:15:43 EST
*** Bug 35153 has been marked as a duplicate of this bug. ***
Comment 11 Darin Wright CLA Friend 2003-03-25 09:40:46 EST
Removing RC4, as this is will be a known limitation - no fix planned for 2.1
Comment 12 Darin Swanson CLA Friend 2003-03-26 11:28:45 EST
Added to the Eclipse readme for 2.1 in the known issues section for Ant.
Comment 13 Darin Swanson CLA Friend 2004-01-07 14:49:54 EST
*** Bug 49647 has been marked as a duplicate of this bug. ***
Comment 14 Darin Swanson CLA Friend 2004-05-18 11:20:38 EDT
*** Bug 62623 has been marked as a duplicate of this bug. ***
Comment 15 Darin Swanson CLA Friend 2005-08-01 13:25:05 EDT
*** Bug 105063 has been marked as a duplicate of this bug. ***