tirthooo7 commented on code in PR #21394:
URL: https://github.com/apache/kafka/pull/21394#discussion_r2789433591


##########
vagrant/base.sh:
##########
@@ -32,12 +32,26 @@ fetch_jdk_tgz() {
 
   if [ ! -e $path ]; then
     mkdir -p $(dirname $path)
-    curl --retry 5 -s -L 
"https://s3-us-west-2.amazonaws.com/kafka-packages/jdk-${jdk_version}.tar.gz"; 
-o $path
+    curl --retry 5 -s -L 
"https://s3-us-west-2.amazonaws.com/kafka-packages/jdk/jdk-${jdk_version}.tar.gz";
 -o $path
   fi
 }
 
-JDK_MAJOR="${JDK_MAJOR:-17}"
-JDK_FULL="${JDK_FULL:-17-linux-x64}"
+# Validate JDK_MAJOR - must be a version number (e.g., 8u144, 17, 25.0.1), 
default to 17 if empty or invalid
+if [[ -z "$JDK_MAJOR" || ! "$JDK_MAJOR" =~ ^[0-9]+(u[0-9]+|(\.[0-9]+)+)?$ ]]; 
then
+    JDK_MAJOR="17"
+fi
+
+# Validate JDK_ARCH - default to x64 if empty or invalid
+if [[ -z "$JDK_ARCH" || ! "$JDK_ARCH" =~ ^(x64|aarch64)$ ]]; then
+    JDK_ARCH="x64"

Review Comment:
   We want to avoid breaking any existing workflows, so I don’t think we should 
throw an exception here. Defaulting to this behavior makes sense, but I can add 
a warning log to flag the invalid format.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to