1 Reply Latest reply on Oct 25, 2003 3:47 AM by juha

    Child Process MBean

    Gary Ratcliffe Newbie


      I suspect very few people are using the ChildProcessService since it isn't included in any of the standard server configurations. But I have found what appears to be a small problem relating to Environment

      The MBean contains an attribute for specifiying environment variables to be passed to the child process using the Runtime exec function. If the attribute is empty then the process should inherit the variables from the parent process. However this is not the case with the current code. It will instead pass an empty array of environment variables resulting in the child process having no variables.

      Updating the makeEnvArray method as shown below in ChildProcessService.java sorts this out:


      protected String[] makeEnvArray(final Properties props)
      // Return null if no env entires supplied
      if ( (props == null) || (props.keySet().size() == 0) )
      return null;

      String[] envArray = new String[props.keySet().size()];

      Iterator iter = props.keySet().iterator();
      int i = 0;
      while (iter.hasNext()) {
      String name = (String)iter.next();
      envArray[i++] = name + "=" + props.getProperty(name);

      return envArray;