bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

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

VERIFIED WORKSFORME

Status

Calendar
Provider: WCAP
VERIFIED WORKSFORME
11 years ago
10 years ago

People

(Reporter: Chris, Unassigned)

Tracking

Details

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.8.1.13pre) 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) {
        listener.onOperationComplete(this_.superCalendar,
                                     getResultCode(err),
                                     calIOperationListener.GET,
                                     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

Comment 1

11 years ago
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?
(Reporter)

Comment 2

11 years ago
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 ?

Comment 3

11 years ago
Please try a more recent nightly than RC1, e.g. from <http://ftp.mozilla.org/pub/mozilla.org/calendar/lightning/nightly/latest-mozilla1.8/>.
(Reporter)

Comment 4

11 years ago
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.

Comment 5

11 years ago
Per comment #4 fixed with bug 422412 => WFM.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 422412

Updated

11 years ago
Resolution: DUPLICATE → WORKSFORME

Updated

10 years ago
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.