Commit 09819e28 authored by Geoffrey Métais's avatar Geoffrey Métais

Avoid NPE instead of catching it

parent 6fbe1773
......@@ -282,12 +282,15 @@ public class Util {
}
public static boolean close(Closeable closeable) {
try {
closeable.close();
return true;
} catch (IOException e) {
return false;
} catch (NullPointerException e) {
return false;}
if (closeable != null) {
try {
closeable.close();
return true;
} catch (IOException e) {
return false;
}
} else {
return false;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment