harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-5008) [drlvm][kernel] Runtime.exec() cannot load executable with non-ASCII characters in name
Date Tue, 23 Oct 2007 16:05:50 GMT
[drlvm][kernel] Runtime.exec() cannot load executable with non-ASCII characters in name
---------------------------------------------------------------------------------------

                 Key: HARMONY-5008
                 URL: https://issues.apache.org/jira/browse/HARMONY-5008
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: win32
            Reporter: Alexei Zakharov


Current implementation of Runtime kernel class in DRLVM is unable to handle non-English characters
in file names properly. For example you cannot do Runtime.exec() if name of target  executable
contains Russian letters. Please see the test case below.

hello.c
---
#include <stdio.h>
int main() {
    printf("%s\n", "Hello world!");
}

ExecWithLocalizedName.java
---
import java.io.*;

public class ExecWithLocalizedName {
    public static void main(String argv[]) throws Exception {
        Process proc = Runtime.getRuntime().exec(argv[0]);
        InputStreamReader reader = new InputStreamReader(proc.getInputStream());
        StringBuilder sb = new StringBuilder();
        int c;

        while ((c = reader.read()) != -1) {
            sb.append((char) c);
        }
        reader.close();

        System.out.println(sb.toString());
    }
}

Compile everything (in MSVC environment):
cl hello.c -o здрасте.exe
javac ExecWithLocalizedName.java

If executed on J9 (or RI):
%J9_HOME%\bin\java ExecWithLocalizedName здрасте.exe
Hello world!

If executed on DRLVM:
%DRLVM_HOME%\bin\java ExecWithLocalizedName здрасте.exe
Uncaught exception in main:
java.io.IOException: The creation of the Process has just failed: "чфЁрёЄх.exe"
        at java.lang.Runtime$SubProcess.execVM(Runtime.java:327)
        at java.lang.Runtime.exec(Runtime.java:641)
        at java.lang.Runtime.exec(Runtime.java:584)
        at java.lang.Runtime.exec(Runtime.java:543)
        at ExecWithLocalizedName.main(ExecWithLocalizedName.java:5)



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


Mime
View raw message