FULL PRODUCT VERSION :
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux 2.6.13-gentoo-r3 i686 AMD Athlon(tm) 64 Processor 3000+ GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Using trannsferTo() for large files on many servers, we found that these specific parameters cause the exception.
Position: 2,147,483,647
Data length: 1
Exception: java.io.IOException: Value too large for defined data type
When using any other position and/or length does not cause that exception. Seems like it's a boundry-check bug in the underlying code.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simply use the parameters mentioned here, with any open output channel.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Successfull transfer of the byte.
ACTUAL -
The IOException mentioned here was thrown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception: java.io.IOException: Value too large for defined data type
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
try
{
    long reqOffset = 2147483647L;
    int reqLength = 1;
    long sentBytes = channel.transferTo(reqOffset, reqLength, channel);
}
catch (IOException e)
{
    e.printStackTrace();
}
---------- END SOURCE ----------