harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ivanov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2741) [drlvm][classlib] unexpected result for 'user.home' on windows in empty environment
Date Fri, 15 Dec 2006 11:31:21 GMT
[drlvm][classlib] unexpected result for 'user.home' on windows in empty environment
-----------------------------------------------------------------------------------

                 Key: HARMONY-2741
                 URL: http://issues.apache.org/jira/browse/HARMONY-2741
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
            Reporter: Vladimir Ivanov
            Priority: Minor


The DRLVM reports the incorrect 'user.home' variable (%SystemDrive% instead of drive) if vm
was run in empty environment. Note RI works OK.

================ test.java ====================
import java.io.*;

public class test {
    
    public static volatile String cmdS = "java -version";

    void read(InputStream stream) {
        try {
            byte[] data = new byte[stream.available()];
            stream.read(data, 0, data.length);
            if (data.length > 0) {
                System.out.println(new String(data, 0, data.length));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void run(String[] args) {
        if (args != null && args.length > 0) {
            cmdS = "";
            for (int i = 0; i < args.length; i++) {
                cmdS = cmdS + args[i] + " ";
            }
        }
        System.out.println("Command to run:\n\t" + cmdS);
	String[] envp = {};
        try {
            Process proc = Runtime.getRuntime().exec(cmdS, envp);
            InputStream err = proc.getErrorStream();
            InputStream in = proc.getInputStream();
            int ec = Integer.MIN_VALUE;
            while (true) {
                try {
                    ec = proc.exitValue();
                    break;
                } catch (IllegalThreadStateException  e) {
                    try {
                        Thread.sleep(100);
                        read(in);
                        read(err);
                    } catch (InterruptedException e1) {
                        e1.printStackTrace();
                    }
                }
            }
            System.out.println("exit code is " + ec);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new test().run(args);
    }
}

class tst {
    public static void main(String[] args) {

	System.out.println(System.getProperty("user.name"));
	System.out.println(System.getProperty("user.home"));
	System.out.println(System.getProperty("user.dir"));
    }
}
===========================================

Output:
C:\tmp\tmp17>C:\jdk1.5.0_08\bin\java.exe test C:\jdk1.5.0_08\bin\java.exe -cp . -showversion
tst
Command to run:
        C:\jdk1.5.0_08\bin\java.exe -cp . -showversion tst
vivanov1
C:\Documents and Settings\vivanov1
C:\tmp\tmp17

java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode)



exit code is 0

C:\tmp\tmp17>C:\jdk1.5.0_08\bin\java.exe test C:\harmony.top\drlvm\trunk\build\win_ia32_msvc_debug\deploy\jdk\jre\bin\java
-cp . -showversion tst
Command to run:
        C:\harmony.top\drlvm\trunk\build\win_ia32_msvc_debug\deploy\jdk\jre\bin\java -cp .
-showversion tst
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.

java version "1.5.0"
pre-alpha : not complete or compatible
svn = r487441, (Dec 15 2006), Windows/ia32/msvc 1310, debug build
http://incubator.apache.org/harmony

vivanov1

%SystemDrive%\Documents and Settings\vivanov1
C:\tmp\tmp17

exit code is 0

C:\tmp\tmp17>

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

        

Mime
View raw message