SufficientlySecure / calendar-import-export

Import/export your Android calendars as ics files without using the Google cloud
https://www.schuermann.eu/android/
GNU General Public License v3.0
80 stars 26 forks source link

Attempt to invoke virtual method crash when exporting #97

Open voyteke opened 2 years ago

voyteke commented 2 years ago

When trying to export my calendar with around 1842 events, around half way through export applications crashes with

Error: Attempt to invoke virtual method ‘long java util get Time()' on a null object‘ reference

I guess I have some 'bad' record? How to resolve this?

That's on Chuwi tablet, just tried same calendar on Moto phone:

Same calendar shows 1765 records, not sure why different record count, also crashes with

Attempt to invoke virtual method ‘long net.fortuna,ical4.model.date.getTime()' on a null object‘ reference

fhaftmann commented 2 years ago

This is very likely a deficiency in the export code.

Can you provide me with a minimal example? Usually it can be obtained by bisecting the calendar, i. e. dividing it in two roughly half parts, see which of those exposes the problem, and then continuing.

voyteke commented 2 years ago

Sure, ahem, how do I divide it, sorry, not sure how to do this..? 53% and 939/1788 it's more or less last values I think I see before the crash

fhaftmann commented 2 years ago

You have to edit (a copy of) the bare file.

The details can be found e.g. at https://en.wikipedia.org/wiki/ICalendar – the core idea is that events are grouped between BEGIN:VEVENT and END:VEVENT lines, hence it is not that difficult to delete them.

Due to your 939/1788 hint, it might also be feasible to delete everything except e.g. entries 935 - 945 and see what happens.

voyteke commented 2 years ago

sorry, I should've figured that out, but, didn't try before... OK, I've split at around 30,000/20,000 lines, copied both files to mobile, I then Load the file, is that it ? I get 1640 entries in first half, I thought I should be able to Export that file.. ? I get option to Insert or Delete ? sorry, not sure ... or am I meant to send/upload that to you ? or do I make a new calendar, import into that, then, export ?

fhaftmann commented 2 years ago

The goal is to find out which entry makes problems.

Of course you would be free to send me the entire calendar file, but this would expose a lot of private data (possibly not only yours). Hence my proposal to aim for a minimal problematic calendar file, which in turn can be easily stripped of any personal data.

Following your description, it seems that the first half does not provoke any error. What about the second file? In my expectation it should, which would mean that the critical entry was part of it. After that identification, you can continue with the splitting until a calendar file with a single entry is reached, which should be the case after approx. 11 steps.

fhaftmann commented 2 years ago

During the course of writing, I had a thought that maybe I did not understand your problem right.

You are talking about exporting an existing calendar on your mobile, not importing an ical file into an calendar?

If that is the case, we have to devise a different approach.

But first lets make sure we have the same understanding here.

voyteke commented 2 years ago

yes, I'm attempting to EXPORT my calendar, so I may 'process' work records from my calendar in a s/s or the like

fhaftmann commented 2 years ago

OK, then my technical description was definitely misleading.

What is the technical representation of your calendar? A remote calendar hosted by a service provider?

Then we are faced with the difficulty how to get to a reproducible example then.

Does your service provider allow to duplicate your calendar? Then this could be used to get iteratively to a minimal example.

Once we have a minimal example, tinkering with the different options of the event could exhibit where the problem is.

(Sorry if this sounds very vague, but I can only extrapolate what is going on as long as I have no reproducible example to get hands on.)

voyteke commented 2 years ago

I'm using just standard consumer grade free Google calendar, with entries keyed in or copy/pasted from emails or web scrapes, is this what you're asking? I noticed when I web scrape it often ends including html stuff, I'm guessing something for saved? that's causes that's error? I've came across a website that let's me export to CSV, which let's me do what I need, though i thought if I can do my export on my own, it would be good. I guess there is no way to export just a sub part of entries?

fhaftmann commented 2 years ago

The error is very likely caused by a field in an event containing unexpected (not necessarily »wrong«) data.

There is no way to export a subset of the entries, unfortunately.

Does Google offer the option to duplicate a calendar? This would open space for analysis.