xadisk
  1. xadisk
  2. XADISK-142

close() method should be called on the corresponding stream instead of the FileChannel.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.2.2
    • Component/s: filesystem
    • Labels:
      None

      Description

      All over the xadisk code, close() method should be called on the corresponding stream instead of the FileChannel (which has come from that stream). Though, as observed, closing the FileChannel is closing the corresponding stream (FileInputStream/FileOutputStream/RandomAccessFile) too, but this behavior is decided by the Java runtime, and is not documented.

      We should instead close the stream, which will close the channel by itself as per the JavaDoc of FileInputStream/FileOutputStream/RandomAccessFile. Quoting from the Java 5 API documentation of FileInputStream's close method:

      "If this stream has an associated channel then the channel is closed as well."

        Activity

          People

          • Assignee:
            Nitin Verma
            Reporter:
            Nitin Verma
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: