Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8034595 | 7u65 | Ivan Gerasimov | P4 | Resolved | Fixed | b01 |
JDK-8022160 | 7u60 | Ivan Gerasimov | P4 | Closed | Fixed | b01 |
FULL PRODUCT VERSION :
java version " 1.7.0_21 "
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux dvega-work 3.8.0-26-generic #38-Ubuntu SMP Mon Jun 17 21:43:33 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu 13.04
Release: 13.04
Codename: raring
A DESCRIPTION OF THE PROBLEM :
Many files in " /proc " file-system reports 0 bytes size even though they contain useful data.
If you use java.nio.file.Files.readAllBytes() on then, you will not get any data read.
As the documentation of Files.size() says, the result of this function is not always reliable and should not be trusted to determine the actual contents of a file.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use file.nio.file.Files.readAllbytes() to read " /proc/net/tcp "
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Byte contents of the file read
ACTUAL -
No bytes read
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Path tcpInfo = Paths.get( " /proc/net/tcp " );
byte[] data = Files.readAllBytes(tcpInfo);
if (data.length == 0) throw new AssertionError( " No data read " );
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Read the bytes with the classic InputStream.read()
java version " 1.7.0_21 "
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux dvega-work 3.8.0-26-generic #38-Ubuntu SMP Mon Jun 17 21:43:33 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description: Ubuntu 13.04
Release: 13.04
Codename: raring
A DESCRIPTION OF THE PROBLEM :
Many files in " /proc " file-system reports 0 bytes size even though they contain useful data.
If you use java.nio.file.Files.readAllBytes() on then, you will not get any data read.
As the documentation of Files.size() says, the result of this function is not always reliable and should not be trusted to determine the actual contents of a file.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use file.nio.file.Files.readAllbytes() to read " /proc/net/tcp "
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Byte contents of the file read
ACTUAL -
No bytes read
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Path tcpInfo = Paths.get( " /proc/net/tcp " );
byte[] data = Files.readAllBytes(tcpInfo);
if (data.length == 0) throw new AssertionError( " No data read " );
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Read the bytes with the classic InputStream.read()
- backported by
-
JDK-8034595 (fs) Files.readAllBytes() does not read any data when Files.size() is 0
-
- Resolved
-
-
JDK-8022160 (fs) Files.readAllBytes() does not read any data when Files.size() is 0
-
- Closed
-
- relates to
-
JDK-8014928 (fs) Files.readAllBytes() copies content to new array when content completely read
-
- Closed
-