Skip to content

Commit

Permalink
[LIVY-986][SERVER] Adding null pointer check for SessionInfo (#412)
Browse files Browse the repository at this point in the history
We need to add a null check for SessionInfo in InteractiveSessionServlet.scala to avoid an exception that might occur during a Livy upgrade.
  • Loading branch information
askhatri authored Aug 18, 2023
1 parent 074d6a2 commit 4cee47d
Showing 1 changed file with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,34 @@ class InteractiveSessionServlet(
Nil
}

val conf = if (session.conf != null) {
session.conf.asJava
} else null

val archives = if (session.archives != null) {
session.archives.asJava
} else null

val jars = if (session.jars != null) {
session.jars.asJava
} else null

val pyFiles = if (session.pyFiles != null) {
session.pyFiles.asJava
} else null

val files = if (session.files != null) {
session.files.asJava
} else null

new SessionInfo(session.id, session.name.orNull, session.appId.orNull,
session.owner, session.state.toString, session.kind.toString,
session.appInfo.asJavaMap, logs.asJava,
session.proxyUser.orNull, session.driverMemory.orNull,
session.driverCores.getOrElse(0), session.executorMemory.orNull,
session.executorCores.getOrElse(0), session.conf.asJava, session.archives.asJava,
session.files.asJava, session.heartbeatTimeoutS, session.jars.asJava,
session.numExecutors.getOrElse(0), session.proxyUser.orNull, session.pyFiles.asJava,
session.executorCores.getOrElse(0), conf, archives,
files, session.heartbeatTimeoutS, jars,
session.numExecutors.getOrElse(0), session.proxyUser.orNull, pyFiles,
session.queue.orNull)
}

Expand Down

0 comments on commit 4cee47d

Please sign in to comment.