reyem / openhab2-addons

Add-ons for openHAB 2.x
Eclipse Public License 2.0
3 stars 1 forks source link

EOFException errors in log #13

Closed DanielMalmgren closed 6 years ago

DanielMalmgren commented 6 years ago

I just noticed I have quite many instances of the following in my openhab.log:

2017-09-20 14:37:45.703 [ERROR] [ing.robonect.handler.RobonectHandler] - Unexpected exception. Setting thing offline com.google.gson.JsonSyntaxException: java.io.EOFException: End of input at line 1 column 2 at com.google.gson.Gson.fromJson(Gson.java:820)[13:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:775)[13:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:724)[13:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:696)[13:com.google.gson:2.3.1] at org.openhab.binding.robonect.model.ModelParser.parse(ModelParser.java:31)[210:org.openhab.binding.robonect:2.2.0.201708111441] at org.openhab.binding.robonect.RobonectClient.getMowerInfo(RobonectClient.java:154)[210:org.openhab.binding.robonect:2.2.0.201708111441] at org.openhab.binding.robonect.handler.RobonectHandler.refreshMowerInfo(RobonectHandler.java:256)[210:org.openhab.binding.robonect:2.2.0.201708111441] at org.openhab.binding.robonect.handler.RobonectHandler.access$0(RobonectHandler.java:255)[210:org.openhab.binding.robonect:2.2.0.201708111441] at org.openhab.binding.robonect.handler.RobonectHandler$1.run(RobonectHandler.java:358)[210:org.openhab.binding.robonect:2.2.0.201708111441] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_131] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_131] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_131] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_131] at java.lang.Thread.run(Thread.java:748)[:1.8.0_131] Caused by: java.io.EOFException: End of input at line 1 column 2 at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1414)[13:com.google.gson:2.3.1] at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:498)[13:com.google.gson:2.3.1] at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:418)[13:com.google.gson:2.3.1] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:190)[13:com.google.gson:2.3.1] at com.google.gson.Gson.fromJson(Gson.java:810)[13:com.google.gson:2.3.1] ... 15 more

At the same time the following comes in events.log:

2017-09-20 14:37:45.736 [hingStatusInfoChangedEvent] - 'robonect:mower:f0ef14ed' changed from ONLINE to OFFLINE: java.io.EOFException: End of input at line 1 co lumn 2 2017-09-20 14:38:35.714 [hingStatusInfoChangedEvent] - 'robonect:mower:f0ef14ed' changed from OFFLINE: java.io.EOFException: End of input at line 1 column 2 to ONLINE

I guess this isn't a flaud in the binding itself but either a problem in the Robonect API or maybe simply the mower being on the edge of wifi range right when the API call happens. I suspect though that the binding could catch the exception instead of it ending up as a stacktrace in the log?

reyem commented 6 years ago

OK, I did not find them in my log, but I remember seeing temporary invalid Json responses from the module when playing around with it. As it is not a hard error and the information usually recovers with the next request, the exception is now handled explicitly and logged in debug level. This should also fix the Online / Offline message as it is now an expected exception and does not set the thing to offline.