DTSTART parsing in android calendar

383 views
Skip to first unread message

Roberto Polli

unread,
Feb 24, 2012, 12:15:33 AM2/24/12
to cald...@googlegroups.com, Sudheer Peddireddy


Il giorno 23/feb/2012 07:53, "Tobias Rodehutskors" <trodeh...@googlemail.com> ha scritto:
>
> Hi!
>
> I have found the caldav4j project and i want to use it to sync my
> android
> phone with my ownCloud instance. But there is a problem.
>
> Some of my events use the following DTSTART format in the ics file:
>
> DTSTART;VALUE=DATE:20081025
>
> This is allowed in order to the rfc.
>
> But caldav4j can only parse the following DTSTART format:
>
> DTSTART:20090302T090000Z
>
>
> I have found this issue by looking at the log cat output:
>
> 02-22 21:07:16.377: W/System.err(24328):
> java.lang.StringIndexOutOfBoundsException
> 02-22 21:07:16.377: W/System.err(24328):        at
> java.lang.String.substring(String.java:1651)
> 02-22 21:07:16.377: W/System.err(24328):        at
> com.android.calendar.caldav.CalDAVService.parseDateTimeToMillis(CalDAVService.java:
> 560)
>
>
> The source code in
> http://code.google.com/p/caldav4j/source/browse/android/src/com/android/calendar/caldav/CalDAVService.java
> is this:
>
>    private long parseDateTimeToMillis (String date, String tzid) {
>        GregorianCalendar cal = new
> GregorianCalendar(Integer.parseInt(date.substring(0, 4)),
>                Integer.parseInt(date.substring(4, 6)) - 1,
> Integer.parseInt(date.substring(6, 8)),
>                Integer.parseInt(date.substring(9, 11)),
> Integer.parseInt(date.substring(11, 13)),
>                Integer.parseInt(date.substring(13, 15)));
>        TimeZone tz = TimeZone.getTimeZone (tzid);
>        cal.setTimeZone(tz);
>        return cal.getTimeInMillis ();
>    }
>
> The same problem will arise for DTEND.
>
> Do you have any kind of workaround for this problem? For example a
> converter
> which converts the first format into the second one for an ics file?
>
> regards, Tobias
>
> --
> You received this message because you are subscribed to the Google Groups "caldav4j" group.
> To post to this group, send email to cald...@googlegroups.com.
> To unsubscribe from this group, send email to caldav4j+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/caldav4j?hl=en.
>

Reply all
Reply to author
Forward
0 new messages