HABpanel freeze when an String item is 'null'

Hi all,

I have a problem where I read some JSONPATH responses from my 3D-Printer.

When the response is empty (which happens in some cases), JSONPATH makes ‘null’ (not ‘NULL’!) out of this.

Apparently, HABpanel does not like this and loses the connection. “Trying to Reconnect…” error message.
The particular item is not used anywhere in my HABpanel.

How can I resolve this? Is this expected behaviour or a bug?

Regards
David

Can you open the Chrome dev tools (F12), reload the page and check what happens in the Console and Network tabs? Look for anything in red.

Thanks for the response, here is my evaluation!

This is my item definition:

String OctoprintJobFileName "Filename [%s]" {http="<[http://domain/api/job?apikey=APIKEY:60000:JSONPATH($.job.file.name)]"}

When I put the http request in chrome, the response is:

{
  "job": {
    "estimatedPrintTime": null, 
    "filament": {
      "length": null, 
      "volume": null
    }, 
    "file": {
      "date": null, 
      "name": null, 
      "origin": null, 
      "path": null, 
      "size": null
    }, 
    "lastPrintTime": null
  }, 
  "progress": {
    "completion": null, 
    "filepos": null, 
    "printTime": null, 
    "printTimeLeft": null
  }, 
  "state": "Operational"
}

In Firefox, the fields are just blank.

In karaf smarthome:items list, this is the status:

OctoprintJobFileName (Type=StringItem, State=null, Label=Filename, Category=null)

In Chrome dev tools, the console shows this:

vendor.js:105 GET http://openhabpi2.fritz.box:8080/rest/items 500 (Internal Server Error)
(anonymous) @ vendor.js:105
n @ vendor.js:100
(anonymous) @ vendor.js:98
(anonymous) @ vendor.js:132
$eval @ vendor.js:147
$digest @ vendor.js:144
$apply @ vendor.js:147
l @ vendor.js:99
K @ vendor.js:103
N.onload @ vendor.js:104
XMLHttpRequest.send (async)
(anonymous) @ vendor.js:105
n @ vendor.js:100
(anonymous) @ vendor.js:98
(anonymous) @ vendor.js:132
$eval @ vendor.js:147
$digest @ vendor.js:144
$apply @ vendor.js:147
(anonymous) @ vendor.js:21
invoke @ vendor.js:42
c @ vendor.js:21
Gc @ vendor.js:21
se @ vendor.js:20
(anonymous) @ vendor.js:323
b @ vendor.js:192
eg @ vendor.js:37
d @ vendor.js:37
openhab.service.js:48 

Error loading openHAB items... retrying in 5 seconds
(anonymous) @ openhab.service.js:48
(anonymous) @ vendor.js:132
$eval @ vendor.js:147
$digest @ vendor.js:144
$apply @ vendor.js:147
l @ vendor.js:99
K @ vendor.js:103
N.onload @ vendor.js:104
XMLHttpRequest.send (async)
(anonymous) @ vendor.js:105
n @ vendor.js:100
(anonymous) @ vendor.js:98
(anonymous) @ vendor.js:132
$eval @ vendor.js:147
$digest @ vendor.js:144
$apply @ vendor.js:147
l @ vendor.js:99
K @ vendor.js:103
N.onload @ vendor.js:104
XMLHttpRequest.send (async)
(anonymous) @ vendor.js:105
n @ vendor.js:100
(anonymous) @ vendor.js:98
(anonymous) @ vendor.js:132
$eval @ vendor.js:147
$digest @ vendor.js:144
$apply @ vendor.js:147
(anonymous) @ vendor.js:21
invoke @ vendor.js:42
c @ vendor.js:21
Gc @ vendor.js:21
se @ vendor.js:20
(anonymous) @ vendor.js:323
b @ vendor.js:192
eg @ vendor.js:37
d @ vendor.js:37

In the network tab there is a lot of “GET” status “500”.

Once I comment out that item and reload HABpanel, everything is fine again. Or I start a job on my printer and the response is not ‘null’ but an actual string.

Interestingly, this is not a problem with number items!

Hope this helps!

Go to this URL with your browser, there should be a more detailed message about that 500 error.

{"error":{"http-code":500,"exception":{"class":"java.lang.NullPointerException"}}}

This is what I get?

Hm, so much for the “more detailed message”…
Definitely an issue with your items configuration. Usually this is caused by transformers (map etc.).
Check your openHAB logs.