Jollyday uses JAXB to read the configuration XML, this results in illegal access violations.
In Java 16 some of the illegal access violations that used to be flagged as warnings have been escalated to errors.
I was able to get around the issue using XStream instead of JAXB, first exporting the config using Java 15:
ManagerParameter parameter = ManagerParameters.create(calendarPart);
Configuration configuration = HolidayManager.getInstance(parameter).getConfigurationDataSource().getConfiguration(parameter);
String export = new XStream().toXML(configuration);
Then replace the contents of Holidays_[x].xml with the XStream format, and load them back with Java 16:
HolidayManager manager = new DefaultHolidayManager();
manager.setConfigurationDataSource(new XStreamConfigurationDataSource());
ManagerParameter parameter = ManagerParameters.create(calendarPart);
new ConfigurationProviderManager().mergeConfigurationProperties(parameter);
manager.init(parameter);
private static class XStreamConfigurationDataSource implements ConfigurationDataSource {
@Override
public Configuration getConfiguration(ManagerParameter managerParameter) {
URL resourceUrl = managerParameter.createResourceUrl();
try (InputStream inputStream = resourceUrl.openStream()) {
return (Configuration) new XStream().fromXML(inputStream);
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}
Jollyday uses JAXB to read the configuration XML, this results in illegal access violations.
In Java 16 some of the illegal access violations that used to be flagged as warnings have been escalated to errors.
I was able to get around the issue using XStream instead of JAXB, first exporting the config using Java 15:
Then replace the contents of Holidays_[x].xml with the XStream format, and load them back with Java 16: