Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312139

Summary: No IJavaElementDelta for jar when removed from a WEB-INF/lib
Product: [WebTools] WTP Java EE Tools Reporter: Cameron Bateman <cameron.bateman>
Component: jst.j2eeAssignee: Jason Sholl <jsholl>
Status: VERIFIED INVALID QA Contact: Chuck Bridgham <cbridgha>
Severity: major    
Priority: P3 CC: cbridgha, ccc, raghunathan.srinivasan
Version: unspecified   
Target Milestone: 3.2 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 309488    

Description Cameron Bateman CLA 2010-05-07 19:34:39 EDT
If I copy a jar file into the WEB-INF/lib of a dynamic web project, I get the following IJavaElementDelta in the corresponding ElementChangedEvent:

org.eclipse.jdt.core.ElementChangedEvent[source=Java Model[*]: {CHILDREN}
	ContextParamTests[*]: {CHILDREN | RESOLVED CLASSPATH CHANGED}
		C:\dev\workspaces\runtime-New_configuration\ContextParamTests\WebContent\WEB-INF\lib\metainf-taglib.jar[*]: {ADDED TO CLASSPATH}]

When I then delete it, I would expect to get a similar event but with the "REMOVE FROM CLASSPATH" flag set.  This is what happens if I manually create a library on the project class path and then remove it.
Comment 1 Carl Anderson CLA 2010-05-10 09:20:51 EDT
Assigning to Jason for initial investigation.
Comment 2 Jason Sholl CLA 2010-05-10 13:39:02 EDT
I put a breakpoint in ElementChangedEvent to see what events are being generated.  Two events are created when I drop the jar; here are the deltas:

Java Model[*]: {CHILDREN}
	W[*]: {CONTENT}
		ResourceDelta(/W/WebContent)[*]

Java Model[*]: {CHILDREN}
	W[*]: {CHILDREN | RESOLVED CLASSPATH CHANGED}
		C:\dev\runtimeWorkspaces\WTP_32\W\WebContent\WEB-INF\lib\EJBSingleton.jar[*]: {CONTENT | ADDED TO CLASSPATH | ARCHIVE CONTENT CHANGED}

Then, when I delete the jar the following two event deltas are created:

Java Model[*]: {CHILDREN}
	W[*]: {CONTENT}
		ResourceDelta(/W/WebContent)[*]

Java Model[*]: {CHILDREN}
	W[*]: {RESOLVED CLASSPATH CHANGED}


I've also confirmed that the classpaths are being properly updated.  These classpath containers are set via JDT API, and any events that are fired are based on these classpath containers being set.  From the standpoint of the Web App Libraries classpath containre, this is all working as designed.  If the JDT events I'm seeing are not correct, please follow up directly with the JDT team.  There have been cases in the past where the Web App Libraries classpath container has exposed bugs in JDT, and this may be another one of those cases.
Comment 3 Cameron Bateman CLA 2010-05-12 14:27:44 EDT
It appears that this is the one:

Java Model[*]: {CHILDREN}
    W[*]: {CONTENT}
        ResourceDelta(/W/WebContent)[*]

The resource delta contains the removal of the library file so I key of that.  This appears to be the expected behavior, although it seems inconsistent to me.