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

Comet NPE during encodeURL (Jetty)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 9.6.0
    • 6.5.3, 9.5.1.1
    • ZK Update Engine
    • Security Level: Jimmy
    • reproduced with latest Jetty 9.4.38.v20210224
      works in Tomcat 9.0.38.0

    • None

      Steps to Reproduce

      same example as: ZK-4825

      Current Result

      org.zkoss.zk.ui.UiException: javax.servlet.ServletException: Unable to encode /zkau/web/img/spacer.gif
      	at org.zkoss.zk.ui.http.ExecutionImpl.encodeURL(ExecutionImpl.java:323)
      	at org.zkoss.zul.Image.getEncodedURL(Image.java:246)
      	at org.zkoss.zul.Image.renderProperties(Image.java:332)
      	at org.zkoss.zk.ui.AbstractComponent.redraw(AbstractComponent.java:2175)
      	at org.zkoss.zk.ui.impl.UiVisualizer.redraw(UiVisualizer.java:1003)
      	at org.zkoss.zk.ui.impl.UiVisualizer.redrawComponents(UiVisualizer.java:1017)
      	at org.zkoss.zk.ui.impl.UiVisualizer.addResponsesForCreatedPerSiblings(UiVisualizer.java:869)
      	at org.zkoss.zk.ui.impl.UiVisualizer.getResponses(UiVisualizer.java:733)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.getResponses(UiEngineImpl.java:1569)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.endUpdate(UiEngineImpl.java:1232)
      	at org.zkoss.zkex.ui.comet.CometServerPush.deactivate(CometServerPush.java:535)
      	at org.zkoss.zk.ui.impl.DesktopImpl.deactivateServerPush(DesktopImpl.java:1682)
      	at org.zkoss.zk.ui.Executions.deactivate(Executions.java:1011)
             ...
      Caused by: javax.servlet.ServletException: Unable to encode /zkau/web/img/spacer.gif
      	at org.zkoss.web.servlet.http.Encodes.encodeURL(Encodes.java:402)
      	at org.zkoss.zk.ui.http.ExecutionImpl.encodeURL(ExecutionImpl.java:321)
      	... 29 common frames omitted
      Caused by: java.lang.NullPointerException: null
      	at org.zkoss.web.servlet.http.Encodes.encodeURL0(Encodes.java:490)
      	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)
      	... 30 common frames omitted
      

      Expected Result

      working url encoding

      Debug Information

      the servlet spec doesn't seem to be 100% precise there so different vendors implement different behavior
      Here jetty's explanation/recommendation for a similar case (maybe can be adapted to match our needs)
      https://github.com/eclipse/jetty.project/issues/1459

      https://github.com/zkoss/zk/commit/2b3cf0b1177fa1c8cef0da79054676f22dc53e81

      Workaround

            rudyhuang rudyhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 3 days
                3d
                Remaining:
                Time Spent - 3 hours Remaining Estimate - 2 days, 5 hours
                2d 5h
                Logged:
                Time Spent - 3 hours Remaining Estimate - 2 days, 5 hours
                3h