!58 Javadocs search sends you to a non-existent URL

From: @sundapeng001 
Reviewed-by: @hu-zongtang 
Signed-off-by: @hu-zongtang
This commit is contained in:
openeuler-ci-bot 2023-12-08 08:04:34 +00:00 committed by Gitee
commit 0159004f7d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,42 @@
diff --git a/build.gradle b/build.gradle
index 5e8b82237a..0a181019cb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2296,4 +2296,37 @@ task aggregatedJavadoc(type: Javadoc, dependsOn: compileJava) {
options.links "https://docs.oracle.com/en/java/javase/${JavaVersion.current().majorVersion}/docs/api/"
else
options.links "https://docs.oracle.com/javase/8/docs/api/"
+ // TODO: remove this snippet once JDK >11 is used or https://bugs.openjdk.java.net/browse/JDK-8215291 is backported to JDK11
+ // Patch to include `getURLPrefix` from JDK 12 +
+ // NOTICE: This code was copied from original ORACLE search.js file present in JDK 12 and newer
+ final SEARCH_PATCH_MODULE_LESS_AWARE = "\n\n" +
+ "// Fix for moudle-less aware search\n" +
+ "function getURLPrefix(ui) {\n" +
+ " var urlPrefix=\"\";\n" +
+ " var slash = \"/\";\n" +
+ " if (ui.item.category === catModules) {\n" +
+ " return ui.item.l + slash;\n" +
+ " } else if (ui.item.category === catPackages && ui.item.m) {\n" +
+ " return ui.item.m + slash;\n" +
+ " } else if (ui.item.category === catTypes || ui.item.category === catMembers) {\n" +
+ " if (ui.item.m) {\n" +
+ " urlPrefix = ui.item.m + slash;\n" +
+ " } else {\n" +
+ " \$.each(packageSearchIndex, function(index, item) {\n" +
+ " if (item.m && ui.item.p === item.l) {\n" +
+ " urlPrefix = item.m + slash;\n" +
+ " }\n" +
+ " });\n" +
+ " }\n" +
+ " }\n" +
+ " return urlPrefix;\n" +
+ "}"
+
+ // When all the JavaDoc is generated we proceed to patch the search.js file
+ doLast {
+ def searchJsFile = new File(destinationDir.getAbsolutePath() + '/search.js')
+ // Append the patch to the file. By being defined at a later position, JS will execute that definition instead of
+ // the one provided by default (higher up in the file).
+ searchJsFile.append SEARCH_PATCH_MODULE_LESS_AWARE
+ }
}

View File

@ -4,7 +4,7 @@
Name: kafka Name: kafka
Version: 2.8.2 Version: 2.8.2
Release: 15 Release: 16
Summary: A Distributed Streaming Platform. Summary: A Distributed Streaming Platform.
License: Apache-2.0 License: Apache-2.0
@ -27,6 +27,7 @@ Patch11: 0012-incorrectly-LeaderElectionCommand.patch
Patch12: 0013-AlterIsr.patch Patch12: 0013-AlterIsr.patch
Patch13: 0014-override-toString.patch Patch13: 0014-override-toString.patch
Patch14: 0015-SessionWindows-closed-early.patch Patch14: 0015-SessionWindows-closed-early.patch
Patch15: 0016-non-existent-URL.patch
BuildRequires: systemd java-1.8.0-openjdk-devel BuildRequires: systemd java-1.8.0-openjdk-devel
Provides: kafka = %{version} Provides: kafka = %{version}
@ -78,6 +79,8 @@ cp -pr licenses/* $RPM_BUILD_ROOT%{kafka_home}/licenses
rm -rf %{buildroot} rm -rf %{buildroot}
%changelog %changelog
* Fri Dec 08 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-16
- Javadocs search sends you to a non-existent URL
* Fri Dec 08 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-15 * Fri Dec 08 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-15
- SessionWindows are closed too early - SessionWindows are closed too early
* Fri Dec 08 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-14 * Fri Dec 08 2023 sundapeng <sundapeng_yewu@cmss.chinamobile.com> - 2.8.2-14