You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Shi Jun Zhang (JIRA)" <ji...@apache.org> on 2010/09/03 10:07:34 UTC

[jira] Updated: (HARMONY-6642) [classlib][luni] FileInputStream doesn't close FD in native code

     [ https://issues.apache.org/jira/browse/HARMONY-6642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shi Jun Zhang updated HARMONY-6642:
-----------------------------------

    Attachment: HARMONY-6642.diff

Refer to https://issues.apache.org/jira/browse/HARMONY-826
The above issue was not fixed correctly. The root cause why new FileInputStream(FileDescriptor.in).close() throw exception is that the file handle of stdin on windows is not 0. File handles of stdin/stdout/stderr should be got through GetStdHandle() system method.
So my patch add native method to get file handles for stdin/stdout/stderr. On linux, they are 0/1//2, but on windows, they are returned by GetStdHandle() method.

> [classlib][luni] FileInputStream doesn't close FD in native code
> ----------------------------------------------------------------
>
>                 Key: HARMONY-6642
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6642
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M14
>         Environment: all
>            Reporter: Shi Jun Zhang
>         Attachments: HARMONY-6642.diff
>
>
>         FileInputStream fileIn = new FileInputStream(new File("c:/test.txt"));
>         FileInputStream fileIn2 = new FileInputStream(fileIn.getFD());
>         fileIn2.close();
>         fileIn.read();
> This piece of code will throw IOException with RI but can pass with Harmony.
>         FileInputStream in = new FileInputStream(FileDescriptor.in);
>         in.close();
>         in = new FileInputStream(FileDescriptor.in);
>         in.read();
> This piece of code also will throw IOException with RI but can pass with Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.