mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 04:22:01 -08:00
Merge branches 'hotfix/close-unclosed-resources-mage-client', 'hotfix/close-streams-in-updater', 'hotfix/fix-non-closed-scanner' and 'hotfix/manapiechart-potential-zero-division' into feature/SonarqubeFixes
This commit is contained in:
commit
4bc5a9bd61
6 changed files with 61 additions and 19 deletions
21
Mage.Common/src/main/java/mage/utils/StreamUtils.java
Normal file
21
Mage.Common/src/main/java/mage/utils/StreamUtils.java
Normal 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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue