Community
Participate
Working Groups
Build Identifier: M20100909-0800 We have a web project with a custom structure. When adding a servlet via the servlet wizard, the content of the web.xml gets deleted (the existing servlet etries dissappear). As a result the new servlet class is created but there are no servlet entries inside. Reproducible: Always Steps to Reproduce: 1. import the attached web project 2. create a servlet via the servlet wizard
Created attachment 183537 [details] sample web project
I am assigning this to Kaloyan for the final triaging and/or fixing. The problem here comes in the setup of the web project- the setup within the project is as follows: webm\webContent\ webm\WEB-INF\ So in JEE5ModelProvider, it gets the root folder and appends the passed-in path to it. The passed-in path is \WEB-INF\web.xml . This is appended to the root folder, which is webm\webContent , and this yields webm\webContent\WEB-INF\web.xml, which does not exist. The interesting thing is that, going through the ResourceSet (which, in this case, is a ProjectResourceSetEditImpl), there is already a mapping from the bad URI, webm\webContent\WEB-INF\web.xml, to the good URI, webm\WEB-INF\web.xml, so when the file is "created" at the end of the AddServletOperation, the existing content is replaced by the default content. Thus, my assumption here is that JEE5ModelProvider.getModelResource() should be updated to see if the web.xml exists in the "correct" location (since, in the component file, WEB-INF has a different mapping than just being off of the project root.)
re-targeting for 3.3.2
Created attachment 209838 [details] patch proposed Use the virtual components API when accessing the DD. This way the DD can be accessed with custom project structure.
Chuck can you review the change? Basically the virtual components model is used to pinpoint the web.xml instead of taking the resource from the file system.
looks good - thanks - please add to HEAD too
Once the builds are declared I will commit it in HEAD and 3_3_maintenance
Q: Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. A: The bug causes a custom structured projects to lose data. Web.xml file content gets deleted, since the model does not load the file from the correct location. Instead an empty web.xml content is loaded. Q: Is there a work-around? If so, why do you believe the work-around is insufficient? A: There is no workaround. Q: How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? A: The fix has been tested manually with standard structure projects and the sample project given. Q: Give a brief technical overview. Who has reviewed this fix? A: The fix changes the way the web.xml is found, instead of trying to assemble the location from the file system, the location is taken from the virtual components model (where it is always under /WEB-INF/web.xml) Q: What is the risk associated with this fix? A: Low risk
committed and released in HEAD and 3_3_maintenance