Class ICSCalendarValidator

java.lang.Object
davmail.exchange.ICSCalendarValidator

public class ICSCalendarValidator extends Object
Validator for iCalendar data according to RFC 5545 specifications. This implementation provides comprehensive validation and repair capabilities for iCalendar content, specifically focusing on character validation rather than XML structure.

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)
  • Field Details

    • LOGGER

      protected static final org.apache.log4j.Logger LOGGER
  • Constructor Details

    • ICSCalendarValidator

      public ICSCalendarValidator()
  • Method Details

    • isValidICSContent

      public static boolean isValidICSContent(String content)
      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

      public static ICSCalendarValidator.ValidationResult validateWithDetails(String content)
      Returns detailed validation information about the content.
      Parameters:
      content - The string to validate
      Returns:
      ValidationResult object containing details
    • repairICSContent

      public static String repairICSContent(String content)
      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