[
https://issues.apache.org/jira/browse/HTTPCORE-363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13830987#comment-13830987
]
Oleg Kalnichevski commented on HTTPCORE-363:
--------------------------------------------
Sebastian
I think this was done in order to avoid exceptions thrown in case an attempt is
made to close a channel that has already been closed. It can well be this check
is no longer necessary, but I am not entirely sure. I would probably prefer to
change this behavior in the 4.4 branch only (once stable 4.3.x branch has been
created).
Oleg
> 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
> Reporter: Sebb
> Priority: Minor
>
> 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: [email protected]
For additional commands, e-mail: [email protected]