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

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

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


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


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

Posted by "Sian January (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-648?page=comments#action_12418031 ] 

Sian January commented on HARMONY-648:
--------------------------------------

Thanks Tim - the fix looks good.

> 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
>     Priority: Critical
>  Attachments: Main.java, SystemTest.java, harmony-648.diff
>
> 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


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

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
    [ 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


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

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-648?page=all ]

Tim Ellison reassigned HARMONY-648:
-----------------------------------

    Assign To: Tim Ellison

> 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


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

Posted by "Sian January (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-648?page=all ]

Sian January updated HARMONY-648:
---------------------------------

    Attachment: SystemTest.java
                Main.java

Included a JUnit test for this issue

> 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
>     Priority: Critical
>  Attachments: Main.java, SystemTest.java, harmony-648.diff
>
> 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


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

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-648?page=all ]

Tim Ellison closed HARMONY-648.
-------------------------------


> Can't read input from the console
> ---------------------------------
>
>                 Key: HARMONY-648
>                 URL: http://issues.apache.org/jira/browse/HARMONY-648
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP
>            Reporter: Sian January
>         Assigned To: Tim Ellison
>            Priority: Critical
>         Attachments: harmony-648.diff, Main.java, SystemTest.java, SystemTest.java
>
>
> 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

        

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

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-648?page=all ]

Tim Ellison updated HARMONY-648:
--------------------------------

    Attachment: harmony-648.diff

Here's my first attempt at a fix.  Requires further testing (and it's getting late so will continue later).


> 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
>     Priority: Critical
>  Attachments: harmony-648.diff
>
> 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


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

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-648?page=all ]

Tim Ellison updated HARMONY-648:
--------------------------------

    Priority: Critical  (was: Major)

> 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
>     Priority: Critical

>
> 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


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

Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-648?page=all ]
     
Tim Ellison resolved HARMONY-648:
---------------------------------

    Resolution: Fixed

Sian,

Thanks for the bug report -- fixed in LUNI module at repo revision r417205.

Please check that this fully resolves your issue.


> 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
>     Priority: Critical
>  Attachments: harmony-648.diff
>
> 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


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

Posted by "Sian January (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-648?page=all ]

Sian January updated HARMONY-648:
---------------------------------

    Attachment: SystemTest.java

Updated version of the test to make sure we're using the right Java for the forked process.  Please note I haven't tried the test on Linux.

> 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
>     Priority: Critical
>  Attachments: Main.java, SystemTest.java, SystemTest.java, harmony-648.diff
>
> 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