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

Bug 348149

Summary: [client] fileClient service is not calling errBack when file copy or move fails
Product: [ECD] Orion Reporter: Susan McCourt <susan>
Component: ClientAssignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe
Version: 0.2Flags: susan: review+
Target Milestone: 0.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Fix v01 none

Description Susan McCourt CLA 2011-06-02 18:32:13 EDT
Try to move a file onto its own parent (which should trigger an error) by doing the following:

- From the navigator, select a file or folder
- choose More->Move to->Choose Folder
- select the current parent folder of the selected resource.  

There's no error shown in the UI.
The client code provides an errback but it is not getting invoked.

I can see in the console that the error case is detected at the server:
{"HttpCode":412,"Message":"Resource cannot be overwritten","Severity":"Error","Code":0}

But I don't think this is being propagated via the deferred errback.  When I stepped into the fileClient code, I saw that in _doServiceCall, the success function was being called (with a result of "undefined") rather than the error function.

fileService[funcName].apply(fileService, funcArgs).then(
   //on success, just forward the result to the client
   function(result) {
>>>>>>>     clientDeferred.callback(result);
   },
  //on failure we might need to retry
  function(error) {

It's possible the calling code is doing something wrong, but as best as I can tell, the problem is somewhere in the fileClient.
Comment 1 Susan McCourt CLA 2011-06-02 18:32:44 EDT
John, can you check this out?
Comment 2 Susan McCourt CLA 2011-06-07 11:15:15 EDT
marking RC1, it would be good to investigate this one if you have time...
Comment 3 John Arthorne CLA 2011-06-08 13:16:24 EDT
Created attachment 197623 [details]
Fix v01

This was just a dumb bug in the copy/move implementation. There is a helper method that implements copy/move that returns a promise. The functions that call the helper do *not* return the promise, but should. With this fix the error is being propagated to the UI for me.
Comment 4 Susan McCourt CLA 2011-06-08 16:05:17 EDT
+1.  (I had to clear the browser cache to actually see the change).
John and I discussed changing the error message to be more specific...
"A file or folder with the same name already exists at this location"
Comment 5 John Arthorne CLA 2011-06-08 17:13:52 EDT
Fixed.