ical4j: java.lang.ExceptionInInitializerError on Samsung Devices with Android 5.x

It seems that ical4j version 2.0.0 causes the following crash on Samsung devices with Android 5.x.x, it is related to the ServiceLoader usage. Ideas?

Fatal Exception: java.lang.ExceptionInInitializerError
       at net.fortuna.ical4j.model.Calendar.(SourceFile)
       at net.fortuna.ical4j.model.Calendar.(SourceFile)
       at net.fortuna.ical4j.data.CalendarBuilder$ContentHandlerImpl.startCalendar(SourceFile:307)
       at net.fortuna.ical4j.data.CalendarParserImpl.parse(SourceFile:119)
       at net.fortuna.ical4j.data.CalendarBuilder.build(SourceFile:198)
       at net.fortuna.ical4j.data.CalendarBuilder.build(SourceFile:178)
       at net.fortuna.ical4j.data.CalendarBuilder.build(SourceFile:165)
       ...
Caused by java.util.NoSuchElementException
       at java.util.ServiceLoader$ServiceIterator.next(ServiceLoader.java:210)
       at net.fortuna.ical4j.validate.AbstractCalendarValidatorFactory.(SourceFile)
       at net.fortuna.ical4j.model.Calendar.(SourceFile)
       at net.fortuna.ical4j.model.Calendar.(SourceFile)
       at net.fortuna.ical4j.data.CalendarBuilder$ContentHandlerImpl.startCalendar(SourceFile:307)
       at net.fortuna.ical4j.data.CalendarParserImpl.parse(SourceFile:119)
       at net.fortuna.ical4j.data.CalendarBuilder.build(SourceFile:198)
       at net.fortuna.ical4j.data.CalendarBuilder.build(SourceFile:178)
       at net.fortuna.ical4j.data.CalendarBuilder.build(SourceFile:165)
       ...

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

The reason that 1.0.7 isn’t affected is that it doesn’t use service loader to loader the factories. It appears service loader is the problem so we’ll be looking to replace it completely to resolve this issue.

That does sound weird, actually this is crashing on a production app with many daily users the reports only indicate Samsung devices with Android 5.X. I did manage to reproduce it myself on an Galaxy S4 with Android 5.0.1, is there something additional I can test for?