Closed Bug 309868 Opened 19 years ago Closed 19 years ago

Error while import .ics file, in calIICSService.parseICS

Categories

(Calendar :: Internal Components, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ssitter, Assigned: shaver)

Details

Attachments

(2 files)

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
Sunbird/0.2

Import fails on: 
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050923 Mozilla
Sunbird/0.2+
Attached file Mondphasen.ics —
Attachment #197250 - Attachment description: test file → Test file
Attachment #197250 - Attachment mime type: application/octet-stream → text/plain
Attachment #197250 - Attachment description: Test file → Mondphasen.ics
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
rfc2445.
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 http://www.project24.info/, 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?
Yes, the local file has only \n as line ends. Error occurs also if I convert to
\r\n.

You are right. I downloaded the .ics file originally at
http://www.project24.info/ 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 http://www.project24.info/feiertage.php (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
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"
Status: UNCONFIRMED → NEW
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
Attached patch keep on reading — — Splinter Review
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
that.
Attachment #197444 - Flags: first-review?(dmose)
the duration part of the problem is filed in bug 310221
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)) {
    parts.push(part.value);
  }
  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)
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: