[OS-JIRA] Created: (WOL-694) Environment.java fails to getEnvVars on a Windows 2003 server box

From: Bill Michell (JIRA) ("Bill)
Date: Fri Dec 14 2007 - 05:23:37 EST

  • Next message: Jeremy Matthews: "Initial Open Beta"

    Environment.java fails to getEnvVars on a Windows 2003 server box
    -----------------------------------------------------------------

                     Key: WOL-694
                     URL: http://issues.objectstyle.org/jira/browse/WOL-694
                 Project: WOProject/WOLips
              Issue Type: Bug
              Components: woproject
        Affects Versions: 2.0.0.4118
             Environment: Microsoft Windows [Version 5.2.3790] (Windows 2003 Server)
                Reporter: Bill Michell

    When using the woapplication ant task on my Win2003 build and CI servers, I see the following entry in the ant output:

    [woapplication] getEnvVars -> unable to load environment variablesjava.lang.reflect.InvocationTargetException

    Apart from the annoyingh missing space, and the lack of useful stack dump, I've pinned the code down to the following section of Environment.java, I think.

    /**
             * Method osProcess.
             *
             *..eturn Process
             *..hrows Exception
             */
            private static Process osProcess() throws InvocationTargetException {
                    Process p = null;
                    Runtime r = null;
                    String OS = null;
                    try {
                            r = Runtime.getRuntime();
                            OS = System.getProperty("os.name").toLowerCase();
                            if (OS.indexOf("windows 9") > -1) {
                                    p = r.exec("command.com /c set");
                            } else if ((OS.indexOf("nt") > -1) || (OS.indexOf("windows 2000") > -1)) {
                                    p = r.exec("cmd.exe /c set");
                            } else {
                                    p = r.exec("env");
                            }
                            return p;
                    } catch (IOException e) {
                            throw new InvocationTargetException(e);
                    }
            }
    While running "env" on my development box gets me what you would expect, it doesn't work on the build server...

    C:\WINDOWS>env
    'env' is not recognized as an internal or external command,
    operable program or batch file.

    It looks like "cmd.exe /c set" is the correct command to run.

    Of course, Java 5 added static Map<String,String> System.getenv() which bypasses this whole gnarly issue, but I suppose Java 1.4 compatibility might still be important for WOProject (I know WOLips requires 5 these days).
     

    -- 
    This message is automatically generated by JIRA.
    -
    If you think it was sent incorrectly contact one of the administrators: http://issues.objectstyle.org/jira/secure/Administrators.jspa
    -
    For more information on JIRA, see: http://www.atlassian.com/software/jira
    



    This archive was generated by hypermail 2.0.0 : Fri Dec 14 2007 - 05:24:44 EST