Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OH3] Sitemap Chart WebView class java.math.BigDecimal cannot be cast to class java.lang.Integer #2047

Closed
Wikibear opened this issue Jan 1, 2021 · 7 comments · Fixed by #2072
Labels
bug An unexpected problem or unintended behavior of the Core

Comments

@Wikibear
Copy link

Wikibear commented Jan 1, 2021

Totally Simple create Sitemap in OH3.

grafik

Ends in this Issue:

2021-01-01 18:44:20.181 [ERROR] [omponents.UIComponentSitemapProvider] - Cannot build sitemap page_1a394ec651 java.lang.ClassCastException: class java.math.BigDecimal cannot be cast to class java.lang.Integer (java.math.BigDecimal and java.lang.Integer are in module java.base of loader 'bootstrap') at org.openhab.core.model.sitemap.sitemap.impl.ChartImpl.eSet(ChartImpl.java:270) ~[bundleFile:?] at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.setWidgetPropertyFromComponentConfig(UIComponentSitemapProvider.java:286) ~[bundleFile:?] at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.buildWidget(UIComponentSitemapProvider.java:188) ~[bundleFile:?] at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.buildSitemap(UIComponentSitemapProvider.java:146) ~[bundleFile:?] at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.getSitemapNames(UIComponentSitemapProvider.java:105) [bundleFile:?] at org.openhab.ui.basic.internal.render.PageRenderer.renderSitemapList(PageRenderer.java:218) [bundleFile:?] at org.openhab.ui.basic.internal.servlet.WebAppServlet.showSitemapList(WebAppServlet.java:135) [bundleFile:?] at org.openhab.ui.basic.internal.servlet.WebAppServlet.service(WebAppServlet.java:167) [bundleFile:?] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [bundleFile:3.1.0] 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:834) [?:?]
Identically with webview

grafik

2021-01-01 18:48:29.028 [ERROR] [omponents.UIComponentSitemapProvider] - Cannot build sitemap page_1a394ec651 java.lang.ClassCastException: class java.math.BigDecimal cannot be cast to class java.lang.Integer (java.math.BigDecimal and java.lang.Integer are in module java.base of loader 'bootstrap') at org.openhab.core.model.sitemap.sitemap.impl.WebviewImpl.eSet(WebviewImpl.java:171) ~[bundleFile:?] at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.setWidgetPropertyFromComponentConfig(UIComponentSitemapProvider.java:286) ~[bundleFile:?] at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.buildWidget(UIComponentSitemapProvider.java:195) ~[bundleFile:?] at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.buildSitemap(UIComponentSitemapProvider.java:146) ~[bundleFile:?] at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.getSitemapNames(UIComponentSitemapProvider.java:105) [bundleFile:?] at org.openhab.ui.basic.internal.render.PageRenderer.renderSitemapList(PageRenderer.java:218) [bundleFile:?] at org.openhab.ui.basic.internal.servlet.WebAppServlet.showSitemapList(WebAppServlet.java:135) [bundleFile:?] at org.openhab.ui.basic.internal.servlet.WebAppServlet.service(WebAppServlet.java:167) [bundleFile:?] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [bundleFile:3.1.0] 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:834) [?:?]
OH3: Stabel Channel on Raspberry Pi 3B. Manual installation.
openjdk version "11.0.9" 2020-10-20 LTS
OpenJDK Runtime Environment Zulu11.43+88-CA (build 11.0.9+11-LTS)
OpenJDK Client VM Zulu11.43+88-CA (build 11.0.9+11-LTS, mixed mode)

Must be a bug this guy have same problem:

https://community.openhab.org/t/oh-3-basic-ui-charts-not-working/111357

There are some more entries via community forum with similar issue.

@ghys
Copy link
Member

ghys commented Jan 1, 2021

@cweitkamp cweitkamp added bug An unexpected problem or unintended behavior of the Core UI User Interface and removed UI User Interface labels Jan 1, 2021
@kaikreuzer
Copy link
Member

@ghys Looks like it - and it seems to be a bug in the UI code, right? Can it be fixed there or should we do some changes in the core as well?

@ghys
Copy link
Member

ghys commented Jan 2, 2021

I think we should not rely too much on ConfigUtil.normalizeType when setting sitemap widgets config values:

Since the number of exceptions are low we can add them and parse numbers into Integers instead of BigDecimal, and Strings like "true" & "false" into Booleans.

@lolodomo
Copy link
Contributor

lolodomo commented Jan 2, 2021

But are you sure that sitemap syntax will be valid if you use string where a boolean is expected for example ?
I have a serious doubt.

@kaikreuzer
Copy link
Member

@ghys The config util was indeed created for config descriptions and isn't a good fit for sitemap attributes.
If we always know what type the feature is that we need to fill, a dedicated transformation should be the safer bet indeed.
As you are the author of that class, do you plan to look into fixing it?

@ghys
Copy link
Member

ghys commented Jan 3, 2021

Walking back on your own advice then? ;) (just kidding of course).
Yes I'll look into it.

@kaikreuzer
Copy link
Member

Oops, you've got me there 🤣 . I must have been thinking to look at some other code when I reviewed that...

ghys added a commit to ghys/openhab-core that referenced this issue Jan 4, 2021
Also catch remaining exceptions and log a warning/ignore the parameter
instead of making the whole sitemap building process fail.

Fix wrong feature ID for the video widget URL.

Fixes openhab#2047.
Fixes openhab#1987.
Fixes openhab#1898.
Fixes openhab#1875.
Fixes openhab/openhab-webui#745.

Signed-off-by: Yannick Schaus <[email protected]>
kaikreuzer pushed a commit that referenced this issue Jan 5, 2021
…aps (#2072)

* Fix parsing integer & booleans parameters in UI component based sitemaps

Also catch remaining exceptions and log a warning/ignore the parameter
instead of making the whole sitemap building process fail.

Fix wrong feature ID for the video widget URL.

Fixes #2047.
Fixes #1987.
Fixes #1898.
Fixes #1875.
Fixes openhab/openhab-webui#745.

Signed-off-by: Yannick Schaus <[email protected]>
cweitkamp pushed a commit that referenced this issue Jan 10, 2021
…aps (#2072)

* Fix parsing integer & booleans parameters in UI component based sitemaps

Also catch remaining exceptions and log a warning/ignore the parameter
instead of making the whole sitemap building process fail.

Fix wrong feature ID for the video widget URL.

Fixes #2047.
Fixes #1987.
Fixes #1898.
Fixes #1875.
Fixes openhab/openhab-webui#745.

Signed-off-by: Yannick Schaus <[email protected]>
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this issue Jul 11, 2023
…aps (openhab#2072)

* Fix parsing integer & booleans parameters in UI component based sitemaps

Also catch remaining exceptions and log a warning/ignore the parameter
instead of making the whole sitemap building process fail.

Fix wrong feature ID for the video widget URL.

Fixes openhab#2047.
Fixes openhab#1987.
Fixes openhab#1898.
Fixes openhab#1875.
Fixes openhab/openhab-webui#745.

Signed-off-by: Yannick Schaus <[email protected]>
GitOrigin-RevId: fcaf251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants