Hi!
I am not sure how it happened, but one of our users has an event with an rrule (extracted from the DB) set to "FREQ=MONTHLY;BYDAY=;BYSETPOS=7;UNTIL=20221207T225 959Z".
I believe this is an invalid rrule (empty BYDAY). On our instance, we only have CalDAV enabled, so this event was added either via CalDAV, when receiving a mail or via the web interface.
This invalid rrule is triggering exceptions on the server when trying to export it or when trying to fetch it via CalDAV.
Here is the exception when trying to export it:
```
java.lang.NumberFormatException: For input string: "BYSETP"
at java.lang.NumberFormatException.forInputString(Num berFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at net.fortuna.ical4j.util.Numbers.parseInt(Numbers.j ava:63)
at net.fortuna.ical4j.model.WeekDay.<init>(WeekDay.ja va:98)
at net.fortuna.ical4j.model.WeekDayList.<init>(WeekDa yList.java:76)
at net.fortuna.ical4j.model.Recur.<init>(Recur.java:2 30)
at net.fortuna.ical4j.model.property.RRule.setValue(R Rule.java:112)
at com.openexchange.chronos.ical.ical4j.mapping.ICalT extMapping.export(ICalTextMapping.java:99)
at com.openexchange.chronos.ical.ical4j.mapping.ICalM apper.exportEvent(ICalMapper.java:104)
at com.openexchange.chronos.ical.impl.CalendarExportI mpl.exportEvent(CalendarExportImpl.java:232)
at com.openexchange.chronos.ical.impl.CalendarExportI mpl.add(CalendarExportImpl.java:167)
at com.openexchange.importexport.exporters.ical.Abstr actICalEventExporter.exportChronosEvents(AbstractI CalEventExporter.java:116)
at com.openexchange.importexport.exporters.ical.ICalC ompositeEventExporter.exportBatchData(ICalComposit eEventExporter.java:138)
at com.openexchange.importexport.exporters.ical.Abstr actICalExporter.getExportDataSource(AbstractICalEx porter.java:170)
at com.openexchange.importexport.exporters.ical.Abstr actICalExporter.exportData(AbstractICalExporter.ja va:137)
at com.openexchange.importexport.exporters.ICalExport er.exportBatchData(ICalExporter.java:136)
at com.openexchange.importexport.actions.exporter.Abs tractExportAction.perform(AbstractExportAction.jav a:92)
at com.openexchange.importexport.actions.exporter.Abs tractExportAction.perform(AbstractExportAction.jav a:72)
at com.openexchange.ajax.requesthandler.DefaultDispat cher.doCallAction(DefaultDispatcher.java:662)
at com.openexchange.ajax.requesthandler.DefaultDispat cher.callAction(DefaultDispatcher.java:638)
at com.openexchange.ajax.requesthandler.DefaultDispat cher.doPerform(DefaultDispatcher.java:606)
at com.openexchange.ajax.requesthandler.DefaultDispat cher.perform(DefaultDispatcher.java:275)
at com.openexchange.ajax.requesthandler.DispatcherSer vlet.handle(DispatcherServlet.java:482)
at com.openexchange.ajax.requesthandler.DispatcherSer vlet.doPost(DispatcherServlet.java:385)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:706)
at com.openexchange.ajax.AJAXServlet.doService(AJAXSe rvlet.java:577)
```
Which makes sense somehow looking at `public Recur(final String aValue)` in `net.fortuna.ical4j/src/net/fortuna/ical4j/model/Recur.java`. With a ` StringTokenizer(aValue, ";=")`, when `BYDAY` is matched, `WeekDayList` is called with `BYSETPOS` which clearly is not a valid day.
This sounds like two bugs to me:
- Some missing validation somewhere
- A relatively weak parser in Recur, with an uncaught exception
I'll try to see if I can identify how that even was created (which validation fails) & reproduce from scratch.
Please let me know if there is any way of identifying that...
Thanks in advance,
Vincent
I am not sure how it happened, but one of our users has an event with an rrule (extracted from the DB) set to "FREQ=MONTHLY;BYDAY=;BYSETPOS=7;UNTIL=20221207T225 959Z".
I believe this is an invalid rrule (empty BYDAY). On our instance, we only have CalDAV enabled, so this event was added either via CalDAV, when receiving a mail or via the web interface.
This invalid rrule is triggering exceptions on the server when trying to export it or when trying to fetch it via CalDAV.
Here is the exception when trying to export it:
```
java.lang.NumberFormatException: For input string: "BYSETP"
at java.lang.NumberFormatException.forInputString(Num berFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at net.fortuna.ical4j.util.Numbers.parseInt(Numbers.j ava:63)
at net.fortuna.ical4j.model.WeekDay.<init>(WeekDay.ja va:98)
at net.fortuna.ical4j.model.WeekDayList.<init>(WeekDa yList.java:76)
at net.fortuna.ical4j.model.Recur.<init>(Recur.java:2 30)
at net.fortuna.ical4j.model.property.RRule.setValue(R Rule.java:112)
at com.openexchange.chronos.ical.ical4j.mapping.ICalT extMapping.export(ICalTextMapping.java:99)
at com.openexchange.chronos.ical.ical4j.mapping.ICalM apper.exportEvent(ICalMapper.java:104)
at com.openexchange.chronos.ical.impl.CalendarExportI mpl.exportEvent(CalendarExportImpl.java:232)
at com.openexchange.chronos.ical.impl.CalendarExportI mpl.add(CalendarExportImpl.java:167)
at com.openexchange.importexport.exporters.ical.Abstr actICalEventExporter.exportChronosEvents(AbstractI CalEventExporter.java:116)
at com.openexchange.importexport.exporters.ical.ICalC ompositeEventExporter.exportBatchData(ICalComposit eEventExporter.java:138)
at com.openexchange.importexport.exporters.ical.Abstr actICalExporter.getExportDataSource(AbstractICalEx porter.java:170)
at com.openexchange.importexport.exporters.ical.Abstr actICalExporter.exportData(AbstractICalExporter.ja va:137)
at com.openexchange.importexport.exporters.ICalExport er.exportBatchData(ICalExporter.java:136)
at com.openexchange.importexport.actions.exporter.Abs tractExportAction.perform(AbstractExportAction.jav a:92)
at com.openexchange.importexport.actions.exporter.Abs tractExportAction.perform(AbstractExportAction.jav a:72)
at com.openexchange.ajax.requesthandler.DefaultDispat cher.doCallAction(DefaultDispatcher.java:662)
at com.openexchange.ajax.requesthandler.DefaultDispat cher.callAction(DefaultDispatcher.java:638)
at com.openexchange.ajax.requesthandler.DefaultDispat cher.doPerform(DefaultDispatcher.java:606)
at com.openexchange.ajax.requesthandler.DefaultDispat cher.perform(DefaultDispatcher.java:275)
at com.openexchange.ajax.requesthandler.DispatcherSer vlet.handle(DispatcherServlet.java:482)
at com.openexchange.ajax.requesthandler.DispatcherSer vlet.doPost(DispatcherServlet.java:385)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:706)
at com.openexchange.ajax.AJAXServlet.doService(AJAXSe rvlet.java:577)
```
Which makes sense somehow looking at `public Recur(final String aValue)` in `net.fortuna.ical4j/src/net/fortuna/ical4j/model/Recur.java`. With a ` StringTokenizer(aValue, ";=")`, when `BYDAY` is matched, `WeekDayList` is called with `BYSETPOS` which clearly is not a valid day.
This sounds like two bugs to me:
- Some missing validation somewhere
- A relatively weak parser in Recur, with an uncaught exception
I'll try to see if I can identify how that even was created (which validation fails) & reproduce from scratch.
Please let me know if there is any way of identifying that...
Thanks in advance,
Vincent