When .length () is called in a file object, files larger than 2 GB return an invalid value.
This happens in a web application running in a tomcat container.
For example, the file that reports Windows requests is 2083 344 714 bytes returned from java as 1887961088.
Here are the environmental details:
- jdk 1.6.0_24 (64 bit)
- Java JotSpot (TM) 64-bit server VM (build 17.0-b17, mixed mode)
- Tomcat 6.0.29
- Windows Server 2008 r2
Therefore, I immediately suspected something that was connected with a 32-bit virtual machine, but everything worked on 64 bits. I am completely shocked that any help would be greatly appreciated if it only helped to develop some tests to see if the problem is related to something running in 32nd mode.
EDIT:
To answer some comments: When I run a really simple test case using the same JVM (only output file.length), I get the correct value: 2,083,344,714.
I am pretty sure this should work, I just feel that something about my tomcat configuration / java configuration / application makes my time difficult. The fact that it only affects files with a certain size really makes it seem like a problem with 32-bit and 64-bit, but as far as I can tell, it's all 64 bits.
EDIT 2: start to suspect that this is pretty much impossible, and I might have a problem with a stream occupying the length of the file before it is completely copied. I will send here when I find out if someone cares :-)
source share