Bug 240408 - FileResourcesUtils.makeFile doesn't handle IResourceStatus.CASE_VARIANT_EXISTS
Summary: FileResourcesUtils.makeFile doesn't handle IResourceStatus.CASE_VARIANT_EXISTS
Status: CLOSED FIXED
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: jst.ws (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Peter Moogk CLA
QA Contact: Kathy Chan CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-07-10 16:51 EDT by Raymond Lai CLA
Modified: 2009-04-22 16:17 EDT (History)
0 users

See Also:


Attachments
proposed patch (20.07 KB, patch)
2008-07-11 17:25 EDT, Raymond Lai CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raymond Lai CLA 2008-07-10 16:51:39 EDT
In a case-insensitive platform like Windows, IFile.exists() only checks the existence with exact case. FileResourcesUtils.makeFile() will create a new file even if a file with the same name but different case exists. So we get a CoreException with IResourceStatus.CASE_VARIANT_EXISTS. makeFile() needs to handle that and overwrites the file with the same name but different case. I will attach a patch later.
Comment 1 Raymond Lai CLA 2008-07-11 17:25:02 EDT
Created attachment 107240 [details]
proposed patch

This proposed patch changes the FileResourceUtils.makeFile in org.eclipse.wst.command.env and org.eclipse.wst.common.environment. 

The new logic is like this:
if the file doesn't not exist
   try 
      create the file
      return the file
   catch IResourceStatus.CASE_VARIANT_EXISTS CoreException
      find the existing file with a variant case
      reset file name to the name of the existing file


When this point is reached, it means we have an existing file that we need to overwrite. Just overwrite the file using the original logic.
Comment 2 Raymond Lai CLA 2008-07-11 17:51:29 EDT
Tests that have been done on Windows using adopter runtime: 
1. Existing WSDL file with a different case - passed
2. Existing WSDL file with the same case - passed
3. Non existing WSDL file - passed

Tests to be run:
4. Existing WSDL file locked by notepad - ?
5. Repeat with other DD file like webservices.xml or java files.

Tests haven't been run on linux yet.

The above tests exercise the changes in org.eclipse.wst.common.internal.environment.eclipse.FileResourceUtils.

The same set of tests need to be run using the AXIS runtime to test the changes in org.eclipse.wst.command.internal.env.common.FileResourceUtils.
Comment 3 Kathy Chan CLA 2008-07-14 09:51:46 EDT
Peter,

Could you please review the patch from Raymond and take over the testing of this patch on Linux?  Thanks!
Comment 4 Kathy Chan CLA 2008-07-16 18:47:17 EDT
Patch reviewed and tested by Peter.  It had been committed and released as v200807161459.
Comment 5 Kathy Chan CLA 2008-10-27 14:18:14 EDT
This defect has been in resolve state for a while.  Please verify this with the appropriate WTP driver which can be found in:

http://download.eclipse.org/webtools/downloads/

We would verify and close the defect on the originator's behalf if it has not been verified 2 weeks after it's been changed to Verified state.
Comment 6 Kathy Chan CLA 2009-02-11 21:56:13 EST
This bug has been in resolved state for a while.  Please verify this defect with the latest WTP 3.0.4 or WTP 3.5 build from:

http://download.eclipse.org/webtools/downloads/

If this is not verified within 2 weeks, we'll be verifying the bug on your behalf.  Thanks!
Comment 7 Raymond Lai CLA 2009-04-22 16:17:19 EDT
closed