Closed Bug 423468 Opened 12 years ago Closed 12 years ago

Listener onOperationComplete() is not called in getItem() when an item cannot be found


(Calendar :: Provider: WCAP, defect)

Not set


(Not tracked)



(Reporter: chris, Unassigned)


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv: Gecko/20080201 Firefox/
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv: Gecko/20080305 Sunbird/0.8

If a getItem() is called with a particular id and the item no longer exists, an exception will be raised but onOperationComplete() will not be called with the error (code defined in function fetchTodosById_resp() in file calWcapCalendarItems()).
It would be necessary to add something like:

if (getResultCode(err) == calIWcapErrors.WCAP_FETCH_EVENTS_BY_ID_FAILED || getResultCode(err) == calIWcapErrors.WCAP_COMPONENT_NOT_FOUND)
    if (listener) {
                                     id, err);

Note also that the original code only treats WCAP_FETCH_EVENTS_BY_ID_FAILED. But is seems possible that the server returns WCAP_COMPONENT_NOT_FOUND.

This situation can be normal in case of synchronization where it can be necessary to try to access to an item that no longer exists on the server.

These two modifications (test of WCAP_COMPONENT_NOT_FOUND and call to onOperationComplete() are necessary for BirdieSync to synchronize properly.

Thanks a lot for your help. Let me know if you need more information.

Reproducible: Always

Steps to Reproduce:
Call getItem() with an id belonging to an item which no longer exists.
Actual Results:  
listener onOperationComplete() is not called with an error.

Expected Results:  
listener onOperationComplete() should be called with an error
Chris, I tried to confirm this, but I can't. I tested it with an iTIP invitation (there's code that uses getItem() to check whether the item is already present). I get into the mentioned path with an error, i.e. it works for me. Could you please assure you are on latest lightning?
Daniel, I did again some tests with Sunbird 0.8 RC1 and had the same problem. Would the code be different from Lightning one ? If I create a simple event (not recurring) and then delete it, if I try to access to it with getItem(), the server returns a calIWcapErrors.WCAP_COMPONENT_NOT_FOUND error (0x804a023b). Then onOperationComplete() is not called on the listener which was passed in getItem().
I tried to add calIWcapErrors.WCAP_COMPONENT_NOT_FOUND to the special treatment for WCAP_FETCH_EVENTS_BY_ID_FAILED but it's not enough (this special case seems to check if the item would be a todo instead of an event). I have to add an additional call to onOperationComplete() before the exception is thrown.
But maybe I missed something ?
You are right. I tried a more recent build and the problem seems to be fixed. The treatment of calIWcapErrors.WCAP_COMPONENT_NOT_FOUND was added a few days ago when fixing bug 422412.
I suppose there was another modification for the onOperationComplete() problem because adding the calIWcapErrors.WCAP_COMPONENT_NOT_FOUND in RC1 was not enough.
Sorry for the waste of time.
Per comment #4 fixed with bug 422412 => WFM.
Closed: 12 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 422412
You need to log in before you can comment on or make changes to this bug.