You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2006/06/23 16:55:31 UTC

[jira] Commented: (HARMONY-648) Can't read input from the console

    [ http://issues.apache.org/jira/browse/HARMONY-648?page=comments#action_12417504 ] 

Tim Ellison commented on HARMONY-648:
-------------------------------------

Ouch!   That's a howler -- thanks.

Confirmed as reproducible.

--

For those that care:

The problem appears to be caused by  java.io.FileInputStream#available()  that lost it's special logic for FD 0 when the code was updated from a native call to Java code (at repo r376689).  We need to use platform specific code to determine available() for stdin.


> Can't read input from the console
> ---------------------------------
>
>          Key: HARMONY-648
>          URL: http://issues.apache.org/jira/browse/HARMONY-648
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>  Environment: Windows XP
>     Reporter: Sian January
>     Assignee: Tim Ellison

>
> Using the IBM VME and a version of Harmony built today (23rd June 2006), the following simple program fails:
> import java.io.BufferedReader;
> import java.io.IOException;
> import java.io.InputStreamReader;
> public class Main {
>     public static void main(String[] args) {
>         BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
>         try {
>             String input = br.readLine ();
>             System.out.println("Hello " + input);
>         } catch (IOException e) {
>             e.printStackTrace();
>         }
>     }
> }
> This fails with an IOException - Stack trace below:
> java.io.IOException
> 	at org.apache.harmony.luni.platform.OSFileSystem.seek(OSFileSystem.java:99)
> 	at java.io.FileInputStream.available(FileInputStream.java:126)
> 	at java.io.BufferedInputStream.available(BufferedInputStream.java:101)
> 	at java.io.InputStreamReader.read(InputStreamReader.java:392)
> 	at java.io.BufferedReader.fillbuf(BufferedReader.java:108)
> 	at java.io.BufferedReader.readLine(BufferedReader.java:323)
> 	at p.Main.main(Main.java:12)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira