added quiet closing method in new streamutils class, used to clean up the connectdialog

This commit is contained in:
Marc Zwart 2018-03-20 12:46:53 +01:00
parent 0da4e10c49
commit 9912a23007
2 changed files with 28 additions and 11 deletions

View file

@ -0,0 +1,21 @@
package mage.utils;
import java.io.Closeable;
public final class StreamUtils {
/***
* Quietly closes the closable, ignoring nulls and exceptions
* @param c - the closable to be closed
*/
public static void closeQuietly(Closeable c) {
if (c != null) {
try {
c.close();
}
catch (Exception e) {
}
}
}
}