This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 300510 - Republish removes the files from the server
Summary: Republish removes the files from the server
Status: RESOLVED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: wst.web (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: wst.web CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-22 11:12 EST by Alexander Kidd CLA
Modified: 2010-01-24 12:14 EST (History)
1 user (show)

See Also:


Attachments
patch (2.44 KB, patch)
2010-01-22 14:51 EST, Chuck Bridgham CLA
no flags Details | Diff
removed println (2.30 KB, patch)
2010-01-22 14:55 EST, Chuck Bridgham CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kidd CLA 2010-01-22 11:12:05 EST
Build Identifier: I20100119-0800

When republishing a project it gets removed from the server instead of updating the file.

Reproducible: Always

Steps to Reproduce:
1.Create a new dynamic web project and a jsp file.
2.Start a server and add the project to it. 
3.Make a change on the jsp file and run it on the server.
4.The server will say it republished but the web browser will return a 404 error.
5.Viewing the wtpwebapps/project folder shows no files in it anymore.
Comment 1 Angel Vera CLA 2010-01-22 11:22:52 EST
Not sure if this is affecting all server adapters yet, but for now I am increasing this to P2. 

Alex, can you try other server adapters, perhaps the J2EE preview?
Comment 2 Alexander Kidd CLA 2010-01-22 11:31:53 EST
Tomcat 6.0 was the adapter I used that caused the bug.
Tested J2EE preview and it works correctly.
(In reply to comment #1)
> Not sure if this is affecting all server adapters yet, but for now I am
> increasing this to P2. 
> 
> Alex, can you try other server adapters, perhaps the J2EE preview?
Comment 3 Alexander Kidd CLA 2010-01-22 11:48:22 EST
Same issue in Tomcat 5.5
As soon as you make a change to the jsp file on the server the project gets removed. So even trying to refresh the browser page without republishing or restarting the server shows a 404 error instead of the file before the changes.

HTTP Preview works.
Comment 4 Angel Vera CLA 2010-01-22 13:38:37 EST
The problem seems to be related to changes in the JEE side of things. 

During the Delta calculation we put the result of pm.members() in an array, we compare each resource already deployed with the list given back from pm.members(). As we move in the array to determine if the resource is ADDED, CHANGED, REMOVED, NO_CHANGE we remove elements from the array. 

This logic is failing, because the elements of pm.members do not .equal to be the same, thus the resources are being reported twice, as ADDED, and as REMOVED.
Comment 5 Chuck Bridgham CLA 2010-01-22 14:49:41 EST
we figured out it was a problem with the new instances of IModuleFile/IModuleFolder not implementing equals.....
Comment 6 Chuck Bridgham CLA 2010-01-22 14:51:45 EST
Created attachment 156985 [details]
patch

Adding equals() and hashcode()
Comment 7 Chuck Bridgham CLA 2010-01-22 14:55:29 EST
Created attachment 156988 [details]
removed println
Comment 8 Angel Vera CLA 2010-01-22 15:08:01 EST
I tested the patch attached and publishing is now working correctly. I tested adding and removing files and folders, and everything gets to the publishing directory.
Comment 9 Chuck Bridgham CLA 2010-01-24 12:14:19 EST
This is in the build