dongjoon-hyun commented on code in PR #41050:
URL: https://github.com/apache/spark/pull/41050#discussion_r1186440414


##########
core/src/main/scala/org/apache/spark/util/JsonProtocol.scala:
##########
@@ -1555,13 +1555,18 @@ private[spark] object JsonProtocol {
   }
 
   def stackTraceFromJson(json: JsonNode): Array[StackTraceElement] = {
-    json.extractElements.map { line =>
-      val declaringClass = line.get("Declaring Class").extractString
-      val methodName = line.get("Method Name").extractString
-      val fileName = jsonOption(line.get("File 
Name")).map(_.extractString).orNull
-      val lineNumber = line.get("Line Number").extractInt
-      new StackTraceElement(declaringClass, methodName, fileName, lineNumber)
-    }.toArray
+    jsonOption(json)
+      .map(
+        _.extractElements
+          .map { line =>
+            val declaringClass = line.get("Declaring Class").extractString
+            val methodName = line.get("Method Name").extractString
+            val fileName = jsonOption(line.get("File 
Name")).map(_.extractString).orNull
+            val lineNumber = line.get("Line Number").extractInt
+            new StackTraceElement(declaringClass, methodName, fileName, 
lineNumber)
+          }
+          .toArray)
+      .getOrElse(Array[StackTraceElement]())

Review Comment:
   ditto.
   ```scala
   -   }
   -   .toArray)
   - .getOrElse(Array[StackTraceElement]())
   + }..toArray).getOrElse(Array[StackTraceElement]())
   ```



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to