This is an automated email from the ASF dual-hosted git repository.
smolnar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git
The following commit(s) were added to refs/heads/master by this push:
new fad4c0f77 KNOX-3210 - Use a common function to set JDK17 properties
across all scripts (#1102)
fad4c0f77 is described below
commit fad4c0f77db993173b6f8e7a8b30ec9d7e68d706
Author: Sandor Molnar <[email protected]>
AuthorDate: Tue Oct 28 14:33:49 2025 +0100
KNOX-3210 - Use a common function to set JDK17 properties across all
scripts (#1102)
---
gateway-release-common/home/bin/knox-functions.sh | 18 +++++++++++-------
gateway-release/home/bin/knoxcli.sh | 8 +-------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/gateway-release-common/home/bin/knox-functions.sh
b/gateway-release-common/home/bin/knox-functions.sh
index c54ebbd67..7cea1c5e8 100644
--- a/gateway-release-common/home/bin/knox-functions.sh
+++ b/gateway-release-common/home/bin/knox-functions.sh
@@ -159,6 +159,16 @@ function addAppJavaOpts {
done
}
+function addJdk17Properties {
+ # Add properties to enable Knox to run on JDK 17
+ JAVA_VERSION=$("$JAVA" -version 2>&1 | awk -F '"' '/version/ {print $2}')
+ CHECK_VERSION_17="17"
+ if [[ "$JAVA_VERSION" == *"$CHECK_VERSION_17"* ]]; then
+ echo "Java version is $CHECK_VERSION_17. Adding properties to enable
Knox to run on JDK 17"
+ addAppJavaOpts " --add-exports java.base/sun.security.x509=ALL-UNNAMED
--add-exports java.base/sun.security.pkcs=ALL-UNNAMED --add-exports
java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-opens
java.base/sun.security.util=ALL-UNNAMED --add-exports
java.base/jdk.internal.misc=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED --add-exports
java.base/sun.net.util=ALL-UNNAMED --add-exports
java.base/sun.net.dns=ALL-UNNAMED"
+ fi
+}
+
function buildAppJavaOpts {
if [ -n "$APP_MEM_OPTS" ]; then
addAppJavaOpts "${APP_MEM_OPTS}"
@@ -176,13 +186,7 @@ function buildAppJavaOpts {
addAppJavaOpts "${APP_JAVA_LIB_PATH}"
fi
- # Add properties to enable Knox to run on JDK 17
- JAVA_VERSION=$("$JAVA" -version 2>&1 | awk -F '"' '/version/ {print $2}')
- CHECK_VERSION_17="17"
- if [[ "$JAVA_VERSION" == *"$CHECK_VERSION_17"* ]]; then
- echo "Java version is $CHECK_VERSION_17. Adding properties to enable
Knox to run on JDK 17"
- addAppJavaOpts " --add-exports java.base/sun.security.x509=ALL-UNNAMED
--add-exports java.base/sun.security.pkcs=ALL-UNNAMED --add-exports
java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-opens
java.base/sun.security.util=ALL-UNNAMED --add-exports
java.base/jdk.internal.misc=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED --add-exports
java.base/sun.net.util=ALL-UNNAMED --add-exports
java.base/sun.net.dns=ALL-UNNAMED"
- fi
+ addJdk17Properties
# echo "APP_JAVA_OPTS =" "${APP_JAVA_OPTS[@]}"
}
diff --git a/gateway-release/home/bin/knoxcli.sh
b/gateway-release/home/bin/knoxcli.sh
index a1569d75b..4d5e0a920 100755
--- a/gateway-release/home/bin/knoxcli.sh
+++ b/gateway-release/home/bin/knoxcli.sh
@@ -62,13 +62,7 @@ function buildAppJavaOpts {
addAppJavaOpts "${APP_JAVA_LIB_PATH}"
fi
- # Add properties to enable Knox to run on JDK 17
- JAVA_VERSION=$("$JAVA" -version 2>&1 | awk -F '"' '/version/ {print $2}')
- CHECK_VERSION_17="17"
- if [[ "$JAVA_VERSION" == *"$CHECK_VERSION_17"* ]]; then
- echo "Java version is $CHECK_VERSION_17. Adding properties to enable
Knox to run on JDK 17"
- addAppJavaOpts " --add-exports java.base/sun.security.x509=ALL-UNNAMED
--add-exports java.base/sun.security.pkcs=ALL-UNNAMED --add-exports
java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-opens
java.base/sun.security.util=ALL-UNNAMED"
- fi
+ addJdk17Properties
# echo "APP_JAVA_OPTS =" "${APP_JAVA_OPTS[@]}"
}