JDK-4023791 : InputStreamReader does not work on the Win32 console input stream
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.1
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_2.5.1,windows_95,windows_nt
  • CPU: x86,sparc
  • Submitted: 1997-01-02
  • Updated: 1997-10-23
  • Resolved: 1997-10-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.1 1.1beta3Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Description
This bug was originally reported by Steven Buroff <###@###.###>,
who noticed that LineNumberReader throws an IOException when used on the Win32
console input stream.  Here is a simplified example, which shows that the
problem really is that available() isn't supported by the console input stream.


import	java.io.*;

public class ISRAvailable {

    public static void main(String[] args) {
	InputStreamReader isr = new InputStreamReader(System.in);
	int c;

	try {
	    c = isr.read();
	}
	catch(IOException excp) {
	    excp.printStackTrace();
	}
    }

}


Under Win32:

F:\bugs\io>p:\w\jdk\build\win32\bin\java ISRAvailable
java.io.IOException
        at java.io.BufferedInputStream.available(BufferedInputStream.java:181)
        at java.io.InputStreamReader.fill(InputStreamReader.java:216)
        at java.io.InputStreamReader.read(InputStreamReader.java:273)
        at java.io.InputStreamReader.read(InputStreamReader.java:249)
        at ISRAvailable.main(ISRAvailable.java:33)
F:\bugs\io>

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic FIXED IN: 1.1beta3 INTEGRATED IN: 1.1beta3
14-06-2004

EVALUATION Coding error.
11-06-2004

WORK AROUND
11-06-2004

SUGGESTED FIX Fix InputStreamReader not to rely upon available() being supported in the underlying input stream.
11-06-2004

PUBLIC COMMENTS The InputStreamReader class does not work on the Win32 console input stream. There is no convenient workaround for this bug.
10-06-2004