marinmitev / smarthome

Eclipse SmartHome project
Eclipse Public License 1.0
2 stars 1 forks source link

NPE when adding a rule with missing module types #132

Closed kaikreuzer closed 9 years ago

kaikreuzer commented 9 years ago

I have a rule that gets imported through the bundle importer. This seems to happen before the according module types are loaded and I get:

13:07:04.479 [ESH-safeCall-3] INFO  smarthome.event.RuleAddedEvent - Rule 'javascript.rule1' has been added.
13:07:04.493 [Automation Provider Processing Queue] DEBUG o.e.s.a.core.internal.RuleEngine - Added rule 'javascript.rule1'
Exception in thread "Automation Provider Processing Queue" java.lang.NullPointerException
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.setDefautlValues(RuleEngine.java:1137)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.resolveDefaultValues(RuleEngine.java:1127)
    at org.eclipse.smarthome.automation.core.internal.RuleEngine.setRule(RuleEngine.java:336)
    at org.eclipse.smarthome.automation.core.internal.RuleRegistryImpl.addIntoRuleEngine(RuleRegistryImpl.java:87)
    at org.eclipse.smarthome.automation.core.internal.RuleRegistryImpl.add(RuleRegistryImpl.java:78)
    at org.eclipse.smarthome.automation.core.internal.RuleRegistryImpl.add(RuleRegistryImpl.java:1)
    at org.eclipse.smarthome.automation.internal.core.provider.RuleResourceBundleImporter.importData(RuleResourceBundleImporter.java:213)
    at org.eclipse.smarthome.automation.internal.core.provider.RuleResourceBundleImporter.processAutomationProvider(RuleResourceBundleImporter.java:183)
    at org.eclipse.smarthome.automation.internal.core.provider.AutomationResourceBundlesEventQueue.processBundleChanged(AutomationResourceBundlesEventQueue.java:319)
    at org.eclipse.smarthome.automation.internal.core.provider.AutomationResourceBundlesEventQueue.run(AutomationResourceBundlesEventQueue.java:144)
    at java.lang.Thread.run(Thread.java:745)
danchom commented 9 years ago

I can't reproduce this NPE. In the code default values have to be set after resolving all module types.

kaikreuzer commented 9 years ago

It happens every time when executing the launch config "org.eclipse.smarthome.automation.module.script.test", right after adding the rule. How does your log look like at that place?

danchom commented 9 years ago

I don't "Added rule 'javascript.rule1" in my console output

danchom commented 9 years ago

12:21:57.063 [Automation Provider Processing Queue] DEBUG o.e.s.a.core.internal.RuleEngine - Added rule 'javascript.rule1' 12:21:57.069 [Automation Provider Processing Queue] DEBUG o.e.s.c.c.r.AbstractManagedProvider - Added new element javascript.rule1 to ManagedRuleProvider. 12:21:57.088 [Automation Provider Processing Queue] DEBUG o.e.s.a.i.c.p.RuleResourceBundleImporter - Not importing rule 'javascript.rule1' since a rule with this id already exists 12:21:57.140 [ESH-safeCall-5] INFO smarthome.event.ItemStateEvent - MyTrigger updated to ON 12:21:57.148 [ESH-safeCall-5] INFO smarthome.event.RuleStatusInfoEvent - javascript.rule1 updated: NOT_INITIALIZED (CONFIGURATION_ERROR) 12:21:57.460 [ESH-safeCall-5] INFO smarthome.event.RuleAddedEvent - Rule 'javascript.rule1' has been added. 12:21:57.468 [ESH-safeCall-5] INFO smarthome.event.RuleStatusInfoEvent - javascript.rule1 updated: NOT_INITIALIZED (CONFIGURATION_ERROR) 12:21:57.488 [ESH-safeCall-5] INFO smarthome.event.RuleStatusInfoEvent - javascript.rule1 updated: NOT_INITIALIZED (CONFIGURATION_ERROR) 12:21:57.488 [ESH-safeCall-5] INFO smarthome.event.RuleStatusInfoEvent - javascript.rule1 updated: NOT_INITIALIZED (CONFIGURATION_ERROR) 12:21:57.490 [ESH-safeCall-5] INFO smarthome.event.RuleStatusInfoEvent - javascript.rule1 updated: IDLE

kaikreuzer commented 9 years ago

thanks, this seems to be solved