-
Bug
-
Resolution: Fixed
-
Normal
-
9.5.1
-
Security Level: Jimmy
-
None
Steps to Reproduce
append a default <image> (with no URL) in an activated server push thread
<zk> <zscript><![CDATA[ desktop.enableServerPush(true); ]]></zscript> <div id="parent"> <button label="create image"> <attribute name="onClick"><![CDATA[ Desktop dt = desktop; new Thread() { public void run() { Thread.sleep(200); Executions.activate(dt); parent.appendChild(new Image()); //more isolated way to reproduce without <image> //System.out.println(Executions.getCurrent().encodeURL("~./img/spacer.gif")); Executions.deactivate(dt); } }.start(); ]]></attribute> </button> </div> </zk>
click the button "create image"
Current Result
java.lang.NullPointerException: null at org.zkoss.web.servlet.Servlets.getExtWebCtxs(Servlets.java:1330) at org.zkoss.web.servlet.Servlets.getExtendletContext(Servlets.java:1322) 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) at org.zkoss.zk.ui.http.ExecutionImpl.encodeURL(ExecutionImpl.java:321) at org.zkoss.zul.Image.getEncodedURL(Image.java:246) at org.zkoss.zul.Image.renderProperties(Image.java:332)
Expected Result
render empty image, no error
Debug Information
the ExecutionImpl is created with a null servlet context (first parameter) during server push activation:
problem happens with "~./" urls in general not just with image urls
System.out.println(Executions.getCurrent().encodeURL("~./img/spacer.gif"));
Workaround
create an image with the full image url
new Image("/zkau/web/img/spacer.gif")
- relates to
-
ZK-4842 Comet NPE during encodeURL (Jetty)
- Closed