jwang0306 commented on code in PR #45238:
URL: https://github.com/apache/spark/pull/45238#discussion_r1505389956


##########
core/src/main/scala/org/apache/spark/serializer/JavaSerializer.scala:
##########
@@ -118,22 +118,24 @@ private[spark] class JavaSerializerInstance(
 
   override def serialize[T: ClassTag](t: T): ByteBuffer = {
     val bos = new ByteBufferOutputStream()
-    val out = serializeStream(bos)
-    out.writeObject(t)
-    out.close()
+    Utils.tryWithResource(serializeStream(bos)) { out =>

Review Comment:
   Ack, thanks for pointing this out. I'll handle them together as suggested.



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