Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use WrTimezone with CalendarBuilder via ExtendedContentHandler #636

Open
bannmann opened this issue May 18, 2023 · 1 comment
Open

Comments

@bannmann
Copy link

With ical4j 4.0.0-beta7, it seems impossible to use WrTimezone from ical4j-extensions 2.0.0-beta2.

The reason is that CalendarBuilder does not allow specifying ExtendedContentHandler either in the constructor or via a setter, it always instantiates DefaultContentHandler.

@benfortuna
Copy link
Member

Thanks for the feedback. There is a way to use ExtendedContentHandler without CalendarBuilder but I probably haven't documented this well yet.

Here is how I suggest you try ExtendedContentHandler:

Calendar cal = null;
ContentHandler contentHandler = new ExtendedContentHandler(calendar -> { this.cal = calendar; },
TimeZoneRegistryFactory.getInstance().createRegistry());

CalendarParserFactory.instance.get().parse(..., contentHandler);

This is basically what the CalendarBuilder does (replace the ... with your calendar reader/input stream).

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

No branches or pull requests

2 participants