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

openHAB3 sitemap creation failure: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Boolean #1875

Closed
soenkekueper opened this issue Nov 30, 2020 · 2 comments · Fixed by #2072
Labels
bug An unexpected problem or unintended behavior of the Core

Comments

@soenkekueper
Copy link
Contributor

soenkekueper commented Nov 30, 2020

Hey,

i'm just testing arount with openHAB3 and run into the following problem.

I've created an sitemap with the new UI-Editor (which is pretty smart). The code sections says that everything is okay.
But when requesting the sitemaps i'm getting the following error within the server log:

2020-11-30 18:15:54.881 [ERROR] [omponents.UIComponentSitemapProvider] - Cannot build sitemap page_59d08b12be
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
        at org.openhab.core.model.sitemap.sitemap.impl.SliderImpl.eSet(SliderImpl.java:320) ~[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:214) ~[bundleFile:?]
        at org.openhab.core.ui.internal.components.UIComponentSitemapProvider.buildWidget(UIComponentSitemapProvider.java:262) ~[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.core.io.rest.sitemap.internal.SitemapResource.getSitemapBeans(SitemapResource.java:413) [bundleFile:?]
        at org.openhab.core.io.rest.sitemap.internal.SitemapResource.getSitemaps(SitemapResource.java:229) [bundleFile:?]
        at jdk.internal.reflect.GeneratedMethodAccessor67.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

This is the content of my sitemap (copied from ui code section)

sitemap page_59d08b12be label="Zuhause" {
    Frame icon="corridor" label="Flur" item=locationCorridor {
        Slider icon="light" label="Spots Garderobea" item=Garderobe_Helligkeit switchEnabled="true"
    }
}

Technical information:

runtimeInfo:
  version: 3.0.0.M3
  buildString: Milestone Build
locale: de_DE
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.9
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.43+88-CA
  osName: Linux
  osVersion: 5.4.72-v7l+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 47826432
  totalMemory: 127819776
bindings:
  - avmfritz
  - denonmarantz
  - heos
  - network
  - tradfri
clientInfo:
  device:
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: true
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: windows
    pixelRatio: 1.5
    prefersColorScheme: light
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
  navigator:
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 8
    language: de-DE
    languages:
      - de-DE
      - de
      - en-US
      - en
    onLine: true
    platform: Win32
  screen:
    width: 2560
    height: 1440
    colorDepth: 24
  support:
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
  themeOptions:
    dark: light
    filled: true
    pageTransitionAnimation: default
    bars: filled
    homeNavbar: default
    homeBackground: default
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
    like Gecko) Chrome/87.0.4280.66 Safari/537.36
timestamp: 2020-11-30T17:22:23.525Z

Let me know if you need some further information!

Sönke

@soenkekueper
Copy link
Contributor Author

Hey,

it seems to be an problem with the code editor.
Here is how to reproduce the problem:

  • Create an Slider via UI and enable the "Switch enabled" Toggle in the slider settings
  • Everything works
  • open the code editor
  • modify something (i.e. the name of the slider)
  • save
  • sitemaps doesn't work anymore

@lolodomo
Copy link
Contributor

lolodomo commented Dec 2, 2020

It is apparently failing to deal with switchEnabled="true"
https://github.com/openhab/openhab-core/blob/master/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/components/UIComponentSitemapProvider.java#L214
The problem could be that the expected value is a boolean, not a string.

Try with switchEnabled=true

If it works, the issue has to be moved to webui (MainUI).

@cweitkamp cweitkamp added the bug An unexpected problem or unintended behavior of the Core label Dec 23, 2020
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.

3 participants