Closed Bug 449573 Opened 15 years ago Closed 15 years ago

Deleting item/items from local ics file fails with MODIFICATION_FAILED, items missing

Categories

(Calendar :: Calendar Frontend, defect)

Mozilla 1.8 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aryx, Assigned: gekacheka)

Details

Attachments

(3 files, 1 obsolete file)

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17pre) Gecko/20080806 Calendar/0.9pre

Deleting item/items from local ics file fails with MODIFICATION_FAILED, I see at least one event in the unifinder which isn't shown in the calendar pane.


Error: [Exception... "'<error>' when calling method: [calICalendar::deleteItem]"  nsresult: "0x804a0002 (<unknown>)"  location: "JS frame :: file:///F:/Software/Buero/Kalender/Sunbird/Branch/components/calItemModule.js -> file:///F:/Software/Buero/Kalender/Sunbird/Branch/js/calTransactionManager.js :: cT_doTransaction :: line 182"  data: no]
Source File: file:///F:/Software/Buero/Kalender/Sunbird/Branch/components/calItemModule.js -> file:///F:/Software/Buero/Kalender/Sunbird/Branch/js/calTransactionManager.js
Line: 182
WFM. Could you please add STR?
Attached file test calendar (obsolete) —
Ok, the problem already existed in June, but there was no error message present.

STR:
1. Create new profile.
2. Open calendar.
3. Sort unifinder by start date & time.
4. Filter events, they should contain "Olympia".
5. Delete all from the first to the event before "RBB - Schätze der Welt - Erbe der Menschheit" on August 15th.

The actual build will have its problem here.

Older builds (i.e. Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17pre) Gecko/20080719 Calendar/0.9pre) will fail on a second try. STR:
6. Result: The RBB item has gone, but you hadn't selected it. If you now select the first to the last event starting on August 22 and delete them, the error will be shown now.

Hint: If you clear the filter after the first delete and retype it, the RBB again will show up again, so the wrong event has been removed from Unifinder view on deleting.

Older builds still have this issue.
archaeopteryx: I checked this issue with Sunbird and lightning, but I can't reproduce this bug. Maybe a STR is missing?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17pre) Gecko/20080814 Calendar/0.9pre

Still can reproduce it with the STRs.
What does the error console dump?
Warning: There has been an error reading data for calendar: testcase. It has been placed in read-only mode, since changes to this calendar will likely result in data-loss.  You may change this setting by choosing 'Edit Calendar'. Error code: 0x80004005. Description: ID is null or is from different calendar in deleteItem

Warning: An error occurred when writing to the calendar testcase! Error code: MODIFICATION_FAILED. Description: 

Warning: There has been an error reading data for calendar: testcase. Error code: 0x80004005. Description: ID is null or is from different calendar in deleteItem
Takes a long time, but with STR from comment #2, I can reproduce the issue; needs investigation.
Flags: blocking-calendar0.9+
(In reply to comment #2)
> Created an attachment (id=332725) [details]
> test calendar

Note: The previous test calendar appears not to conform to rfc2445, though this is not the cause of the problem.
* There are carriage returns in DESCRIPTION fields.  Looks like whatever produced this file received descriptions with several CR LF line endings in them, and converted only the LF to '\' 'n' rather than the entire CR LF (see rfc2445sec4.3.11 TEXT).  
* Lines are not wrapped to 75 octects (rfc2445sec4.1 Content lines)
* There are blank lines between VEVENTs.  Blank lines are not allowed by the rfc2445 grammar.

I removed the extra carriage returns and blank lines and was still
able to reproduce the error.
Attachment #332725 - Attachment is obsolete: true
(In reply to comment #2)
> STR:
> 1. Create new profile.
> 2. Open calendar.
> 3. Sort unifinder by start date & time.
> 4. Filter events, they should contain "Olympia".
> 5. Delete all from the first to the event before "RBB - Schätze der Welt -
> Erbe der Menschheit" on August 15th.

For step 5, after I selected the range of events in the list, for me it seems
to depend on how I trigger the delete.
  Keyboard delete key           --> ERRORs
  Unifinder context menu delete --> no error
  Toolbar delete button         --> no error

Another way to trigger the error is to click the toolbar delete button
twice in step 5.  (The delete button is still enabled after the first click).

So diagnosed two problems:
1: keyboard delete key triggers delete command twice
2. items are still internally selected even though
   they have been deleted.

Below are stack traces for the two ways pressing the delete key calls
deleteSelectedEvents in Sunbird (problem 1).

--------------------
deleteSelectedEvents()@chrome://calendar/content/calendar-views.js:638
unifinderKeyPress([object KeyboardEvent])@chrome://calendar/content/calendar-unifinder.js:372
onkeypress([object KeyboardEvent])@chrome://calendar/content/calendar.xul:1
@:0
--------------------
deleteSelectedEvents()@chrome://calendar/content/calendar-views.js:638
cC_doCommand("calendar_delete_event_command")@chrome://calendar/content/calendar-common-sets.js:228
doCommand("calendar_delete_event_command")@:0
("calendar_delete_event_command")@chrome://global/content/globalOverlay.js:156
goDoCommand("calendar_delete_event_command")@chrome://global/content/globalOverlay.js:215
oncommand([object XULCommandEvent])@chrome://calendar/content/calendar.xul:1
@:0
(patch -l -p 1 -i file.patch)

I hope this is the right way to clear the selection in this context.  It seems to work, the test case no longer produces errors.
Attachment #334181 - Flags: review?(philipp)
(patch -l -p 1 -i file.patch)

This prevents the handled key events from propagating and triggering a default oncommand handler.  Result is deleteSelectedItems is only called once.
Assignee: nobody → gekacheka
Status: NEW → ASSIGNED
Attachment #334182 - Flags: review?(philipp)
Whiteboard: [patch in hand] [needs review]
Attachment #334182 - Flags: review?(philipp) → review+
Comment on attachment 334181 [details] [diff] [review]
patch for problem 2: modify deleteSelectedEvents to clear selection

r=philipp
Attachment #334181 - Flags: review?(philipp) → review+
Both patches checked in on HEAD and MOZILLA_1_8_BRANCH

-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
OS: Windows XP → All
Hardware: PC → All
Resolution: --- → FIXED
Whiteboard: [patch in hand] [needs review]
Target Milestone: --- → 0.9
Same problem when I try IMPORT a .ics file to Sunbird 0.9 using calDAV google account.

I see this in error console:
Error: Error to change Renato S. Yamane calendar! Error code: MODIFICATION_FAILED.

Description:
source-file: file:///home/yamane/sunbird/components/calItemModule.js -> file:///home/yamane/sunbird/js/calCalendarManager.js
Line: 952

Running over Debian Lenny 32bits.
You need to log in before you can comment on or make changes to this bug.