Program: 39526
Project: 39526
Buggy source:
public void start() throws LifecycleException {
  if (log.isLoggable(Level.FINER)) {
    log.entering(className,"String_Node_Str");
  }
  String vmid;
  VirtualMachine wlpvm=null;
  String serviceURL=null;
  try {
    vmid=findVirtualMachineIdByName(containerConfiguration.getServerName());
    if (vmid != null) {
      if (!containerConfiguration.isAllowConnectingToRunningServer())       throw new LifecycleException("String_Node_Str");
      wlpvm=VirtualMachine.attach(vmid);
      serviceURL=getVMLocalConnectorAddress(wlpvm);
      if (serviceURL == null)       throw new LifecycleException("String_Node_Str");
    }
 else {
      if (containerConfiguration.isAddLocalConnector()) {
        String serverXML=getServerXML();
        if ("String_Node_Str".equals(containerConfiguration.getServerName()) && !new File(serverXML).exists()) {
          serverXML=getDefaultServerXML();
        }
        Document document=readServerXML(serverXML);
        addFeatures(document,"String_Node_Str");
        writeServerXML(document,serverXML);
      }
      List<String> cmd=new ArrayList<String>();
      String javaVmArguments=containerConfiguration.getJavaVmArguments();
      cmd.add(System.getProperty("String_Node_Str") + "String_Node_Str");
      if (!javaVmArguments.equals("String_Node_Str"))       cmd.add(javaVmArguments);
      cmd.add("String_Node_Str");
      cmd.add("String_Node_Str");
      cmd.add("String_Node_Str");
      cmd.add(containerConfiguration.getServerName());
      log.finer("String_Node_Str" + cmd.toString());
      ProcessBuilder pb=new ProcessBuilder(cmd);
      pb.directory(new File(containerConfiguration.getWlpHome()));
      pb.redirectErrorStream();
      wlpProcess=pb.start();
      new Thread(new ConsoleConsumer()).start();
      final Process proc=wlpProcess;
      shutdownThread=new Thread(new Runnable(){
        @Override public void run(){
          if (proc != null) {
            proc.destroy();
            try {
              proc.waitFor();
            }
 catch (            InterruptedException e) {
              throw new RuntimeException(e);
            }
          }
        }
      }
);
      Runtime.getRuntime().addShutdownHook(shutdownThread);
      int startupTimeout=containerConfiguration.getServerStartTimeout() * 1000;
      while (startupTimeout > 0 && serviceURL == null) {
        startupTimeout-=500;
        Thread.sleep(500);
        int ev=Integer.MIN_VALUE;
        IllegalThreadStateException itse=null;
        try {
          ev=wlpProcess.exitValue();
        }
 catch (        IllegalThreadStateException e) {
          itse=e;
        }
        if (itse == null)         throw new LifecycleException("String_Node_Str" + ev);
        if (vmid == null)         vmid=findVirtualMachineIdByName(containerConfiguration.getServerName());
        if (wlpvm == null && vmid != null)         wlpvm=VirtualMachine.attach(vmid);
        if (serviceURL == null && wlpvm != null)         serviceURL=getVMLocalConnectorAddress(wlpvm);
      }
      if (serviceURL == null)       throw new LifecycleException("String_Node_Str");
      log.finer("String_Node_Str" + vmid);
    }
  }
 catch (  Exception e) {
    throw new LifecycleException("String_Node_Str",e);
  }
  try {
    JMXServiceURL url=new JMXServiceURL(serviceURL);
    jmxConnector=JMXConnectorFactory.connect(url);
    mbsc=jmxConnector.getMBeanServerConnection();
  }
 catch (  IOException e) {
    throw new LifecycleException("String_Node_Str",e);
  }
  if (log.isLoggable(Level.FINER)) {
    log.exiting(className,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void start() throws LifecycleException {
  if (log.isLoggable(Level.FINER)) {
    log.entering(className,"String_Node_Str");
  }
  String vmid;
  VirtualMachine wlpvm=null;
  String serviceURL=null;
  try {
    vmid=findVirtualMachineIdByName(containerConfiguration.getServerName());
    if (vmid != null) {
      if (!containerConfiguration.isAllowConnectingToRunningServer())       throw new LifecycleException("String_Node_Str");
      wlpvm=VirtualMachine.attach(vmid);
      serviceURL=getVMLocalConnectorAddress(wlpvm);
      if (serviceURL == null)       throw new LifecycleException("String_Node_Str");
    }
 else {
      if (containerConfiguration.isAddLocalConnector()) {
        String serverXML=getServerXML();
        if ("String_Node_Str".equals(containerConfiguration.getServerName()) && !new File(serverXML).exists()) {
          serverXML=getDefaultServerXML();
        }
        Document document=readServerXML(serverXML);
        addFeatures(document,"String_Node_Str");
        writeServerXML(document,serverXML);
      }
      List<String> cmd=new ArrayList<String>();
      String javaVmArguments=containerConfiguration.getJavaVmArguments();
      cmd.add(System.getProperty("String_Node_Str") + "String_Node_Str");
      cmd.add("String_Node_Str");
      if (!javaVmArguments.equals("String_Node_Str"))       cmd.add(javaVmArguments);
      cmd.add("String_Node_Str");
      cmd.add("String_Node_Str");
      cmd.add("String_Node_Str");
      cmd.add(containerConfiguration.getServerName());
      log.finer("String_Node_Str" + cmd.toString());
      ProcessBuilder pb=new ProcessBuilder(cmd);
      pb.directory(new File(containerConfiguration.getWlpHome()));
      pb.redirectErrorStream(true);
      wlpProcess=pb.start();
      new Thread(new ConsoleConsumer()).start();
      final Process proc=wlpProcess;
      shutdownThread=new Thread(new Runnable(){
        @Override public void run(){
          if (proc != null) {
            proc.destroy();
            try {
              proc.waitFor();
            }
 catch (            InterruptedException e) {
              throw new RuntimeException(e);
            }
          }
        }
      }
);
      Runtime.getRuntime().addShutdownHook(shutdownThread);
      int startupTimeout=containerConfiguration.getServerStartTimeout() * 1000;
      while (startupTimeout > 0 && serviceURL == null) {
        startupTimeout-=500;
        Thread.sleep(500);
        int ev=Integer.MIN_VALUE;
        IllegalThreadStateException itse=null;
        try {
          ev=wlpProcess.exitValue();
        }
 catch (        IllegalThreadStateException e) {
          itse=e;
        }
        if (itse == null)         throw new LifecycleException("String_Node_Str" + ev);
        if (vmid == null)         vmid=findVirtualMachineIdByName(containerConfiguration.getServerName());
        if (wlpvm == null && vmid != null)         wlpvm=VirtualMachine.attach(vmid);
        if (serviceURL == null && wlpvm != null)         serviceURL=getVMLocalConnectorAddress(wlpvm);
      }
      if (serviceURL == null)       throw new LifecycleException("String_Node_Str");
      log.finer("String_Node_Str" + vmid);
    }
  }
 catch (  Exception e) {
    throw new LifecycleException("String_Node_Str",e);
  }
  try {
    JMXServiceURL url=new JMXServiceURL(serviceURL);
    jmxConnector=JMXConnectorFactory.connect(url);
    mbsc=jmxConnector.getMBeanServerConnection();
  }
 catch (  IOException e) {
    throw new LifecycleException("String_Node_Str",e);
  }
  if (log.isLoggable(Level.FINER)) {
    log.exiting(className,"String_Node_Str");
  }
}