title: How does IOUtils.closeQuietly hide the "resource leak" warning?
body: <h2>Background</h2>
  
  <p>There is a nice function I use on <a href="http://commons.apache.org/proper/commons-io/download_io.cgi" rel="nofollow noreferrer"><strong>IOUtils</strong></a> called "closeQuietly" , which closes the stream no matter what is in there.</p>
  
  <p>for example:</p>
  
  <pre><code>InputStream input = null;
  try
    {
    ...
    input = connection.getInputStream();
    ...
    } 
  catch(Exception e)
    {
    }
  finally
    {
    IOUtils.closeQuietly(input);
    }
  </code></pre>
  
  <p>Somehow, it also hides the warning on Eclipse when I call it in the finally block , of "Resource leak: 'input' is not closed at this location" .</p>
  
  <p>This means that in the above code, there is no such warning.</p>
  
  <h2>The problem</h2>
  
  <p>I don't understand how it hides the warning on the "outside world" of itself.</p>
  
  <h2>What I've tried</h2>
  
  <p>I've tried to check it out by copying the code of this library (example <a href="http://grepcode.com/file_/repo1.maven.org/maven2/commons-io/commons-io/1.4/org/apache/commons/io/IOUtils.java/?v=source" rel="nofollow noreferrer"><strong>here</strong></a>), but the warning appears when I use it on the new class. It doesn't make sense...</p>
  
  <p>here's a sample code i've created to show that the warning will occur on your own classes:</p>
  
  <pre><code>public class MyIOUtils {
      public static void closeQuietly(final InputStream input) {
          if (input == null)
              return;
          try {
              input.close();
          } catch (final IOException ioe) {
          }
      }
  
      public static void closeQuietly(final OutputStream output) {
          if (output == null)
              return;
          try {
              output.close();
          } catch (final IOException ioe) {
          }
      }
  }
  </code></pre>
  
  <p>usage:</p>
  
  <pre><code>public class Test {
      public void test() {
          InputStream inputStream = null;
          try {
              inputStream = new FileInputStream("dummyFile.txt");
              int t = 0;
              --t;
              if (t &lt; 0)
                  return; // here you will get a warning
          } catch (final FileNotFoundException e) {
          } finally {
              MyIOUtils.closeQuietly(inputStream);
          }
      }
  }
  </code></pre>
  
  <p>Here's what I see, including the Eclipse version I have being installed:</p>
  
  <p><img src="https://i.stack.imgur.com/hKDkq.png" alt="enter image description here"></p>
  
  <h2>The question</h2>
  
  <p>How does it do it?</p>