-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0
-
b79
-
x86
-
windows_2000
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2160319 | 1.4.2_18 | Unassigned | P4 | Closed | Won't Fix |
Name: ddT132432 Date: 12/20/2001
FULL PRODUCT VERSION :
1.3.0, 1.3.1, 1.4b3, ...
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed
mode)
(but no problem with 1.2.2)
FULL OPERATING SYSTEM VERSION :
Windows NT Version 4.0 fr SP6a
A DESCRIPTION OF THE PROBLEM :
I'm reading a file with a BufferedReader, line by line with
readLine().
But before reading a line, I set a mark, read 30
characters, and reset the mark
(in my original program, I'm trying to detect a certain
value in these 30 characters).
In general it works perfectly.
BUT, I have one file that gives me an error.
If I add or remove any character, it works, but this
specific file does not work.
I can't attach it to this report, but send me an email and
I will reply qith this file in attachement...
REGRESSION. Last worked in version 1.2.2
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. java markTest.Main
(must have my magic file that breaks everything...)
EXPECTED VERSUS ACTUAL BEHAVIOR :
java.io.IOException: Mark invalid
at
java.io.BufferedReader.resetBufferedReader.java:488)
at markTest.Main.testMark(Main.java:22)
at markTest.Main.main(Main.java:41)
last line read : 97 = at
weblogic.security.acl.Security.doAsPrivileged
(Security.java:483)
len : 30
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.io.IOException: Mark invalid
at
java.io.BufferedReader.resetBufferedReader.java:488)
at markTest.Main.testMark(Main.java:22)
at markTest.Main.main(Main.java:41)
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package markTest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.File;
import java.io.FileReader;
public class Main {
private static void testMark(BufferedReader in)
throws IOException
{
String line = null;
char[] debut = new char[30];
int num_ligne = 0;
int len = 0;
try {
while (true) {
in.mark(debut.length);
len = in.read(debut, 0, debut.length);
in.reset();
if (len < 0) {
break;
}
num_ligne ++;
line = in.readLine();
}
} catch (IOException e ) {
e.printStackTrace();
System.out.println("last line read : " +num_ligne + " = " + line);
System.out.println("len : " + len);
}
}
public static void main(String args[])
throws IOException
{
File file = new File("doc", "testMark.txt");
BufferedReader reader = new BufferedReader(new FileReader(file));
testMark(reader);
}
}
---------- END SOURCE ----------
Release Regression From : 1.2.2
The above release value was the last known release where this
bug was knwon to work. Since then there has been a regression.
(Review ID: 137565)
======================================================================
FULL PRODUCT VERSION :
1.3.0, 1.3.1, 1.4b3, ...
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed
mode)
(but no problem with 1.2.2)
FULL OPERATING SYSTEM VERSION :
Windows NT Version 4.0 fr SP6a
A DESCRIPTION OF THE PROBLEM :
I'm reading a file with a BufferedReader, line by line with
readLine().
But before reading a line, I set a mark, read 30
characters, and reset the mark
(in my original program, I'm trying to detect a certain
value in these 30 characters).
In general it works perfectly.
BUT, I have one file that gives me an error.
If I add or remove any character, it works, but this
specific file does not work.
I can't attach it to this report, but send me an email and
I will reply qith this file in attachement...
REGRESSION. Last worked in version 1.2.2
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. java markTest.Main
(must have my magic file that breaks everything...)
EXPECTED VERSUS ACTUAL BEHAVIOR :
java.io.IOException: Mark invalid
at
java.io.BufferedReader.resetBufferedReader.java:488)
at markTest.Main.testMark(Main.java:22)
at markTest.Main.main(Main.java:41)
last line read : 97 = at
weblogic.security.acl.Security.doAsPrivileged
(Security.java:483)
len : 30
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.io.IOException: Mark invalid
at
java.io.BufferedReader.resetBufferedReader.java:488)
at markTest.Main.testMark(Main.java:22)
at markTest.Main.main(Main.java:41)
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package markTest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.File;
import java.io.FileReader;
public class Main {
private static void testMark(BufferedReader in)
throws IOException
{
String line = null;
char[] debut = new char[30];
int num_ligne = 0;
int len = 0;
try {
while (true) {
in.mark(debut.length);
len = in.read(debut, 0, debut.length);
in.reset();
if (len < 0) {
break;
}
num_ligne ++;
line = in.readLine();
}
} catch (IOException e ) {
e.printStackTrace();
System.out.println("last line read : " +num_ligne + " = " + line);
System.out.println("len : " + len);
}
}
public static void main(String args[])
throws IOException
{
File file = new File("doc", "testMark.txt");
BufferedReader reader = new BufferedReader(new FileReader(file));
testMark(reader);
}
}
---------- END SOURCE ----------
Release Regression From : 1.2.2
The above release value was the last known release where this
bug was knwon to work. Since then there has been a regression.
(Review ID: 137565)
======================================================================
- backported by
-
JDK-2160319 BufferedReader.reset() unexpectedly throws "IOException: Mark invalid"
- Closed