Error while import .ics file, in calIICSService.parseICS



13 years ago
13 years ago


(Reporter: ssitter, Assigned: shaver)


Windows 2000



(2 attachments)



13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b5) Gecko/20050923 Firefox/1.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050923 Mozilla Sunbird/0.2+

I have several calendar file generated and edited with Sunbird 0.2.
When I try to import some of the .ics files into Sunbird 0.2+ I get an error in
JavaScript Console. Other .ics files works fine.

Reproducible: Always

Steps to Reproduce:
1. Import events from attached file Mondphasen.ics into Sunbird 0.2+

Actual Results:  
Events are not imported. Error in message in JavaScript Console and Alert popup:

Error: [Exception... 
"Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) 
[calIICSService.parseICS]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  
location: "JS frame :: file:///D:/sunbird/components/calIcsImportExport.js 
                    :: ics_importFromStream :: line 75"  data: no]
Source File: file:///D:/sunbird/components/calIcsImportExport.js
Line: 75

Expected Results:  
Events are imported and displayed in current calendar.

ics file generated and edited with:
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a5) Gecko/20050203 Mozilla

Import fails on: 
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050923 Mozilla

Comment 1

13 years ago
Created attachment 197250 [details]


13 years ago
Attachment #197250 - Attachment description: test file → Test file
Attachment #197250 - Attachment mime type: application/octet-stream → text/plain


13 years ago
Attachment #197250 - Attachment description: Test file → Mondphasen.ics

Comment 2

13 years ago
1. I haven't been able to reproduce the javascript error message with 20050924
on w2k.  Are you sure this file created the error?

2. The file seems to have \n line ends instead of \r\n line ends required by
Did it have \n or \r\n line ends before you uploaded it?

3. The file events are defined with duration (DURATION:P1D) and have no end
dates (DTEND).  Sunbird always creates events with end dates (DTEND), so these
events were not originally created in Sunbird.  If I may ask, which program
created these events?

3a: The events appear in the event list only with filter "All Events".
The events do not appear if any date filter is used.

3b: The events do not appear in any grid view (day/week/multiweek/month), which
also filter by date.

3c: The end date defaults to 0 UTC (1970-01-01, which appears as 1969-12-31 in
timezones west of UTC).

I suspect Sunbird currently uses the end date, and not the duration, to
calculate whether the event overlaps the view time interval. 

So there are several possible bugs here, which may need to be separated into
separate bug reports.  3 might be important for interoperability.  From the
PRODID and UIDs it looks like the events might have been generated by the server
at, which currently appears to be aimed at Apple iCal
users.  Does Apple iCal permit users to create events with a duration instead of
an end date?

Comment 3

13 years ago
Yes, the local file has only \n as line ends. Error occurs also if I convert to

You are right. I downloaded the .ics file originally at and saved to my harddisk. Then I created a new
calendar in Sunbird 0.2 using the existing file.

I can reproduce the error just now with the following steps:

1. Create calendar at (I selected the
checkboxes "Vollmond" and "Neumond", unselected all other checkboxes and pressed
button "Abonnieren" to download .ics file)

2. Import downloaded .ics file into SB 0.2+ (20050924, zip) --> error

3. Create a new local calendar in SB 0.2 (20050203). Import downloaded .ics file
--> no error, events are displayed fine

4. Import the .ics file created with SB 0.2 in step 3 into SB 0.2+ (20050924)
--> error

Comment 4

13 years ago
Confirming.  Now the original file no longer works for me, still with the w32
20050924 build, and now I do get the reported error alert and js console error.
 (Strange...I even tried setting the time back, but it still fails.)

I have not been able to isolate any part of the file.
I was able reduce the file down to 51 events, removing any additional event made
it parse again this time.

(A wild guess: related to memory allocation?  Maybe it is getting different
sized blocks from the OS, or in different locations?  That could explain why it
behaves differently now than it did for me earlier, and why it might behave
differently on different computers.)

Changing title, was "Error while import .ics file generated with Sunbird 0.2"
now "Error while import .ics file, in calIICSService.parseICS"
Ever confirmed: true
Summary: Error while import .ics file generated with Sunbird 0.2 → Error while import .ics file, in calIICSService.parseICS
Version: unspecified → Trunk
Created attachment 197444 [details] [diff] [review]
keep on reading

The string that the convertorstream returns isn't complete. Repeated calls to
readstring fixes this.
Patch also cleans up an unneeded creation of a scriptable input stream.

This patch doesn't fix the other issue the test ics shows: events without a
dtend but with a duration are not handled correctly. Need to file a new bug for
Attachment #197444 - Flags: first-review?(dmose)
the duration part of the problem is filed in bug 310221

Comment 7

13 years ago
Patch seems to work, but in general to accumulate a string, instead of 

  var tempStr = {};
  var str = "";
  while (convStream.readString(-1, tmpStr)) {
    str += tmpStr.value;

maybe something like

  var part = {};
  var parts = [];
  while (convStream.readString(-1, part)) {
  var str = parts.join("");

to avoid repeatedly copying earlier parts of str.
(In this case it doesn't make a big difference because the storage providers
seems to be doing the same thing, copying the entire file over for each added
event as in bug 187177 comment 13, but someday hopefully that will be fixed.)
Comment on attachment 197444 [details] [diff] [review]
keep on reading

r=dmose.  I'm not sure whether JS really copies in the case that gekacheka
points out or if it supports fragmented strings.  What we really need for
performance, though, as mvl has pointed out previously, is something that
slurps ICS objects directly off of a stream.
Attachment #197444 - Flags: first-review?(dmose) → first-review+
patch checked in.
(the original one. I think that code is slightly more readable, and the
performance hit won't be that big. And it isn't in a critical code path either)
Last Resolved: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.