WeichenXu123 commented on a change in pull request #34187:
URL: https://github.com/apache/spark/pull/34187#discussion_r724113748
##########
File path: mllib/src/main/scala/org/apache/spark/ml/image/ImageSchema.scala
##########
@@ -133,9 +133,7 @@ object ImageSchema {
val img = try {
ImageIO.read(new ByteArrayInputStream(bytes))
} catch {
- // Catch runtime exception because `ImageIO` may throw unexpected
`RuntimeException`.
- // But do not catch the declared `IOException` (regarded as FileSystem
failure)
- case _: RuntimeException => null
+ case _: Throwable => null
Review comment:
Let's add comment say because we read from memory bytes, so no real IO
exceptions will happen, then we can catch all exceptions as invalid image
exception. also mention the IIOException may be raised if hit invalid image
--
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]