This is an automated email from the ASF dual-hosted git repository.
yuqi1129 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new f461aa31aa [#12444] fix(scripts): Prevent empty classpath entry in
common.sh (#12537)
f461aa31aa is described below
commit f461aa31aa758e9b8f2743795a34fc31f8456a68
Author: 张万义 <[email protected]>
AuthorDate: Sat Aug 22 21:32:48 2026 +0800
[#12444] fix(scripts): Prevent empty classpath entry in common.sh (#12537)
### What changes were proposed in this pull request?
Fix the empty classpath entry issue in `common.sh`. When
`GRAVITINO_CLASSPATH` is initially unset, the previous code
`GRAVITINO_CLASSPATH+=":${GRAVITINO_CONF_DIR}"` would produce a
classpath starting with a colon separator, resulting in an empty entry
that Java interprets as the current working directory.
This PR changes the classpath initialization to check if
`GRAVITINO_CLASSPATH` is already set before appending the config
directory.
### Why are the changes needed?
Fix: #12444. An empty classpath entry allows classes from the working
directory to be loaded by the application classloader, which can shadow
dependencies from catalog classloaders.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Existing tests.
---
bin/common.sh.template | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/bin/common.sh.template b/bin/common.sh.template
index 1f38dd38b8..b7642b3d3a 100644
--- a/bin/common.sh.template
+++ b/bin/common.sh.template
@@ -51,7 +51,11 @@ if [[ -z "${GRAVITINO_VERSION}" ]]; then
exit 1
fi
-GRAVITINO_CLASSPATH+=":${GRAVITINO_CONF_DIR}"
+if [[ -n "${GRAVITINO_CLASSPATH}" ]]; then
+ GRAVITINO_CLASSPATH="${GRAVITINO_CLASSPATH}:${GRAVITINO_CONF_DIR}"
+else
+ GRAVITINO_CLASSPATH="${GRAVITINO_CONF_DIR}"
+fi
JVM_VERSION=8
function check_java_version() {