You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example, I'm using a custom list widget. The same error occurs when only assigning the stateDescription metadata.
The UI shows the following error:
An error occurred while creating the links and metadata: Server Error
The Item is created (albeit without the offending metadata, i.e., without the stateDescription metadata).
The openHAB logs show:
==> /var/log/openhab/events.log <==
2021-06-22 12:17:38.145 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'OneCallAPIweatherandforecast_ForecastToday_Rain' changed from NULL to 4.46 mm
==> /var/log/openhab/openhab.log <==
2021-06-22 12:17:38.144 [ERROR] [internal.JSONResponseExceptionMapper] - Unexpected exception occurred while processing REST request.
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 11 path $.value
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:888) ~[?:?]
at com.google.gson.Gson.fromJson(Gson.java:826) ~[?:?]
at org.openhab.core.io.rest.core.internal.GsonMessageBodyReader.readFrom(GsonMessageBodyReader.java:58) ~[?:?]
at org.openhab.core.io.rest.core.internal.MediaTypeExtension.readFrom(MediaTypeExtension.java:103) ~[?:?]
at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1409) ~[bundleFile:1.0.9]
at org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1361) ~[bundleFile:1.0.9]
at org.apache.cxf.jaxrs.utils.JAXRSUtils.processRequestBodyParameter(JAXRSUtils.java:877) ~[bundleFile:1.0.9]
at org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:822) [bundleFile:1.0.9]
at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:214) [bundleFile:1.0.9]
at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:78) [bundleFile:1.0.9]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [bundleFile:1.0.9]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [bundleFile:1.0.9]
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) [bundleFile:1.0.9]
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [bundleFile:1.0.9]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [bundleFile:1.0.9]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [bundleFile:1.0.9]
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216) [bundleFile:1.0.9]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) [bundleFile:1.0.9]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:237) [bundleFile:1.0.9]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) [bundleFile:3.1.0]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) [bundleFile:1.0.9]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:544) [bundleFile:9.4.20.v20190813]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [bundleFile:?]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) [bundleFile:9.4.20.v20190813]
at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) [bundleFile:?]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [bundleFile:9.4.20.v20190813]
at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [bundleFile:?]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.Server.handle(Server.java:494) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) [bundleFile:9.4.20.v20190813]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) [bundleFile:9.4.20.v20190813]
at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 11 path $.value
at com.google.gson.stream.JsonReader.nextString(JsonReader.java:825) ~[?:?]
at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:401) ~[?:?]
at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:389) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129) ~[?:?]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220) ~[?:?]
... 54 more
Expected behavior
The Item should have been created without problems, with all metadata definitions provided.
Steps to reproduce
See example provided.
I suspect that the language parser has a problem when it encounters an empty string after the metadata name, as in stateDescription=""[...
Your environment
Platform information: Raspbian Buster on Raspberry Pi 3B+
[Debug] PUT /rest/links/OneCallAPIweatherandforecast_ForecastToday_Rain/openweathermap%3Aonecall%3A4afe5c0d%3Alocal%3AforecastToday%23rain: {"itemName":"OneCallAPIweatherandforecast_ForecastToday_Rain","channelUID":"openweathermap:onecall:4afe5c0d:local:forecastToday#rain","configuration":{}} (app.js, line 32)
[Debug] PUT /rest/items/OneCallAPIweatherandforecast_ForecastToday_Rain/metadata/stateDescription{"value":{"value":"","config":[{"key":"readOnly","value":"true"},{"key":"pattern","value":"%.2f mm"}]},"config":{"readOnly":"true","pattern":"%.2f mm"}} (app.js, line 32)
[Debug] PUT /rest/items/OneCallAPIweatherandforecast_ForecastToday_Rain/metadata/listWidget{"value":"rain_amount_list","config":{"show_badge":"true","show_group_members":"false"}} (app.js, line 32)
[Error] Failed to load resource: the server responded with a status of 500 (Server Error) (stateDescription, line 0)
[Error] Server Error
(anonymous function) (app.js:32:233850)
promiseReactionJob
shutterfreak
changed the title
Cannot assign readOnly property of stateDescription metadata in Item creation from textual definition
Cannot assign stateDescription metadata in Item creation from textual definition
Jun 22, 2021
The problem
Although it is possible to define Items from their textual definition (openHAB2 .items files), there is an issue when adding the
stateDescription
metadata entry. This has been reported to be working, see e.g.:https://community.openhab.org/t/oh3-add-metadata-to-items-via-configuration-files/112843
An example
Item
definition that partially succeeds:In this example, I'm using a custom list widget. The same error occurs when only assigning the
stateDescription
metadata.The UI shows the following error:
The Item is created (albeit without the offending metadata, i.e., without the
stateDescription
metadata).The openHAB logs show:
Expected behavior
The Item should have been created without problems, with all metadata definitions provided.
Steps to reproduce
See example provided.
I suspect that the language parser has a problem when it encounters an empty string after the metadata name, as in
stateDescription=""[...
Your environment
Platform information: Raspbian Buster on Raspberry Pi 3B+
Browser console
JavaScript Console in Safari:
Browser network traffic
Additional information
See also:
https://community.openhab.org/t/oh3-add-metadata-to-items-via-configuration-files/112843/29?u=shutterfreak
The text was updated successfully, but these errors were encountered: