ChoiByungHo created ZEPPELIN-6259:
-------------------------------------
Summary: Add null safety checks in
SparkInterpreterLauncher.detectSparkScalaVersionByReplClass
Key: ZEPPELIN-6259
URL: https://issues.apache.org/jira/browse/ZEPPELIN-6259
Project: Zeppelin
Issue Type: Bug
Reporter: ChoiByungHo
Assignee: ChoiByungHo
Description
The `detectSparkScalaVersionByReplClass` method in
`SparkInterpreterLauncher.java` lacks null safety checks that could lead to
NullPointerException when the spark jars directory is inaccessible or doesn't
exist.
Current Issue
Missing null check for listFiles() result
{code:java}
File[] sparkJarFiles = sparkJarsFolder.listFiles();
long sparkReplFileNum = Stream.of(sparkJarFiles).filter(...).count(); // NPE
if sparkJarFiles is null {code}
The listFiles() method returns null when:
- The directory doesn't exist
- The path exists but is not a directory
- An I/O error occurs
- Security manager denies read access
Impact
- NullPointerException: Application crash when SPARK_HOME/jars is inaccessible
- Poor error messages: Users get cryptic NPE instead of meaningful error
- Difficult debugging: Root cause is obscured by NPE
--
This message was sent by Atlassian Jira
(v8.20.10#820010)