FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
This is a duplication of 4454092 bug.
When the skip(long) method is used from any position in the stream with a skip
value that is larger than the available bytes in the stream, the skip method
skips beyond EOF and returns the same value that was given to it.
See code below.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run following program
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JVM: Sun Microsystems Inc. 1.5.0_04
Skiped bytes: 1501
ACTUAL -
JVM: Sun Microsystems Inc. 1.5.0_04
Skiped bytes: 100000000
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.io.InputStream;
public
class SkipTest
{
public static
void main(String[] args)
throws IOException
{
InputStream is=SkipTest.class.getResourceAsStream("SkipTest.class");
long stream_size=is.skip(100000000);
System.out.println("JVM: "+System.getProperty("java.vendor")+" "+System.getProperty("java.version"));
System.out.println("Skiped bytes: "+stream_size);
}
}
---------- END SOURCE ----------
###@###.### 2005-07-08 13:07:58 GMT
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
This is a duplication of 4454092 bug.
When the skip(long) method is used from any position in the stream with a skip
value that is larger than the available bytes in the stream, the skip method
skips beyond EOF and returns the same value that was given to it.
See code below.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run following program
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JVM: Sun Microsystems Inc. 1.5.0_04
Skiped bytes: 1501
ACTUAL -
JVM: Sun Microsystems Inc. 1.5.0_04
Skiped bytes: 100000000
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import java.io.InputStream;
public
class SkipTest
{
public static
void main(String[] args)
throws IOException
{
InputStream is=SkipTest.class.getResourceAsStream("SkipTest.class");
long stream_size=is.skip(100000000);
System.out.println("JVM: "+System.getProperty("java.vendor")+" "+System.getProperty("java.version"));
System.out.println("Skiped bytes: "+stream_size);
}
}
---------- END SOURCE ----------
###@###.### 2005-07-08 13:07:58 GMT
- duplicates
-
JDK-4454092 FileInputStream.skip( long ) does not stop at EOF
- Resolved
- relates to
-
JDK-8011136 FileInputStream.available and skip inconsistencies
- Closed
-
JDK-4178064 java.io.FileInputStream.skip returns incorrect result at EOF
- Closed
-
JDK-4180942 java.io.FileInputStream.skip(negative) throws IOException
- Closed