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

Bug 168215

Summary: [local] drag&drop a file into a read-only file overwriting fails without notice
Product: [Tools] Target Management Reporter: Martin Oberhuber <mober.at+eclipse>
Component: RSEAssignee: David McKnight <dmcknigh>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3    
Version: 1.0   
Target Milestone: 2.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Martin Oberhuber CLA 2006-12-15 10:18:56 EST
On Windows-local, 
- create directories d1 and d2 below any folder
- create files d1\a.txt and d2\a.txt with contents "I am d1" and "I am d2"
- On the shell, do "attrib +r d1\a.txt"
- In RSE, drag&drop d2\a.txt into d1
- In the Conflict dialog, select overwrite

--> No error dialog is shown
--> On the shell do "type d1\a.txt" to see it still has the old contents

I believe that this has to do with the following exception I saw in the debugger -- looks like the DNDDelegate's "shell" field is null because it's running in a background thread:

java.lang.NullPointerException
	at org.eclipse.rse.ui.messages.SystemMessageDialog.<init>(SystemMessageDialog.java:167)
	at org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem.copy(FileServiceSubSystem.java:574)
	at org.eclipse.rse.files.ui.view.SystemViewRemoteFileAdapter.doDrop(SystemViewRemoteFileAdapter.java:1880)
	at org.eclipse.rse.ui.view.SystemDNDTransferRunnable.transferRSEResources(SystemDNDTransferRunnable.java:250)
	at org.eclipse.rse.ui.view.SystemDNDTransferRunnable.run(SystemDNDTransferRunnable.java:571)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

I would like to see the following fixes:
1.) SystemDNDTransferRunnable should not run into the NPE
2.) LocalFileService.copy() should forward error messages from Runtime.exec()
    into the RemoteFileException, just like UniversalFileSystemMiner.doCopy()
    does
3.) In case the target file of a copy is read-only, an additional confirmation
    dialog should be presented to the user. In case multiple source files
    were selected, the options should be "Yes", "No", "Yes for All", 
    "No for All", "Cancel"
4.) In case this dialog is answered with "yes, overwrite", the copy operation
    should overwrite, i.e. use the xcopy /R option


-----------Enter bugs above this line-----------
RSE 1.0.1 Release Test
installation : eclipse-SDK-3.2.1 + cdt-3.1.1 + emf-sdo-xsd-2.2.0
RSE install  : Download RSE-SDK-N20061215-0100
java.runtime : Sun 1.5.0_09-b03
os.name:     : Windows XP 5.1, Service Pack 1
------------------------------------------------
systemtype   : Windows-local, Dstore-win, Dstore-linux
targetos     : Red Hat Enterprise Linux WS release 4 (Nahant Update 3)
targetuname  : Linux parser 2.6.9-34.EL #1 i686 athlon i386 GNU/Linux
targetvm     : Sun Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)
------------------------------------------------
Comment 1 David McKnight CLA 2006-12-21 15:35:34 EST
This is partially fixed.   The null pointer exception no longer happens and a RemoteFileException gets passed back to be displayed in a message.  We're still missing a dialog to allow changing the permissions but this should wait until the IFileServer feature for changing permissions exists.
Comment 2 David McKnight CLA 2007-04-02 11:59:52 EDT
This is fixed.  I've opened the following enhancement (bug 180507) for the proposed dialog.
Comment 3 Martin Oberhuber CLA 2008-08-13 13:17:30 EDT
[target cleanup] 2.0 M6 was the original target milestone for this bug