Skip to content

[ical4j 4.x] Update event validators#210

Open
ArnyminerZ wants to merge 8 commits intoical4j-3to4from
189-ical4j-4x-update-event-validators
Open

[ical4j 4.x] Update event validators#210
ArnyminerZ wants to merge 8 commits intoical4j-3to4from
189-ical4j-4x-update-event-validators

Conversation

@ArnyminerZ
Copy link
Member

@ArnyminerZ ArnyminerZ commented Mar 6, 2026

  • Refactor preprocessCalendar and applyRules in ICalPreprocessor to new syntax.
  • Removed the UTC validation rule since it's removed, and no longer needed after the migration to the new Java API.

ArnyminerZ and others added 4 commits March 2, 2026 12:52
* Handle empty timezones

Signed-off-by: Arnau Mora <arnyminerz@proton.me>

* Just check for empty timezones

Signed-off-by: Arnau Mora <arnyminerz@proton.me>

* Add clarifying comment

Signed-off-by: Arnau Mora <arnyminerz@proton.me>

---------

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
* Update minSdkVersion

* - Replace deprecated `closeCompat()` with standard `close()`
- Remove compatibility method `closeCompat()` from `MiscUtils`

---------

Co-authored-by: cketti <ck@cketti.de>
…update-event-validators

# Conflicts:
#	lib/src/main/kotlin/at/bitfire/ical4android/AndroidCompatTimeZoneRegistry.kt
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ self-assigned this Mar 6, 2026
@ArnyminerZ ArnyminerZ marked this pull request as draft March 6, 2026 10:04
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ changed the title 189 ical4j 4x update event validators [ical4j 4.x] Update event validators Mar 6, 2026
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ marked this pull request as ready for review March 6, 2026 10:26
@ArnyminerZ ArnyminerZ requested review from cketti and sunkup and removed request for sunkup March 6, 2026 10:26

private val propertyRules = arrayOf(
TODO("ical4j 4.x"),
//CreatedPropertyRule(), // make sure CREATED is UTC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreatedPropertyRule was removed from ical4j 4.x. But it looks like we could use ChangeManagementPropertyValidators.CREATED instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we did have this rule. According to ical4j (I don't remember where I saw it) this was like this to make sure the parsing went well. With the migration to Java 8 APIs, parsing can go well even if the created dates are not UTC.

Maybe @rfc2822 has other reasons why to keep it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a problem with unparsable DTSTAMP that was not a UTC timestamp once: bitfireAT/ical4android#34

And I think the CreatedPropertyRule fixed the same type of problem for CREATED.

However ical4j 4.x doesn't have problems with theses cases:

@Test
    fun testDtstampWithTimezone() {
        val iCal = "BEGIN:VCALENDAR\n" +
                "BEGIN:VEVENT\n" +
                "DTSTART:16010101T020000\n" +
                "SUMMARY:Test\n" +
                "DTSTAMP;VALUE=DATE-TIME:20220331T084614\n" +
                "CREATED;VALUE=DATE-TIME:20220331T084614\n" +
                "END:VEVENT\n" +
                "END:VCALENDAR\n"
        val cal = CalendarBuilder().build(StringReader(iCal))
        val e = cal.getComponent<VEvent>(Component.VEVENT).get()
        assertEquals("20220331T084614Z", e.dateTimeStamp.value)
        assertEquals("20220331T084614Z", e.created.value)
    }

So I think it's fine to remove that rule.

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants