diff options
author | Aaron Davidson <aaron@databricks.com> | 2014-11-08 13:03:51 -0800 |
---|---|---|
committer | Reynold Xin <rxin@databricks.com> | 2014-11-08 13:03:51 -0800 |
commit | 4af5c7e24455246c61c1f3c22225507e720d721d (patch) | |
tree | bf781ece8ec98f25530d838168c427841ef36efd /network/common/src/main | |
parent | 7afc8564f33eb2868f458f85046f59a51b516ed6 (diff) | |
download | spark-4af5c7e24455246c61c1f3c22225507e720d721d.tar.gz spark-4af5c7e24455246c61c1f3c22225507e720d721d.tar.bz2 spark-4af5c7e24455246c61c1f3c22225507e720d721d.zip |
[Minor] [Core] Don't NPE on closeQuietly(null)
Author: Aaron Davidson <aaron@databricks.com>
Closes #3166 from aarondav/closeQuietlyer and squashes the following commits:
78096b5 [Aaron Davidson] Don't NPE on closeQuietly(null)
Diffstat (limited to 'network/common/src/main')
-rw-r--r-- | network/common/src/main/java/org/apache/spark/network/util/JavaUtils.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/network/common/src/main/java/org/apache/spark/network/util/JavaUtils.java b/network/common/src/main/java/org/apache/spark/network/util/JavaUtils.java index 009dbcf013..bf8a1fc42f 100644 --- a/network/common/src/main/java/org/apache/spark/network/util/JavaUtils.java +++ b/network/common/src/main/java/org/apache/spark/network/util/JavaUtils.java @@ -44,7 +44,9 @@ public class JavaUtils { /** Closes the given object, ignoring IOExceptions. */ public static void closeQuietly(Closeable closeable) { try { - closeable.close(); + if (closeable != null) { + closeable.close(); + } } catch (IOException e) { logger.error("IOException should not have been thrown.", e); } |