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

        Nitin Verma created issue -
        Nitin Verma made changes -
        Field Original Value New Value
        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/RandomwAccess. 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."

        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."

        Hide
        Nitin Verma added a comment -

        Checked-in the changes to trunk.

        Show
        Nitin Verma added a comment - Checked-in the changes to trunk.
        Nitin Verma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s current [ 13583 ]
        Resolution Fixed [ 1 ]
        Nitin Verma made changes -
        Fix Version/s 1.2.2 [ 16644 ]
        Fix Version/s current [ 13583 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: