In creating a new javascript transform for some JSON I discovered using arrow functions can create a real problem. The error was seen in syslog not in the openhab log: “Exception in thread “HTTP Refresh Service” java.lang.AssertionError: Failed generating bytecode for :3”
The code in question:
(function (i) {
var tmp = JSON.parse(i)
return tmp.timelines.filter( x => x.onstage == true ).map(elem => elem.name).join(’ + ')||“No timeline”;
})(input)
The modified working version:
(function (i) {
var tmp = JSON.parse(i)
return tmp.timelines.filter( function(x) { return x.onstage == true } ).map( function (elem) { return elem.name } ).join(’ + ')||“No timeline”;
})(input)
There is no functional difference just a bit prettier with the arrow functions…
After the exception all http binding refresh stops until openhab is restarted.