SmartAxiom / openhab

Automatically exported from code.google.com/p/openhab
0 stars 0 forks source link

Harden up Bindings Framework Code #208

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Due to an unhandled exception inside the homematic bindings 
allBindingsChanged/bindingChanged method, the whole openHAB system became 
unstable (device rescan every few seconds). This could occure with other 
bindings as well.

I would propose to make all important binding calls in a try - catch block. 
This avoids the situation that one problematic binding influences the whole 
openHAB system.

E.g. 
    private void notifyListeners(Item item) {
        for (BindingChangeListener listener : listeners) {
            listener.bindingChanged(this, item.getName());
        }
    }

to 
    private void notifyListeners(Item item) {
        for (BindingChangeListener listener : listeners) {
            try {
                listener.bindingChanged(this, item.getName());
            } catch (Exception e) {
                logger.error("Binding XY reacts incorrectly", e);
            }
        }
    }

Original issue reported on code.google.com by thomas.letsch.de on 12 Mar 2013 at 9:00