Class ICSCalendarValidator
This helpful tool addresses synchronization issues between different calendar clients (OWA, Outlook, and Thunderbird via DavMail) where calendar entries containing invalid characters are handled differently across platforms. These problematic entries originate from the MS Exchange Server, where they were either stored with invalid characters or became corrupted during storage. While OWA and Outlook silently hide such entries without displaying them to users, Thunderbird logs XML parse errors in its error console. The validator provides detailed validation information about invalid characters and offers repair functionality to automatically remove problematic characters while preserving valid content.
The implementation was developed to address a specific issue where calendar entries containing invalid string content are hidden in OWA and Outlook, making them inaccessible for manual deletion or repair. Since these entries are not visible in OWA and Outlook, users cannot remove or fix them before synchronization to Thunderbird, where they cause XML parsing errors. The solution provides a way to detect and repair these problematic entries, which could otherwise be handled by DavMail during the synchronization process. The issue is documented in Bugzilla at ....
- Since:
- 2025-02-05 // yyyy-mm-dd
- Author:
- ifrh (GitHub), ifrh (SourceForge)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResult structure for validation results. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisValidICSContent(String content) Validates whether a string contains only valid characters for iCalendar content.static StringrepairICSContent(String content) Repairs an iCalendar string by removing invalid characters.validateWithDetails(String content) Returns detailed validation information about the content.
-
Field Details
-
LOGGER
protected static final org.apache.log4j.Logger LOGGER
-
-
Constructor Details
-
ICSCalendarValidator
public ICSCalendarValidator()
-
-
Method Details
-
isValidICSContent
Validates whether a string contains only valid characters for iCalendar content. Ensures the string contains no null bytes and only printable ASCII characters, while allowing properly encoded Unicode characters.- Parameters:
content- The string to validate- Returns:
- true if all characters are valid
-
validateWithDetails
Returns detailed validation information about the content.- Parameters:
content- The string to validate- Returns:
- ValidationResult object containing details
-
repairICSContent
Repairs an iCalendar string by removing invalid characters. Invalid characters are dropped rather than replaced to avoid introducing unexpected spaces in ICS property values.- Parameters:
content- The string to repair- Returns:
- The repaired string with invalid characters removed
-