Simple-Calendar icon indicating copy to clipboard operation
Simple-Calendar copied to clipboard

java.lang.NumberFormatException: For input string "...

Open m01 opened this issue 3 years ago • 2 comments

TL;DR: an issue with my data caused an odd error message that was slightly tricky to debug.

Also, thank you for creating Simple Calendar!

Symptom

I ran into the following error toast while syncing one of my calendars, similar to https://github.com/SimpleMobileTools/Simple-Calendar/issues/1107:

Error: java.lang.NumberFormatException:
For input string: "1
FREQ"

Analysis

Thankfully the content gave a clue about this being a yearly event, and I managed to narrow it down to being caused by my "birthdays" calendar. Beyond that, this was quite difficult to debug, as there is no event information or similar in the toast, and I could not find anything relevant in adb logcat either.

In the end I compiled the app from source (thank you for publishing the source code!), debugged it and set a breakpoint on any java.lang.NumberFormatException. The stacktrace was something similar to:

parseInt:615, Integer (java.lang)
parseInt:650, Integer (java.lang)
parseRepeatInterval:64, Parser (com.simplemobiletools.calendar.pro.helpers)
fetchCalDAVCalendarEvents:228, CalDAVHelper (com.simplemobiletools.calendar.pro.helpers)
refreshCalendars:49, CalDAVHelper (com.simplemobiletools.calendar.pro.helpers)
invoke:572, MainActivity$refreshCalDAVCalendars$1 (com.simplemobiletools.calendar.pro.activities)
invoke:571, MainActivity$refreshCalDAVCalendars$1 (com.simplemobiletools.calendar.pro.activities)
invoke:61, SimpleActivity$calDAVSyncObserver$1$onChange$1$1 (com.simplemobiletools.calendar.pro.activities)
invoke:59, SimpleActivity$calDAVSyncObserver$1$onChange$1$1 (com.simplemobiletools.calendar.pro.activities)
ensureBackgroundThread$lambda-0:382, ConstantsKt (com.simplemobiletools.commons.helpers)
$r8$lambda$ukHVGNDmwl8QsD9hCK7IQG-Hwww:-1, ConstantsKt (com.simplemobiletools.commons.helpers)
run:-1, ConstantsKt$$ExternalSyntheticLambda0 (com.simplemobiletools.commons.helpers)
run:923, Thread (java.lang)

(line numbers could be offset by a few lines due to me having attempted to add logging statements).

And the issue was caused in parseRepeatInterval in the line:

                if (value.split(",").any { it.toInt() == -1 }) {

Due to the .ics event containing something like (2, 1 are example values):

RRULE:FREQ=YEARLY;BYMONTHDAY=2;BYMONTH=1
RRULE:FREQ=YEARLY;BYMONTHDAY=2;BYMONTH=1

fullString contained the above just without the RRULE:.

Notes

To resolve this, I edited the source ics data and remove the extraneous RRULE.

I thought to post this, because:

  • This might be related to https://github.com/SimpleMobileTools/Simple-Calendar/issues/1107
  • If anyone else runs into this error, perhaps they'll find this and maybe it'll help them.
  • In general, I think it would be helpful if event-specific error messages included some reference to the event to facilitate debugging, or if these were accessible via some other means (log, some in-app list of troublesome events or similar).

However, please feel free to close/delete this issue if it's not useful. Ultimately it was an issue with my data.

m01 avatar Aug 19 '22 23:08 m01

What app version are you using?

tibbi avatar Aug 20 '22 12:08 tibbi

Simple Calendar Pro from the Play Store. I debugged it using the FDroid debug build target.

m01 avatar Aug 21 '22 11:08 m01

I have the same problem but could not find the event which causes it.

KN4CK3R avatar Sep 24 '22 12:09 KN4CK3R

Same issue here, i think this has been an issue for a long time now. Below the screenshot. 2022-10-25_01

Do you know what could be causing it? PS: caldav works from other calendar apps.

est61 avatar Oct 25 '22 06:10 est61

---- 25 Oct 2022 09:03:49 ----

10-25 08:37:26.542  1094  2357 W NotificationService: Toast already killed. pkg=com.simplemobiletools.calendar.pro callback=android.app.ITransientNotification$Stub$Proxy@a845f8d

10-25 08:54:59.833  1094  1256 I ActivityManager: Killing 7891:com.simplemobiletools.calendar.pro/u0a276 (adj 925): remove task

10-25 08:54:59.862  1094  1574 W InputDispatcher: channel '16b02e0 com.simplemobiletools.calendar.pro/com.simplemobiletools.calendar.pro.activities.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9

10-25 08:54:59.862  1094  1574 E InputDispatcher: channel '16b02e0 com.simplemobiletools.calendar.pro/com.simplemobiletools.calendar.pro.activities.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

10-25 08:54:59.862  1094  1612 I WindowManager: WIN DEATH: Window{16b02e0 u0 com.simplemobiletools.calendar.pro/com.simplemobiletools.calendar.pro.activities.MainActivity}

10-25 08:54:59.862  1094  1612 W InputDispatcher: Attempted to unregister already unregistered input channel '16b02e0 com.simplemobiletools.calendar.pro/com.simplemobiletools.calendar.pro.activities.MainActivity (server)'

10-25 08:55:48.135  1094 10020 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.simplemobiletools.calendar.pro/.activities.SplashActivity.Orange bnds=[859,1267][1033,1469]} from uid 10215

10-25 08:55:48.186  1094  1303 I ActivityManager: Start proc 13091:com.simplemobiletools.calendar.pro/u0a276 for pre-top-activity {com.simplemobiletools.calendar.pro/com.simplemobiletools.calendar.pro.activities.SplashActivity.Orange}

10-25 08:55:48.237  1094  8979 I ActivityTaskManager: START u0 {cmp=com.simplemobiletools.calendar.pro/.activities.MainActivity} from uid 10276

10-25 08:55:48.435  1094  1299 I ActivityTaskManager: Displayed com.simplemobiletools.calendar.pro/.activities.MainActivity: +296ms

10-25 08:55:48.675   951   951 E Layer   : [Surface(name=AppWindowToken{414750a token=Token{340175 ActivityRecord{1dfa0ac u0 com.simplemobiletools.calendar.pro/.activities.SplashActivity.Orange t5692}}})/@0x635fc29 - animation-leash#0] No local sync point found

10-25 08:55:53.724 13091 13091 I chatty  : uid=10276(com.simplemobiletools.calendar.pro) identical 2 lines

10-25 08:55:58.285  1094  6504 W NotificationService: Toast already killed. pkg=com.simplemobiletools.calendar.pro callback=android.app.ITransientNotification$Stub$Proxy@6919cb2

10-25 08:57:51.502  1094  8979 W NotificationService: Toast already killed. pkg=com.simplemobiletools.calendar.pro callback=android.app.ITransientNotification$Stub$Proxy@5a010ef

10-25 09:01:11.829   951   951 E Layer   : [Surface(name=AppWindowToken{38f4f6b token=Token{3c34ba ActivityRecord{f0931e5 u0 com.simplemobiletools.calendar.pro/.activities.MainActivity t5692}}})/@0x5324173 - animation-leash#0] No local sync point found

10-25 09:01:19.145  1094  8983 W NotificationService: Toast already killed. pkg=com.simplemobiletools.calendar.pro callback=android.app.ITransientNotification$Stub$Proxy@2966861

10-25 09:03:14.453   951   951 E Layer   : [Surface(name=AppWindowToken{38f4f6b token=Token{3c34ba ActivityRecord{f0931e5 u0 com.simplemobiletools.calendar.pro/.activities.MainActivity t5692}}})/@0x5324173 - animation-leash#0] No local sync point found

10-25 09:03:21.840  1094  8976 W NotificationService: Toast already killed. pkg=com.simplemobiletools.calendar.pro callback=android.app.ITransientNotification$Stub$Proxy@414c5c2

---- 25 Oct 2022 09:03:49 ----

This is the only logs i can see from the app from LogcatX whenever i refresh the calendar. Unfortunately i cannot find the calendar entry that causes this issue. The thing is, none of my calendar entries have any funny chars or anything like that. So im not sure whats causing the issue.

est61 avatar Oct 25 '22 07:10 est61

try exporting the calendar in an .ics file, then search for 25. Maybe an event that repeats every 25 days or so?

tibbi avatar Oct 25 '22 07:10 tibbi

try exporting the calendar in an .ics file, then search for 25. Maybe an event that repeats every 25 days or so?

ok so i just did this, i couldnt see anything out of the ordinary. However i couldnt find one of my entries in the ics. I tried removing one of the offending entries and refreshed the calendar, everything refreshed, then i re-entered in the same entry and couldnt reproduce the issue again. Is there any way you know that i can reproduce the same issue?

est61 avatar Oct 25 '22 10:10 est61

The error occurs every time in your ics file are multiple lines beginning with FREQ. So find that event and edit/delete it with another app.

KN4CK3R avatar Oct 25 '22 12:10 KN4CK3R

Yes i did so, like i said, i deleted it and i was able to refresh with no errors, then i re-created the same entry without issues. The funny thing is other calendars were not reporting this type of issue. At some point this might happen again, of which i will have my eye on now and see if it can be reproduced in future. thanks

est61 avatar Oct 25 '22 14:10 est61

A quick fix could be to just use the first line if the input has multiple lines:

- val parts = fullString.split(";").filter { it.isNotEmpty() }
+ val parts = fullString.split("\n")[0].split(";").filter { it.isNotEmpty() }

KN4CK3R avatar Oct 25 '22 15:10 KN4CK3R

I think there is the same error on my device!

Details and screenshot will follow, not able to post that in this moment.

INFORMATION ADDED NOW:

When adding new events in the simple-calendar app, that item was displayed, but after some seconds, it disappeared!! Although these freshly items are then visible in other CALDAV consumers like etar app or Thunderbird!

And I got that toast error message:

java.lang.NumberFormatException:
For input string:"2
FREQ"

I saved my CALDAV calendars via Thunderbird as ics-files, and had a closer look with a text editor. Some strange content I found is delivered in the following quote which is my shortened ics file. (I have NO idea whether that is valid ICS syntax or why that lines are structured like that if it is invalid or corrupted data!)

After deleting that repeating event completely in my CALDAV calendar via Thunderbird, all added events of the last past days re-appeared in simple-calendar!!!!!

@tibbi Is it possible to make SimpleCalendar a bit more robust against cases like that?

BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
VERSION:2.0
BEGIN:VEVENT
CREATED:20220121T164055Z
LAST-MODIFIED:20230207T202747Z
DTSTAMP:20230207T202747Z
UID:c6e621c6-323d-4c19-bcf2-f46a9fcb71f5
SUMMARY:abc-xyz
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
RRULE:FREQ=WEEKLY;INTERVAL=2
X-MOZ-LASTACK:20230204T155132Z
DTSTART;VALUE=DATE:20220318
DTEND;VALUE=DATE:20220319
CLASS:PUBLIC
SEQUENCE:2
TRANSP:TRANSPARENT
X-MOZ-GENERATION:65
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:PT0S
DESCRIPTION:abc-xyz
END:VALARM
END:VEVENT
END:VCALENDAR

stephan75 avatar Feb 07 '23 14:02 stephan75

I have the same problem ☹️

rol1 avatar May 06 '23 20:05 rol1

@rol1

I have the same problem frowning_face

Can you examine your ics file in a text editor?

When there's anything weird in it, can you shorten a copy of that file, anonymize all personal data, and quote it here?

stephan75 avatar May 07 '23 06:05 stephan75

I'll see if I can find the event. But it will take some time.

Mit freundlichem Gruß Yours sincerely

Roland Schmitz

Am 7. Mai 2023 06:37:03 UTC schrieb stephan75 @.***>:

@rol1

I have the same problem frowning_face

Can you examine your ics file in a text editor?

When there's anything weird in it, can you shorten a copy of that file, anonymize all personal data, and quote it here?

-- Reply to this email directly or view it on GitHub: https://github.com/SimpleMobileTools/Simple-Calendar/issues/1810#issuecomment-1537332895 You are receiving this because you were mentioned.

Message ID: @.***>

rol1 avatar May 07 '23 08:05 rol1

I haven't found any calendar entry with two "RRULE:FREQ..." lines :-(

rol1 avatar May 08 '23 07:05 rol1

I use 4 calendars. Two of them are local on my phone, two are synced via caldav with a server. Mayby I was looking in the wrong calendar this morning. Is there a way to distinguish which calendar is causing troubble?

rol1 avatar May 08 '23 12:05 rol1

Till now I only looked at the calendars on my phone. Having a look at the server I found this:

BEGIN:VEVENT CREATED:20230320T071918Z LAST-MODIFIED:20230508T061132Z DTSTAMP:20230508T061132Z UID:ee90d0e0-f721-4f80-b095-15bc6ba1334d SUMMARY:Kiri Baum gießen STATUS:CONFIRMED RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 RRULE:FREQ=DAILY;COUNT=5;INTERVAL=4 X-MOZ-LASTACK:20230411T063711Z DTSTART;TZID=Europe/Berlin:20230322T170000 DTEND;TZID=Europe/Berlin:20230322T173000 CLASS:PUBLIC SEQUENCE:1 X-MOZ-GENERATION:56 BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM BEGIN:VALARM ACTION:DISPLAY TRIGGER:-PT15M DESCRIPTION:Kiri Baum gießen END:VALARM END:VEVENT

rol1 avatar May 08 '23 12:05 rol1

After deleting this event on the server, my cell phone syncs and does not show the error any more.

rol1 avatar May 08 '23 12:05 rol1