From b2d0dc76283a9a1a99386a8383222b983b1ecd6e Mon Sep 17 00:00:00 2001 From: Asif Khatri Date: Wed, 16 Aug 2023 23:02:06 +0530 Subject: [PATCH] [LIVY-986][SERVER] Adding null pointer check for SessionInfo --- .../InteractiveSessionServlet.scala | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/server/src/main/scala/org/apache/livy/server/interactive/InteractiveSessionServlet.scala b/server/src/main/scala/org/apache/livy/server/interactive/InteractiveSessionServlet.scala index 239936f3b..a30f2a418 100644 --- a/server/src/main/scala/org/apache/livy/server/interactive/InteractiveSessionServlet.scala +++ b/server/src/main/scala/org/apache/livy/server/interactive/InteractiveSessionServlet.scala @@ -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) }