Kev Jackson wrote:
This came up before, but I forgot what the consensus was

Not sure there was a consensus (or that anyone cared enough).

Whenever FileUtils.close() is used, any resulting exceptions are
swallowed and no logging is performed.  I'd like to propose that
instead of this "silent death" for close, that there is instead a
record of what happened, but that the record is voluntary

That's one option. Another is to just assume the worst and throw the IOException from whatever.close() - i.e. don't use FileUtil.close at all. This idiom is

public void doWhatever() throws IOException {
    InputStream is = ...;
    try {
        // read from is...
    } finally {
        is.close();
    }
}

or alternatively

try {
    InputStream is = ...;
    try {
        // read from is...
    } finally {
        is.close();
    }
} catch (IOException e) {
    // handle...
}

-J.

--
[EMAIL PROTECTED]   x22801   netbeans.org   ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to