Background
----------

There is a nice function I use on [**IOUtils**](http://commons.apache.org/proper/commons-io/download_io.cgi) called "closeQuietly" , which closes the stream no matter what is in there.

for example:

```
InputStream input = null;
try
  {
  ...
  input = connection.getInputStream();
  ...
  } 
catch(Exception e)
  {
  }
finally
  {
  IOUtils.closeQuietly(input);
  }

```

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" .

This means that in the above code, there is no such warning.

The problem
-----------

I don't understand how it hides the warning on the "outside world" of itself.

What I've tried
---------------

I've tried to check it out by copying the code of this library (example [**here**](http://grepcode.com/file_/repo1.maven.org/maven2/commons-io/commons-io/1.4/org/apache/commons/io/IOUtils.java/?v=source)), but the warning appears when I use it on the new class. It doesn't make sense...

here's a sample code i've created to show that the warning will occur on your own classes:

```
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) {
        }
    }
}

```

usage:

```
public class Test {
    public void test() {
        InputStream inputStream = null;
        try {
            inputStream = new FileInputStream("dummyFile.txt");
            int t = 0;
            --t;
            if (t < 0)
                return; // here you will get a warning
        } catch (final FileNotFoundException e) {
        } finally {
            MyIOUtils.closeQuietly(inputStream);
        }
    }
}

```

Here's what I see, including the Eclipse version I have being installed:

![enter image description here](https://i.stack.imgur.com/hKDkq.png)

The question
------------

How does it do it?