[XADISK-142] close() method should be called on the corresponding stream instead of the FileChannel. Created: 19/Aug/13  Updated: 27/Aug/13  Resolved: 19/Aug/13

Status: Resolved
Project: xadisk
Component/s: filesystem
Affects Version/s: 1.2.1
Fix Version/s: 1.2.2

Type: Bug Priority: Trivial
Reporter: Nitin Verma Assignee: Nitin Verma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


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



 Comments   
Comment by Nitin Verma [ 19/Aug/13 ]

Checked-in the changes to trunk.

Generated at Mon Dec 05 04:09:22 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.