mycontroller-org / mycontroller-v1-legacy

The Open Source Controller
http://www.MyController.org
Apache License 2.0
148 stars 90 forks source link

Ethernet driver is going down in case of NumberFormatException #512

Closed Jordan-Szwejda closed 3 years ago

Jordan-Szwejda commented 3 years ago

Hi,

At very beginning I would like to say thank you for you excellent work. I have been using mycontroller for a few years for doing my simple home automation by using mysensors with nrf23l01 module and esp8266. Among many other home automation controllers I appreciate that your controller is written in java and the code is very tidy. Perfect job, congratulations!!

Recently I have been working on writing my own mysensors-like gateway to support my very limited communication system for cheap rf433 modules used directly from attiny13A. It is very small microprocessor and I need something really small.

During working with EthernetDriver I noticed that this thread does not catch all exceptions. When by mistake this code gets a mysensors message when instead of numeric message subtype there will be an empty string, then NumberFormatException will be thrown but it will not be caught in the EthernetDriver thread what causes the situation that driver stops processing Ethernet messages. It looks like you need to restart gateway to have messages processed again.

I would suggest apply something like this to fix this situation (patches attached)

: fix.zip


Thanks, Jordan Szwejda

jkandasa commented 3 years ago

@Jordan-Szwejda Thanks for the words about MyController and to be a community member of MyController. And thanks for your fix. I would say if you create pull request with your changes. You will be in MyController contribution history. If you need a help to create PR: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request

Jordan-Szwejda commented 3 years ago

Done. Pull Request: https://github.com/mycontroller-org/mycontroller-v1-legacy/pull/513