Closed GoogleCodeExporter closed 9 years ago
I did some further investigation on this problem. From my point of view the
error occurs because, when a rule-File has been changed the
removeRuleModel(RuleModel ruleModel) method in RuleTriggermanager is executed.
In this method the rules of all available types are removed from the list if
they are part of the given RuleModel. But the time-based rules are removed
independently from the given rule model.
I think if we add an additional test there, e.g. something similar to this:
for(Rule rule : new ArrayList<Rule>(timerEventTriggeredRules)) {
if (ruleModel.getRules().contains(rule)) {
removeRule(TIMER, rule);
}
}
This example does not work, maybe someone could give me a hint on how to test
if an time based rule is part of a RuleModel.
Original comment by TBraeuti...@gmail.com
on 6 Oct 2012 at 4:13
I think found the reason why the code modification from my last comment
doesn´t work. The removeRuleModel method is called with the already updated
RuleModel, which contains new rule objects, which are not equal to the old ones
(even if there are no changes, I guess?).
To fix this one could add a new EventType (e.g. BEFORE_MODIFIED) which is
called reight before the modified RuleModel is updated. This triggers the
removeRuleModel with the old RuleModel and all rule within this model are going
to be removed correctly.
Original comment by TBraeuti...@gmail.com
on 7 Oct 2012 at 9:32
Original comment by kai.openhab
on 7 Oct 2012 at 7:16
Thanks a lot for reporting this bug, it should be fixed now.
Changeset:
http://code.google.com/p/openhab/source/detail?r=ebf752ce45f64795ee781cd86aa6fa5
f184420e7
Original comment by kai.openhab
on 7 Oct 2012 at 8:02
Original issue reported on code.google.com by
TBraeuti...@gmail.com
on 7 Sep 2012 at 4:12