Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-363

Unnecessary call to isOpen() before calling close

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 4.4-alpha1
    • HttpCore NIO
    • None

    Description

      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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: