Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3715

URL encoding in Websocket AU requests causes NPE -> UiException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: Freshly, 8.5.0
    • Fix Version/s: 8.5.0
    • Component/s: ZK Update Engine
    • Security Level: Jean
    • Labels:
      None
    • Environment:

      version: 8.5.0.FL.20170801

      <listener-class>org.zkoss.zkmax.au.websocket.WebSocketWebAppInit</listener-class>

      Description

      Steps to Reproduce

      enable websocket AU -> WebSocketWebAppInit

      click this button:

      <button label="encodeURL" id="encodeURL" onClick='execution.encodeURL("~./some/resource.png")'/>
      

      Current Result

      SEVERE: 
      org.zkoss.zk.ui.UiException: javax.servlet.ServletException: Unable to encode ~./some/resource.png
      	at org.zkoss.zk.ui.http.ExecutionImpl.encodeURL(ExecutionImpl.java:323)
      	at org.zkoss.zk.ui.Components$Exec.encodeURL(Components.java:790)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at bsh.Reflect.invokeMethod(Reflect.java:131)
      	at bsh.Reflect.invokeObjectMethod(Reflect.java:77)
      	at bsh.Name.invokeMethod(Name.java:852)
      	at bsh.BSHMethodInvocation.eval(BSHMethodInvocation.java:69)
      	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:96)
      	at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:41)
      	at bsh.Interpreter.eval(Interpreter.java:659)
      	at bsh.Interpreter.eval(Interpreter.java:750)
      	at org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:131)
      	at org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:342)
      	at org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:965)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3120)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3074)
      	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1846)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1618)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1321)
      	at org.zkoss.zkmax.au.websocket.WebSocketEndPoint.process(WebSocketEndPoint.java:228)
      	at org.zkoss.zkmax.au.websocket.WebSocketEndPoint.access$000(WebSocketEndPoint.java:56)
      	at org.zkoss.zkmax.au.websocket.WebSocketEndPoint$1.onMessage(WebSocketEndPoint.java:93)
      	at org.zkoss.zkmax.au.websocket.WebSocketEndPoint$1.onMessage(WebSocketEndPoint.java:90)
      	at org.eclipse.jetty.websocket.jsr356.messages.TextWholeMessage.messageComplete(TextWholeMessage.java:56)
      	at org.eclipse.jetty.websocket.jsr356.endpoints.JsrEndpointEventDriver.onTextFrame(JsrEndpointEventDriver.java:218)
      	at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.incomingFrame(AbstractEventDriver.java:162)
      	at org.eclipse.jetty.websocket.common.WebSocketSession.incomingFrame(WebSocketSession.java:375)
      	at org.eclipse.jetty.websocket.common.extensions.AbstractExtension.nextIncomingFrame(AbstractExtension.java:182)
      	at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension.nextIncomingFrame(PerMessageDeflateExtension.java:105)
      	at org.eclipse.jetty.websocket.common.extensions.compress.CompressExtension.forwardIncoming(CompressExtension.java:142)
      	at org.eclipse.jetty.websocket.common.extensions.compress.PerMessageDeflateExtension.incomingFrame(PerMessageDeflateExtension.java:85)
      	at org.eclipse.jetty.websocket.common.extensions.ExtensionStack.incomingFrame(ExtensionStack.java:220)
      	at org.eclipse.jetty.websocket.common.Parser.notifyFrame(Parser.java:220)
      	at org.eclipse.jetty.websocket.common.Parser.parse(Parser.java:256)
      	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.readParse(AbstractWebSocketConnection.java:679)
      	at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:511)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
      	at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
      	at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
      	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: javax.servlet.ServletException: Unable to encode ~./some/resource.png
      	at org.zkoss.web.servlet.http.Encodes.encodeURL(Encodes.java:402)
      	at org.zkoss.zk.ui.http.ExecutionImpl.encodeURL(ExecutionImpl.java:321)
      	... 49 more
      Caused by: java.lang.NullPointerException
      	at org.zkoss.web.servlet.Servlets.getExtWebCtxs(Servlets.java:1320)
      	at org.zkoss.web.servlet.Servlets.getExtendletContext(Servlets.java:1312)
      	at org.zkoss.web.servlet.http.Encodes.encodeURL0(Encodes.java:453)
      	at org.zkoss.web.servlet.http.Encodes.access$000(Encodes.java:48)
      	at org.zkoss.web.servlet.http.Encodes$1.encodeURL(Encodes.java:426)
      	at org.zkoss.web.servlet.http.Encodes.encodeURL(Encodes.java:399)
      	... 50 more
      

      Expected Result

      encode the resource URL correctly

      Debug Info

      _ctx is null in ExecutionImpl during a WebSocketExecution

        Attachments

          Activity

            People

            Assignee:
            wenninghsu wenninghsu
            Reporter:
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h