From 72685b1d819d0fda74ebf17a489080059051baed Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 4 Feb 2020 13:41:31 +0100 Subject: [PATCH] Polish contribution See gh-24393 --- .../org/springframework/util/FileCopyUtils.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/util/FileCopyUtils.java b/spring-core/src/main/java/org/springframework/util/FileCopyUtils.java index 981243b5de..3e78995a58 100644 --- a/spring-core/src/main/java/org/springframework/util/FileCopyUtils.java +++ b/spring-core/src/main/java/org/springframework/util/FileCopyUtils.java @@ -224,16 +224,15 @@ public abstract class FileCopyUtils { } /** - * Close the {@link Closeable} as a null-safety. - * - * @param closeable to close, may be null. + * Attempt to close the supplied {@link Closeable}, silently swallowing any + * exceptions. + * @param closeable the {@code Closeable} to close */ - private static void close(@Nullable Closeable closeable) { - if (closeable == null) return; + private static void close(Closeable closeable) { try { closeable.close(); - } catch (IOException e) { - // do nothing + } catch (IOException ex) { + // ignore } }