This is an automated email from the ASF dual-hosted git repository.
jongyoul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 2147d79acb [ZEPPELIN-6548] Use specific exceptions for Spark Scala
fallback detection
2147d79acb is described below
commit 2147d79acbca4d06d87e52b06e41228e17e04e8d
Author: Minho Jang <[email protected]>
AuthorDate: Sun Aug 9 23:15:46 2026 +0900
[ZEPPELIN-6548] Use specific exceptions for Spark Scala fallback detection
### What is this PR for?
This PR refines exception types in `SparkInterpreterLauncher` when the
fallback Spark Scala version detection validates the `SPARK_HOME/jars` layout.
Previously, `detectSparkScalaVersionByReplClass(...)` threw generic
`Exception` for expected validation failures such as missing or duplicate
`spark-repl` jars, or an unsupported `spark-repl` Scala suffix. This PR
replaces those generic throw sites with more specific exception types while
keeping the existing messages and caller behavior unchanged.
Missing or duplicate `spark-repl` jars now throw `IOException`, and an
unrecognized Scala suffix now throws `IllegalArgumentException`.
This PR is a follow-up to
[ZEPPELIN-6464](https://issues.apache.org/jira/browse/ZEPPELIN-6464)
### What type of PR is it?
Improvement
### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-6548
### How should this be tested?
- Build and run the module tests:
```
./mvnw test -pl zeppelin-server --am
```
### Questions:
* Does the license files need to update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Closes #5340 from
miinhho/refactor/specific-exception-in-spark-scala-fallback.
Signed-off-by: Jongyoul Lee <[email protected]>
---
.../zeppelin/interpreter/launcher/SparkInterpreterLauncher.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git
a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncher.java
b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncher.java
index 98e0e5e0b8..b2b01685ee 100644
---
a/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncher.java
+++
b/zeppelin-server/src/main/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncher.java
@@ -318,10 +318,10 @@ public class SparkInterpreterLauncher extends
StandardInterpreterLauncher {
}
if (sparkReplJars.isEmpty()) {
- throw new Exception("No spark-repl jar found in SPARK_HOME: " +
sparkHome);
+ throw new IOException("No spark-repl jar found in SPARK_HOME: " +
sparkHome);
}
if (sparkReplJars.size() > 1) {
- throw new Exception("Multiple spark-repl jar found in SPARK_HOME: " +
sparkHome);
+ throw new IOException("Multiple spark-repl jar found in SPARK_HOME: " +
sparkHome);
}
String fileName = sparkReplJars.get(0).getFileName().toString();
@@ -330,7 +330,7 @@ public class SparkInterpreterLauncher extends
StandardInterpreterLauncher {
} else if (fileName.contains("spark-repl_2.13")) {
return "2.13";
} else {
- throw new Exception("Can not detect the scala version by spark-repl");
+ throw new IllegalArgumentException("Can not detect the scala version by
spark-repl");
}
}