package org.pharmgkb.common.util;

import java.io.Closeable;
import java.lang.invoke.MethodHandles;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * Utility methods for working with I/O.
 *
 * @author Mark Woon
 */
public class IoUtils {
  private static final Logger sf_logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());


  /**
   * Private constructor to prevent instantiation of utility class.
   */
  private IoUtils() {
  }


  public static void closeQuietly(Closeable closeable) {
    try {
      closeable.close();
    } catch (Exception ex) {
      sf_logger.warn("Error closing {}", closeable.getClass(), ex);
    }
  }
}

@@ -93,16 +93,76 @@
 andles;%0A
+import org.checkerframework.checker.nullness.qual.Nullable;%0A
 import o
@@ -557,16 +557,26 @@
 Quietly(
+@Nullable 
 Closeabl
@@ -586,24 +586,55 @@
 loseable) %7B%0A
+    if (closeable != null) %7B%0A  
     try %7B%0A  
@@ -637,16 +637,18 @@
 %7B%0A      
+ 
+ 
 closeabl
@@ -658,16 +658,18 @@
 lose();%0A
+  
     %7D ca
@@ -685,24 +685,26 @@
 ption ex) %7B%0A
+  
       sf_log
@@ -759,16 +759,24 @@
 ), ex);%0A
+      %7D%0A
     %7D%0A  

Allow nulls to closeQuietly.