Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6878250

(so) IllegalBlockingModeException thrown when reading from a closed SocketChannel's InputStream

XMLWordPrintable

    • b01
    • x86
    • solaris_10

      Connect a non-blocking SocketChannel to a server and get the associated Socket. From the Socket get the associated InputStream. Close the SocketChannel and then read from the InputStream. A ClosedChannelException is expected but instead we get an IllegalBlockingModeException. While it is true that the blocking mode is illegal, the SocketChannel being closed, the blocking mode is unimportant for a read() operation.

      When the SocketChannel is in blocking mode, the correct exception (ClosedChannelException) is thrown.

      A sample application that reproduces this problem is attached.

      Seen on:
      java version "1.6.0_13"
      Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
      Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)

            dongbohe Dongbo He
            alopez Alejandro Lopez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: