Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

[CalDAV-Personal] Make the calendar update even if the event is 'before now' #5819

Merged
merged 1 commit into from
Mar 10, 2019

Conversation

9037568
Copy link
Contributor

@9037568 9037568 commented Feb 20, 2019

Change the logic in the eventBegins() method so that the update goes out even if the event is "before now".
It's not clear why this check ever existed, anyway.

Looks like this fixes #5744.

@Tobster77
Copy link

Tobster77 commented Feb 21, 2019

I was the one opening #5744

If you guys need information or people for testing, please let me know.

@9037568
Copy link
Contributor Author

9037568 commented Feb 24, 2019

@cweitkamp, I think this may also fix your issue #5567.
Do you have time to review the changes and/or test?

@cweitkamp
Copy link
Contributor

Yes, of course. Code looks good. I will setup a test for it.

@cweitkamp
Copy link
Contributor

@9037568 I sure it is not related to your changes but did you ever face such a java.util.ServiceConfigurationError after removing and manually installing the bundles (org.openhab.io.caldav and org.openhab.binding.caldav-personal)?

2019-02-24 20:55:21.536 [WARN ] [caldav.internal.job.EventReloaderJob] - Cannot load events
java.util.ServiceConfigurationError: net.fortuna.ical4j.model.PropertyFactory: Provider net.fortuna.ical4j.model.property.Action$Factory not a subtype
	at java.util.ServiceLoader.fail(ServiceLoader.java:239) ~[?:?]
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185) ~[?:?]
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) ~[?:?]
	at java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323) ~[?:?]
	at java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:409) ~[?:?]
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480) ~[?:?]
	at net.fortuna.ical4j.model.AbstractContentFactory.getFactory(AbstractContentFactory.java:85) ~[261:org.openhab.io.caldav:1.14.0.201902241938]
	at net.fortuna.ical4j.model.PropertyFactoryImpl.createProperty(PropertyFactoryImpl.java:78) ~[261:org.openhab.io.caldav:1.14.0.201902241938]
	at net.fortuna.ical4j.data.CalendarBuilder$ContentHandlerImpl.startProperty(CalendarBuilder.java:326) ~[261:org.openhab.io.caldav:1.14.0.201902241938]
	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.parse(CalendarParserImpl.java:206) ~[261:org.openhab.io.caldav:1.14.0.201902241938]
	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.access$1100(CalendarParserImpl.java:190) ~[261:org.openhab.io.caldav:1.14.0.201902241938]
	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyListParser.parse(CalendarParserImpl.java:173) ~[261:org.openhab.io.caldav:1.14.0.201902241938]
	at net.fortuna.ical4j.data.CalendarParserImpl.parse(CalendarParserImpl.java:122) ~[261:org.openhab.io.caldav:1.14.0.201902241938]
	at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:198) ~[261:org.openhab.io.caldav:1.14.0.201902241938]
	at org.openhab.io.caldav.internal.job.EventReloaderJob.loadEvents(EventReloaderJob.java:339) ~[261:org.openhab.io.caldav:1.14.0.201902241938]
	at org.openhab.io.caldav.internal.job.EventReloaderJob.execute(EventReloaderJob.java:100) [261:org.openhab.io.caldav:1.14.0.201902241938]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [107:org.eclipse.smarthome.core.scheduler:0.11.0.oh250M1]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.11.0.oh250M1]
2019-02-24 20:55:22.325 [ERROR] [org.quartz.core.JobRunShell         ] - Job event-reloader.heating threw an unhandled Exception: 
java.util.ServiceConfigurationError: net.fortuna.ical4j.model.PropertyFactory: Provider net.fortuna.ical4j.model.property.Action$Factory not a subtype
	at java.util.ServiceLoader.fail(ServiceLoader.java:239) ~[?:?]
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185) ~[?:?]
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) ~[?:?]
	at java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323) ~[?:?]
	at java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:409) ~[?:?]
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480) ~[?:?]
	at net.fortuna.ical4j.model.AbstractContentFactory.getFactory(AbstractContentFactory.java:85) ~[?:?]
	at net.fortuna.ical4j.model.PropertyFactoryImpl.createProperty(PropertyFactoryImpl.java:78) ~[?:?]
	at net.fortuna.ical4j.data.CalendarBuilder$ContentHandlerImpl.startProperty(CalendarBuilder.java:326) ~[?:?]
	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.parse(CalendarParserImpl.java:206) ~[?:?]
	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.access$1100(CalendarParserImpl.java:190) ~[?:?]
	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyListParser.parse(CalendarParserImpl.java:173) ~[?:?]
	at net.fortuna.ical4j.data.CalendarParserImpl.parse(CalendarParserImpl.java:122) ~[?:?]
	at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:198) ~[?:?]
	at org.openhab.io.caldav.internal.job.EventReloaderJob.loadEvents(EventReloaderJob.java:339) ~[?:?]
	at org.openhab.io.caldav.internal.job.EventReloaderJob.loadEvents(EventReloaderJob.java:320) ~[?:?]
	at org.openhab.io.caldav.internal.job.EventReloaderJob.execute(EventReloaderJob.java:137) ~[?:?]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [107:org.eclipse.smarthome.core.scheduler:0.11.0.oh250M1]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.11.0.oh250M1]
2019-02-24 20:55:22.396 [ERROR] [org.quartz.core.ErrorLogger         ] - Job (event-reloader.heating threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
	at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [107:org.eclipse.smarthome.core.scheduler:0.11.0.oh250M1]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.11.0.oh250M1]
