NullPointerException in ZigBeeThingHandler.dispose() on Delete Thing in GUI

I get this error consistently every time when I delete a ZigBee thing in Paper UI. As you can see, it’s one type of error and two types of warnings. The warnings can occur long after item deletion. Therefore, the only way to clean the logs, is to restart openhab.
I’m hoping, this is easy to fix.
The system is running OH 3.4 stable on RPI 4.

2023-01-03 15:11:42.084 [ERROR] [org.openhab.core.thing.internal.ThingManagerImpl  ] - Exception occurred while disposing handler of thing 'zigbee:device:local:a4c13873ed3378fd': null
java.lang.NullPointerException: null
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler.getOtaServer(ZigBeeThingHandler.java:973) ~[?:?]
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler.dispose(ZigBeeThingHandler.java:582) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
2023-01-03 15:13:27.700 [WARN ] [org.openhab.core.thing.binding.BaseThingHandler   ] - Handler ZigBeeThingHandler tried updating its thing's properties although the handler was already disposed.
...
2023-01-03 15:21:34.066 [WARN ] [org.openhab.core.thing.binding.BaseThingHandler   ] - Handler ZigBeeThingHandler of thing zigbee:device:local:a4c13873ed3378fd tried checking if channel A4C13873ED3378FD_1_vibration is linked although the handler was already disposed.

I’ve created a PR that will hopefully fix this -:

1 Like