Community
Participate
Working Groups
Build Identifier: 3.6.2 - M20110105-0951 Our Java EE team created a classpath container for web project, when adding a JAR file to the folder, I can get a JarPackageFragmentRoot is added event with "F_ADDED_TO_CLASSPATH" flag, but when removing it from the same location, I didn't get a similar JarPackageFragmentRoot is removed with "F_REMOVED_FROM_CLASSPATH" event. Reproducible: Always Steps to Reproduce: 1. Creating a classpath container by using JavaCore.setClasspathContainer(...) API. 2. 3.
Jay, please investigate.
The difference between a user library and a web container is in the way libraries get added or removed. In case of user libraries, the user removes the library from the project's build path, in which case, it's very likely that the removed JAR is still physically present. However, in the case of a web container, libraries get added/removed from the resolved classpath by the container. The container is responsible for picking up all the (remaining) JARs from the WEB-INF/lib and updating the classpath. And in this case, the JARs that get removed from the classpath doesn't exist in the file system any longer. Which results in package fragment root being null and hence delta not being reported for individual JAR files. I will see if we can get the roots from the cache and report the delta based on that.
Created attachment 189778 [details] Proposed fix Benson, can you try this patch and confirm if this addresses your concern, while I am trying to add a regression test. Thanks. Some of the existing tests may need to be updated as well.
Thanks Jay for making the changes, Kim, could you please to give it a try? Thanks
Jay, I tried out your fix and it looks good.
(In reply to comment #5) > Jay, I tried out your fix and it looks good. Thanks, Kim. I will release the fix after adding some tests.
Created attachment 190490 [details] Regression test This regression test fails and shows that the fix may not be good enough. This can't go into M6.
Created attachment 191378 [details] Fix + Updated tests This patch contains the same fix verified by Kim. However, no new tests have been added. Instead I have used one of the failing test that closely resembles the scenario described by Benson. To verify, one must add WST plug-ins and create a dynamic web project.
Olivier, can you spare some time to review this, please?
Looks good to me.
Released in HEAD for 3.7 M7.
Verified by reporter.