Caused by: java.util.ServiceConfigurationError: net.fortuna.ical4j.model.PropertyFactory: Provider net.fortuna.ical4j.model.property.Action$Factory not a subtype
	at java.util.ServiceLoader.fail(ServiceLoader.java:239) ~[?:?]
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185) ~[?:?]
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) ~[?:?]
	at java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323) ~[?:?]
	at java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:409) ~[?:?]
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480) ~[?:?]
	at net.fortuna.ical4j.model.AbstractContentFactory.getFactory(AbstractContentFactory.java:85) ~[?:?]
	at net.fortuna.ical4j.model.PropertyFactoryImpl.createProperty(PropertyFactoryImpl.java:78) ~[?:?]
	at net.fortuna.ical4j.data.CalendarBuilder$ContentHandlerImpl.startProperty(CalendarBuilder.java:326) ~[?:?]
	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.parse(CalendarParserImpl.java:206) ~[?:?]
	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyParser.access$1100(CalendarParserImpl.java:190) ~[?:?]
	at net.fortuna.ical4j.data.CalendarParserImpl$PropertyListParser.parse(CalendarParserImpl.java:173) ~[?:?]
	at net.fortuna.ical4j.data.CalendarParserImpl.parse(CalendarParserImpl.java:122) ~[?:?]
	at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:198) ~[?:?]
	at org.openhab.io.caldav.internal.job.EventReloaderJob.loadEvents(EventReloaderJob.java:339) ~[?:?]
	at org.openhab.io.caldav.internal.job.EventReloaderJob.loadEvents(EventReloaderJob.java:320) ~[?:?]
	at org.openhab.io.caldav.internal.job.EventReloaderJob.execute(EventReloaderJob.java:137) ~[?:?]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[?:?]
	... 1 more

@cweitkamp
Copy link
Contributor

Reminder for myself: "Use the search function first!" ... We talked about it a long time ago: #5389 (comment)

@cweitkamp
Copy link
Contributor

Unfortunately this fix did not change anything for my problem.

2019-02-25 22:22:27.674 [vent.ItemStateChangedEvent] - wasteEventBegin changed from UNDEF to 2019-02-25T00:00:00.000+0100
2019-02-25 22:22:27.694 [vent.ItemStateChangedEvent] - wasteEventEnd changed from UNDEF to 2019-02-26T00:00:00.000+0100
2019-02-25 22:22:27.749 [vent.ItemStateChangedEvent] - wasteEventTime changed from UNDEF to 25.02.19 00:00 - 26.02.19 00:00
2019-02-26 22:23:02.999 [vent.ItemStateChangedEvent] - wasteEventBegin changed from 2019-02-25T00:00:00.000+0100 to UNDEF
2019-02-26 22:23:03.049 [vent.ItemStateChangedEvent] - wasteEventEnd changed from 2019-02-26T00:00:00.000+0100 to UNDEF
2019-02-26 22:23:03.074 [vent.ItemStateChangedEvent] - wasteEventTime changed from 25.02.19 00:00 - 26.02.19 00:00 to UNDEF
2019-02-24 22:23:34.090 [vent.ItemStateChangedEvent] - wasteUpcoming1EventTime changed from NULL to 25.02.19 00:00 - 26.02.19 00:00
2019-02-24 22:23:35.099 [vent.ItemStateChangedEvent] - wasteUpcoming1EventBegin changed from NULL to 2019-02-25T00:00:00.000+0100
2019-02-24 22:23:35.186 [vent.ItemStateChangedEvent] - wasteUpcoming1EventEnd changed from NULL to 2019-02-26T00:00:00.000+0100
2019-02-25 22:22:27.679 [vent.ItemStateChangedEvent] - wasteUpcoming1EventTime changed from 25.02.19 00:00 - 26.02.19 00:00 to 04.03.19 00:00 - 05.03.19 00:00
2019-02-25 22:22:27.724 [vent.ItemStateChangedEvent] - wasteUpcoming1EventBegin changed from 2019-02-25T00:00:00.000+0100 to 2019-03-04T00:00:00.000+0100
2019-02-25 22:22:27.728 [vent.ItemStateChangedEvent] - wasteUpcoming1EventEnd changed from 2019-02-26T00:00:00.000+0100 to 2019-03-05T00:00:00.000+0100

@Tobster77
Copy link

Tobster77 commented Feb 28, 2019

@cweitkamp: What exactly is your problem? Is it identical to my issue #5744?

How can we proceed with the fix (which seems to fix the problem of @MathiasMoog and me)

@cweitkamp
Copy link
Contributor

cweitkamp commented Mar 1, 2019

@Tobster77 My problem is a little bit different. I do not use the binding to set a Switch item to ON/OFF but use the ACTIVE/UPCOMING feature to track down my waste schedule. Those events begin and end at the wrong time (see #5567 for details).

@Tobster77
Copy link

@Tobster77 My problem is a little bit different. I do not use the binding to set a Switch item to ON/OFF but use the ACTIVE/UPCOMING feature to track down my waste schedule. Those events begin and end at the wrong time (see #5567 for details).

Okay, so it looks like the mistake ( logic in the eventBegins() ) is both in the codes that care for the Switch AND in the code that handles the events. Maybe this was implemented using copy/paste, and thus has to be corrected in two places?

Is there a chance you confirm the review and initiate the pull process? Or will you resolve both issues before you allow to publish the new version?

@9037568
Copy link
Contributor Author

9037568 commented Mar 10, 2019

Thanks, everyone.

@9037568 9037568 merged commit 3c258ca into openhab:master Mar 10, 2019
@9037568 9037568 deleted the tobi branch March 10, 2019 23:08
@9037568 9037568 added this to the 1.14.0 milestone Mar 10, 2019
@Tobster77
Copy link

Thanks a lot.

So how will this be published? It will automatically be part of the snaptshot builds and part of the next regular milestone build, right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CalDAV-personal] Switch item ON only during server reload, but on time for OFF
3 participants