JDK-4470017 : (fs) FileChannel.transfer{From,To} methods broken for large files (spec)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2001-06-14
  • Updated: 2001-12-03
  • Resolved: 2001-12-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 rc1Fixed
Related Reports
Relates :  
Description

Name: bsC130419			Date: 06/14/2001


java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)

The second argument to the transferTo() and transferFrom() methods in the
FileChannel class is type int, whereas FileChannel size() method returns type
long. It is not unreasonable to expect to be able to request the transfer of
all the bytes in the file by passing the value returned by size(). Requiring a
cast to int really precludes its safe use in this context.
(Review ID: 126561) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-rc1 FIXED IN: merlin-rc1 INTEGRATED IN: merlin-rc1
14-06-2004

WORK AROUND Name: bsC130419 Date: 06/14/2001 Cast the file length to type int. ======================================================================
11-06-2004

EVALUATION There is a slightly deeper problem here, namely that the transfer{From,To} methods should be useful on large (> 2GB) files. For consistency and ease-of-use we should also revise the map method's size argument to be a long; that way all count/size parameters to FileChannel methods will be longs. -- ###@###.### 2001/11/13
11-09-0179