You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2013/11/25 18:46:36 UTC

[jira] [Updated] (HTTPCORE-363) Unnecessary call to isOpen() before calling close

     [ https://issues.apache.org/jira/browse/HTTPCORE-363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-363:
---------------------------------------

      Component/s: HttpCore NIO
    Fix Version/s: 4.4

> Unnecessary call to isOpen() before calling close
> -------------------------------------------------
>
>                 Key: HTTPCORE-363
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-363
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore NIO
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 4.4
>
>
> There are some instances of the following code:
> final Channel channel = this.key.channel();
> if (channel.isOpen()) {
>     try {
>         channel.close();
>     } catch (final IOException ignore) {}
> }
> Eclipse generates a warning that the channel might not be closed.
> Obviously that is a false positive, but why bother checking the state?
> Surely channel.close() can be repeated without harm?



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org