Skip to content

Commit 4af5c7e

Browse files
aarondavrxin
authored andcommitted
[Minor] [Core] Don't NPE on closeQuietly(null)
Author: Aaron Davidson <[email protected]> Closes #3166 from aarondav/closeQuietlyer and squashes the following commits: 78096b5 [Aaron Davidson] Don't NPE on closeQuietly(null)
1 parent 7afc856 commit 4af5c7e

File tree

1 file changed

+3
-1
lines changed
  • network/common/src/main/java/org/apache/spark/network/util

1 file changed

+3
-1
lines changed

network/common/src/main/java/org/apache/spark/network/util/JavaUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public class JavaUtils {
4444
/** Closes the given object, ignoring IOExceptions. */
4545
public static void closeQuietly(Closeable closeable) {
4646
try {
47-
closeable.close();
47+
if (closeable != null) {
48+
closeable.close();
49+
}
4850
} catch (IOException e) {
4951
logger.error("IOException should not have been thrown.", e);
5052
}

0 commit comments

Comments
 (0)