openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
911 stars 420 forks source link

Video in sitemap exception #2154

Closed bigbasec closed 3 years ago

bigbasec commented 3 years ago

Same issue as the Image Renderer, so I am going to just defer to that issue : https://github.com/openhab/openhab-webui/issues/763

Tested on SNAPSHOT build : runtimeInfo: version: 3.1.0 buildString: "Build #2163" locale: en_US systemInfo: configFolder: /etc/openhab userdataFolder: /var/lib/openhab logFolder: /var/log/openhab javaVersion: 11.0.10 javaVendor: Azul Systems, Inc. javaVendorVersion: Zulu11.45+27-CA osName: Linux osVersion: 5.4.0-56-generic osArchitecture: amd64 availableProcessors: 64 freeMemory: 2104767072 totalMemory: 2592079872 bindings:

Same failure for the most part as the ImageRenderer, but the VideoRenderer doesn't have a check for sitemap being null so it just throws an exception : 00:14:55.120 [tp1751055337-66] WARN org.eclipse.jetty.server.HttpChannel:600 - /basicui/app java.lang.NullPointerException: null at org.openhab.ui.basic.internal.render.VideoRenderer.renderWidget(VideoRenderer.java:69) at org.openhab.ui.basic.internal.render.PageRenderer.renderWidget(PageRenderer.java:195) at org.openhab.ui.basic.internal.render.PageRenderer.processChildren(PageRenderer.java:161) at org.openhab.ui.basic.internal.render.PageRenderer.processPage(PageRenderer.java:125) at org.openhab.ui.basic.internal.servlet.WebAppServlet.service(WebAppServlet.java:183) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:544) at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:298) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:82) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:494) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:135) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) at java.base/java.lang.Thread.run(Thread.java:834)

Exception @ : String widgetId = itemUIRegistry.getWidgetId(w); String sitemap = w.eResource().getURI().path();

To stop it from throwing an exception should add a check on sitemap like it's done in the ImageRenderer : String sitemap = null; if (w.eResource() != null) { sitemap = w.eResource().getURI().path(); }

Though it would still display nothing until the underlying issue is fixed(would seem to be core related).

lolodomo commented 3 years ago

The url is a mandatory field of the video widget. Without it, you should get a bad sitemap validation when it is loaded. Check the syntax in the documentations.

bigbasec commented 3 years ago

The URL was entered in this example.

bigbasec commented 3 years ago

Here is the sitemap I used to test this :

 sitemap page_a875afa9cf label="New Sitemap" {
    Chart item=DemoNumber
    Image icon="groundfloor" url="https://storage.googleapis.com/gweb-uniblog-publish-prod/images/Chrome__logo.max-500x500.png" label="Test"
    Video url="http://10.0.0.251/zm/cgi-bin/nph-zms?scale=100&width=1280px&height=960px&mode=jpeg&maxfps=30&monitor=1&connkey=420003&rand=1611551320" label="Test1" encoding="mjpeg"
}

Obviously just a test and the icons to fill the gap, though this sitemap will result in a 500 error on the browser and the error above listed as well as a null exception in the karaf logs. The issue is marked for webui, but I don't think that's where the problem is.

bigbasec commented 3 years ago

@kaikreuzer I'm been looking into this problem with the Images and Video for a little while here and it looks like most of the code was written by you here, so I'm just wondering if you have any ideas?

You also closed this issue here : https://github.com/openhab/openhab-webui/issues/745#event-4172126462

Though it's not fixed. Images and Videos will not display unless they are created with a sitemap file.

openhab-bot commented 3 years ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/images-video-sitemaps-and-proxy/115677/1