Community
Participate
Working Groups
When copying a file that starts with $, the file is created in the new folder, but it's contents are not copied. When copying a file that has $ in the name, but not at the beginning I get a NPE. !ENTRY org.eclipse.core.jobs 4 2 2007-05-22 10:42:22.800 !MESSAGE An internal error occurred during: "Transfer Operation". !STACK 0 java.lang.NullPointerException at org.eclipse.rse.ui.messages.SystemMessageDialog.<init>(SystemMessageDialog.java:168) at org.eclipse.rse.ui.messages.SystemMessageDialog.displayErrorMessage(SystemMessageDialog.java:625) at org.eclipse.rse.ui.messages.SystemMessageDialog.displayMessage(SystemMessageDialog.java:674) at org.eclipse.rse.internal.files.ui.view.SystemViewRemoteFileAdapter.doDrop(SystemViewRemoteFileAdapter.java:1998) at org.eclipse.rse.internal.ui.view.SystemDNDTransferRunnable.transferRSEResources(SystemDNDTransferRunnable.java:251) at org.eclipse.rse.internal.ui.view.SystemDNDTransferRunnable.runInWorkspace(SystemDNDTransferRunnable.java:572) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Steps to Reproduce: Create 2 new files and name them a$.txt and $a.txt. Add some text to the files and save them. Create a new folder. Copy and paste one file at a time to the new folder. -----------Enter bugs above this line----------- TM 2.0M7 Testing installation : eclipse-SDK-3.3M7 RSE install : 2.0M7 java.runtime : Sun 1.5.0_11-b03 os.name: : Windows XP, Service Pack 2 ------------------------------------------------
I'll look at this.
$ is considered a special char by the LocalFileService which is not correct on a Windows platform. Moreover, reserved shell charactes should be escaped with ^ instead of \ on Windows. This is what MSDN says: "all reserved shell characters not in double quotes must be escaped. These characters have special meaning to the Windows NT command shell. The reserved shell characters are: & | ( ) < > ^ To pass reserved shell characters as part of an argument for a command, either the entire argument must be enclosed in double quotes, or the reserved character must be escaped." Both source and target arguments are enclosed with double quotes in LocalFileService#copy(), so there is no need to escape them if we are running on Windows. I will propose a patch.
Created attachment 89357 [details] there is no need to escape special chars on Windows if the arguments are enclosed with double quotes
Created attachment 89388 [details] A better patch (in line with dstore CopyThread) Thanks for finding the problem, it helped me come up with a different patch. Since we're using the same functionality for the dstore-Windows server I checked what we're doing there (find it in org.eclipse.rse.services.dstore /miners/ org.eclipse.rse.internal.dstore.universal.miners.filesystem/ CopyThread.java there, we are using an enQuote() method taking care of the windows/unix differences, and using PathUtility.enQuoteUnix() for the UNIX enquoting. Using that code, I was able to accomplish the same but getting rid of a quite a bit of unnecessary code.
Patch tested and committed.
Verified fixed in I20080213-1800.
*** Bug 168220 has been marked as a duplicate of this bug. ***