Astro binding threw an exception at midnight switch from 2021 to 2022

Hi,

At the risk of being racked because I’m still using an old openHAB version (I know there’s people out there who really don’t like it if you’re still using “old stuff”), I’m gonna take my chance anyway…

  • RPi 2B, headless server setup
  • openHAB 1.8.3
  • Java 1.8.0_65

I had an issue with my Astro binding (openHAB 1.8.3) at midnight when switching from year 2021 to year 2022. This is the NPE I got:

2021-12-31 23:52:20.870 [INFO ] [runtime.busevents             ] - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2022-01-01 00:00:00.029 [ERROR] [org.quartz.core.JobRunShell   ] - Job Astro.Season threw an unhandled Exception:
java.lang.NullPointerException: null
        at java.util.Hashtable.put(Hashtable.java:459) ~[na:1.8.0_65]
        at org.openhab.core.internal.events.EventPublisherImpl.createUpdateEvent(EventPublisherImpl.java:86) ~[na:na]
        at org.openhab.core.internal.events.EventPublisherImpl.postUpdate(EventPublisherImpl.java:78) ~[na:na]
        at org.openhab.binding.astro.internal.job.ItemJob.executeJob(ItemJob.java:25) ~[na:na]
        at org.openhab.binding.astro.internal.job.AbstractBaseJob.execute(AbstractBaseJob.java:45) ~[na:na]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213) ~[quartz-all-2.1.7.jar:na]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz-all-2.1.7.jar:na]
2022-01-01 00:00:00.042 [ERROR] [org.quartz.core.ErrorLogger   ] - Job (Astro.Season threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
        at org.quartz.core.JobRunShell.run(JobRunShell.java:224) ~[quartz-all-2.1.7.jar:na]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz-all-2.1.7.jar:na]
Caused by: java.lang.NullPointerException: null
        at java.util.Hashtable.put(Hashtable.java:459) ~[na:1.8.0_65]
        at org.openhab.core.internal.events.EventPublisherImpl.createUpdateEvent(EventPublisherImpl.java:86) ~[na:na]
        at org.openhab.core.internal.events.EventPublisherImpl.postUpdate(EventPublisherImpl.java:78) ~[na:na]
        at org.openhab.binding.astro.internal.job.ItemJob.executeJob(ItemJob.java:25) ~[na:na]
        at org.openhab.binding.astro.internal.job.AbstractBaseJob.execute(AbstractBaseJob.java:45) ~[na:na]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213) ~[quartz-all-2.1.7.jar:na]
        ... 1 common frames omitted
2022-01-01 00:00:00.106 [INFO ] [runtime.busevents             ] - Sunset_Time state updated to 2022-01-01T16:51:00
2022-01-01 00:00:00.125 [INFO ] [runtime.busevents             ] - Sunrise_Time state updated to 2022-01-01T08:52:00

I found something similar here in an old thread:

However, this talks about switching from one season to another and the solution was to take season changes into account.

But in my case, it’s switching at midnight from one year to another. So, not really related.

Note: after that exception, the Astro binding seems to work as normal again.

Any idea?

It’s not that we don’t like that you are using old stuff. It’s often the level of support that’s expected from us on the old stuff and then the anger that we can’t solve the problem.

Most of the people active on the forum never used OH 1.8. The few of us who did, haven’t looked at it in half a dozen years.

I think your choice is to live with it or upgrade to a supported version of OH. The fix in the issue you linked to should be in the version of the add-on you have installed so it’s something else. That something else is not happening in OH 2 nor OH 3 (or at least it’s hasn’t been reported yet. But even if it were, the 1.x add-ons are no longer supported. Any fix would only be available in OH 3.

Of course you could also dig into the code and try to patch it yourself. That’s the wonderful part of open source. But even here there won’t be a lot we can do too help get a build environment working.

So I don’t know if we can help with this particular issue. It’s a code issue, not a configuration issue.

In addition to what @rlkoshak says

I would be inclined to just ignore this error completely if it didn’t actually result in any problems. We’ll never go from 2021 to 2022 again…

No problem, I can live with that… I was just curious to see if someone else has had the same issue before and if there would be a solution already available that was not part of 1.8.3 but of a later release, still OH 1.8 related. No need to dig into that…

Nope, it didn’t. Everything still seems to work fine: sunset time, sunrise time, switching on/off certain lights at dusk and dawn…

Yeah… You might be right about that… Let’s see if the future proves your statement…