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

NPEs when initializing items #3520

Closed
kaikreuzer opened this issue May 25, 2017 · 4 comments
Closed

NPEs when initializing items #3520

kaikreuzer opened this issue May 25, 2017 · 4 comments

Comments

@kaikreuzer
Copy link
Contributor

The demo setup of openHAB now results in such exceptions in the log:

2017-05-25 17:28:58.990 [ERROR] [ore.internal.events.OSGiEventManager] - Dispatching/filtering event for subscriber 'org.eclipse.smarthome.core.events.EventSubscriber' failed: java.lang.IllegalArgumentException: The argument 'state' must not be null or empty.
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: The argument 'state' must not be null or empty.
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)[:1.8.0_112]
        at java.util.concurrent.FutureTask.get(FutureTask.java:206)[:1.8.0_112]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:194)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager.dispatchESHEvent(OSGiEventManager.java:188)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager.handleEvent(OSGiEventManager.java:163)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager.handleEvent(OSGiEventManager.java:146)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415)[6:org.apache.karaf.services.eventadmin:4.0.8]
        at org.apache.felix.eventadmin.impl.tasks.HandlerTask.run(HandlerTask.java:90)[6:org.apache.karaf.services.eventadmin:4.0.8]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_112]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_112]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_112]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_112]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_112]
Caused by: java.lang.IllegalArgumentException: The argument 'state' must not be null or empty.
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)[12:com.google.guava:18.0.0]
        at org.eclipse.smarthome.core.items.events.ItemEventFactory.assertValidArguments(ItemEventFactory.java:370)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.items.events.ItemEventFactory.createStateChangedEvent(ItemEventFactory.java:272)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.items.GenericItem.sendStateChangedEvent(GenericItem.java:215)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.items.GenericItem.applyState(GenericItem.java:209)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.library.items.DimmerItem.setState(DimmerItem.java:74)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.items.ItemUpdater.receiveUpdate(ItemUpdater.java:70)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:44)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:192)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        ... 4 more
2017-05-25 17:28:59.064 [ERROR] [ore.internal.events.OSGiEventManager] - Dispatching/filtering event for subscriber 'org.eclipse.smarthome.core.events.EventSubscriber' failed: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)[:1.8.0_112]
        at java.util.concurrent.FutureTask.get(FutureTask.java:206)[:1.8.0_112]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:194)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager.dispatchESHEvent(OSGiEventManager.java:188)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager.handleEvent(OSGiEventManager.java:163)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager.handleEvent(OSGiEventManager.java:146)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415)[6:org.apache.karaf.services.eventadmin:4.0.8]
        at org.apache.felix.eventadmin.impl.tasks.HandlerTask.run(HandlerTask.java:90)[6:org.apache.karaf.services.eventadmin:4.0.8]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_112]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_112]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_112]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_112]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_112]
Caused by: java.lang.NullPointerException
        at org.eclipse.smarthome.core.items.GenericItem.applyState(GenericItem.java:208)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.library.items.DimmerItem.setState(DimmerItem.java:74)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.items.ItemUpdater.receiveUpdate(ItemUpdater.java:70)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:44)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:192)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)[99:org.eclipse.smarthome.core:0.9.0.201705251309]
        ... 4 more

See also https://community.openhab.org/t/java-lang-nullpointerexception-every-few-seconds/28944

@martinvw
Copy link
Contributor

If you agree I would like to intercept it way earlier and transform the null to a UnDefType.NULL let me check where that should be done then...

@martinvw
Copy link
Contributor

Found something, preparing a PR

@martinvw
Copy link
Contributor

Only one part was fixed, a real fix is still needed, see discussion in the PR

@sjsf
Copy link
Contributor

sjsf commented May 27, 2017

That was Github's auto-close.

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

No branches or pull requests

3 participants