From 6ba34adb23c11a16c9a6d19a36d0c951acf03b55 Mon Sep 17 00:00:00 2001 From: Jamson Chan <86592497+JamsonChan@users.noreply.github.com> Date: Mon, 18 Dec 2023 17:13:12 +0800 Subject: [PATCH] ZK-5598: CKEditor requests ExecutionImpl.encodeURL with null value, causes NPE in embedded mode (#3094) Co-authored-by: Jumper Chen --- .../org/zkoss/zk/ui/http/ExecutionImpl.java | 2 ++ zkdoc/release-note | 1 + .../src/main/webapp/test2/B100-ZK-5598.html | 26 +++++++++++++++++++ zktest/src/main/webapp/test2/B100-ZK-5598.zul | 16 ++++++++++++ .../src/main/webapp/test2/config.properties | 1 + 5 files changed, 46 insertions(+) create mode 100644 zktest/src/main/webapp/test2/B100-ZK-5598.html create mode 100644 zktest/src/main/webapp/test2/B100-ZK-5598.zul diff --git a/zk/src/main/java/org/zkoss/zk/ui/http/ExecutionImpl.java b/zk/src/main/java/org/zkoss/zk/ui/http/ExecutionImpl.java index aac06f1167..005a24186d 100644 --- a/zk/src/main/java/org/zkoss/zk/ui/http/ExecutionImpl.java +++ b/zk/src/main/java/org/zkoss/zk/ui/http/ExecutionImpl.java @@ -317,6 +317,8 @@ public void setVoided(boolean voided) { } public String encodeURL(String uri) { + if (uri == null || uri.isEmpty()) // ZK-5598 + return uri; try { String encodedURL = Encodes.encodeURL(_ctx, _request, _response, uri); String zkHostURL = (String) getDesktop().getAttribute("org.zkoss.desktop.auHost"); diff --git a/zkdoc/release-note b/zkdoc/release-note index c9594307cd..7ceb25507e 100644 --- a/zkdoc/release-note +++ b/zkdoc/release-note @@ -18,6 +18,7 @@ ZK 10.0.0 ZK-5522: CommonFns.formatNumber() doesn't handle null as javadoc mentions ZK-5569: Radiogroup onCheck event type mismatch ZK-5161: page directive's attributes are not encoded before rendering into HTML + ZK-5598: CKEditor requests ExecutionImpl.encodeURL with null value, causes NPE in embedded mode * Upgrade Notes + Upgrade commons-fileupload to commons-fileupload2-javax 2.0.0-M1 and commons-io to 2.13.0 to support jakarta-friendly uploads diff --git a/zktest/src/main/webapp/test2/B100-ZK-5598.html b/zktest/src/main/webapp/test2/B100-ZK-5598.html new file mode 100644 index 0000000000..e9197302ea --- /dev/null +++ b/zktest/src/main/webapp/test2/B100-ZK-5598.html @@ -0,0 +1,26 @@ + + + + + + + + +
Set Library Property org.zkoss.web.servlet.http.embedded.enabled to true in zk.xml to enable embedded mode.
+
If you didn't see the ckeditor below, the bug still exist
+
(This bug triggered when use absolute-path to embedded a zul.
+
+ + + \ No newline at end of file diff --git a/zktest/src/main/webapp/test2/B100-ZK-5598.zul b/zktest/src/main/webapp/test2/B100-ZK-5598.zul new file mode 100644 index 0000000000..ce1255c8d4 --- /dev/null +++ b/zktest/src/main/webapp/test2/B100-ZK-5598.zul @@ -0,0 +1,16 @@ + + + + + \ No newline at end of file diff --git a/zktest/src/main/webapp/test2/config.properties b/zktest/src/main/webapp/test2/config.properties index 0135b74e34..0a08371caf 100644 --- a/zktest/src/main/webapp/test2/config.properties +++ b/zktest/src/main/webapp/test2/config.properties @@ -3109,6 +3109,7 @@ B90-ZK-4431.zul=A,E,Multislider ##zats##B100-ZK-5522.zul=A,E,CommonFns,formatNumber ##zats##B100-ZK-5569.zul=A,E,Radiogroup,onCheck ##zats##B100-ZK-5161.zul=A,E,XSS,Security,Page +##Manually##B100-ZK-5598.zul=A,E,CKEditor,Embedded,NPE ## # Features - 3.0.x version