FULL PRODUCT VERSION :
java version "1.7.0_147-icedtea"
OpenJDK Runtime Environment (IcedTea7 2.0) (Gentoo build 1.7.0_147-icedtea-b147)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)
Same for:
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux tsdh 3.2.1-gentoo #1 SMP PREEMPT Sun Jan 22 21:06:25 CET 2012 x86_64 Intel(R) Core(TM)2 Duo CPU T8100 @ 2.10GHz GenuineIntel GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Calling FileInputStream.available() always throws an IOException "Invalid argument" for FileInputStream of files in the Linux /proc file system.
For example, this works just fine:
FileInputStream fis = new FileInputStream("/etc/hosts");
System.out.println(fis.available());
But this throws an IOException:
FileInputStream fis = new FileInputStream("/proc/cpuinfo");
System.out.println(fis.available());
Exception in thread "main" java.io.IOException: Invalid argument
at java.io.FileInputStream.available(Native Method)
at Foo.main(Foo.java:12)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
On a Linux system, execute
FileInputStream fis = new FileInputStream("/proc/cpuinfo");
System.out.println(fis.available());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Get some non-negative integer back from FileInputStream.available().
ACTUAL -
A java.io.IOException is thrown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.io.IOException: Invalid argument
at java.io.FileInputStream.available(Native Method)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.FileInputStream;
import java.io.IOException;
public class Foo {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("/etc/hosts");
System.out.println(fis.available()); // Works fine
fis = new FileInputStream("/proc/cpuinfo");
System.out.println(fis.available()); // Throws IOException
}
}
---------- END SOURCE ----------
java version "1.7.0_147-icedtea"
OpenJDK Runtime Environment (IcedTea7 2.0) (Gentoo build 1.7.0_147-icedtea-b147)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)
Same for:
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux tsdh 3.2.1-gentoo #1 SMP PREEMPT Sun Jan 22 21:06:25 CET 2012 x86_64 Intel(R) Core(TM)2 Duo CPU T8100 @ 2.10GHz GenuineIntel GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Calling FileInputStream.available() always throws an IOException "Invalid argument" for FileInputStream of files in the Linux /proc file system.
For example, this works just fine:
FileInputStream fis = new FileInputStream("/etc/hosts");
System.out.println(fis.available());
But this throws an IOException:
FileInputStream fis = new FileInputStream("/proc/cpuinfo");
System.out.println(fis.available());
Exception in thread "main" java.io.IOException: Invalid argument
at java.io.FileInputStream.available(Native Method)
at Foo.main(Foo.java:12)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
On a Linux system, execute
FileInputStream fis = new FileInputStream("/proc/cpuinfo");
System.out.println(fis.available());
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Get some non-negative integer back from FileInputStream.available().
ACTUAL -
A java.io.IOException is thrown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.io.IOException: Invalid argument
at java.io.FileInputStream.available(Native Method)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.FileInputStream;
import java.io.IOException;
public class Foo {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("/etc/hosts");
System.out.println(fis.available()); // Works fine
fis = new FileInputStream("/proc/cpuinfo");
System.out.println(fis.available()); // Throws IOException
}
}
---------- END SOURCE ----------
- relates to
-
JDK-8022741 Improve RandomAccessFile.length() to handle special files or files opened with special options
-
- Closed
-