You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2007/10/23 18:05:50 UTC

[jira] Created: (HARMONY-5008) [drlvm][kernel] Runtime.exec() cannot load executable with non-ASCII characters in name

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