Program: 133746
Project: 133746
Buggy source:
/** 
 * <!-- begin-UML-doc --> <p> This operation launches the job on a remote machine. </p> <!-- end-UML-doc -->
 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
 */
protected void launchRemotely(){
  IRemoteServices remoteServices=RemoteServices.getRemoteServices("String_Node_Str");
  IRemoteConnection connection=null;
  String remoteDownloadDirectory=execDictionary.get("String_Node_Str");
  String separator=System.getProperty("String_Node_Str");
  String inputFile=execDictionary.get("String_Node_Str");
  int lastIndex=inputFile.lastIndexOf(separator);
  String localFilePrefix=inputFile.substring(0,lastIndex);
  File localStorageDir=new File(localFilePrefix);
  IFileStore localDirectory=EFS.getLocalFileSystem().fromLocalFile(localStorageDir);
  String launchCMDFileName="String_Node_Str";
  if (remoteServices.canCreateConnections()) {
    try {
      connection=remoteServices.getConnectionManager().newConnection(execDictionary.get("String_Node_Str"));
    }
 catch (    RemoteConnectionException e) {
      e.printStackTrace();
      status=FormStatus.InfoError;
      return;
    }
  }
  while (!formSubmitted.get()) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e1) {
      e1.printStackTrace();
      return;
    }
  }
  try {
    launchCMDFileName=writeRemoteCommandFile();
  }
 catch (  Exception e) {
    e.printStackTrace();
    return;
  }
  connection.setAddress(execDictionary.get("String_Node_Str"));
  DataComponent credentials=(DataComponent)formAtomic.get().getComponent(1);
  connection.setUsername(credentials.retrieveAllEntries().get(0).getValue());
  connection.setPassword(credentials.retrieveAllEntries().get(1).getValue());
  try {
    connection.open(null);
  }
 catch (  RemoteConnectionException e) {
    e.printStackTrace();
    status=FormStatus.InfoError;
    return;
  }
  if (connection.isOpen() && !cancelled.get()) {
    System.out.println("String_Node_Str" + "String_Node_Str");
    IRemoteFileManager fileManager=remoteServices.getFileManager(connection);
    IFileStore fileStore=fileManager.getResource(connection.getWorkingDirectory());
    try {
      IFileStore directory=fileStore.getChild(workingDirectoryBaseName).mkdir(EFS.SHALLOW,null);
      System.out.println("String_Node_Str" + "String_Node_Str" + directory.getName());
      for (      String shortInputName : fileMap.keySet()) {
        if (cancelled.get()) {
          break;
        }
        if (uploadInput || (!uploadInput && shortInputName.equals("String_Node_Str"))) {
          IFileStore remoteFileStore=directory.getChild(shortInputName);
          File localFile=new File(fileMap.get(shortInputName));
          IFileStore localFileStore=EFS.getLocalFileSystem().fromLocalFile(localFile);
          localFileStore.copy(remoteFileStore,EFS.NONE,null);
          System.out.println("String_Node_Str" + "String_Node_Str" + shortInputName);
        }
      }
    }
 catch (    CoreException e) {
      e.printStackTrace();
      status=FormStatus.InfoError;
      return;
    }
    String remoteSeparator=connection.getProperty(IRemoteConnection.FILE_SEPARATOR_PROPERTY);
    String currentWd=connection.getWorkingDirectory();
    connection.setWorkingDirectory(currentWd + remoteSeparator + workingDirectoryBaseName);
    System.out.println("String_Node_Str" + "String_Node_Str" + connection.getWorkingDirectory());
    String launchCMD="String_Node_Str";
    if (!execDictionary.get("String_Node_Str").equals("String_Node_Str")) {
      launchCMD="String_Node_Str" + launchCMDFileName;
    }
 else {
      launchCMD="String_Node_Str" + launchCMDFileName;
    }
    IRemoteProcessBuilder processBuilder=remoteServices.getProcessBuilder(connection,"String_Node_Str",launchCMD);
    processBuilder.redirectErrorStream(false);
    try {
      System.out.println("String_Node_Str" + "String_Node_Str");
      System.out.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ launchCMDFileName);
      remoteJob=processBuilder.start(IRemoteProcessBuilder.FORWARD_X11);
    }
 catch (    IOException e) {
      e.printStackTrace();
      status=FormStatus.InfoError;
      return;
    }
    InputStream stdOutStream=remoteJob.getInputStream();
    InputStream stdErrStream=remoteJob.getErrorStream();
    if (logOutput(stdOutStream,stdErrStream).equals(FormStatus.InfoError)) {
      status=FormStatus.InfoError;
      return;
    }
    monitorJob();
    if (!cancelled.get()) {
      String fixedRemoteWD=currentWd + remoteSeparator + workingDirectoryBaseName;
      String remoteDir=(remoteDownloadDirectory == null) ? fixedRemoteWD : remoteDownloadDirectory;
      System.out.println("String_Node_Str" + "String_Node_Str" + localDirectory.getName() + "String_Node_Str"+ remoteDir+ "String_Node_Str");
      IFileStore downloadFileStore=fileManager.getResource(remoteDir);
      try {
        IFileStore[] remoteStores=downloadFileStore.childStores(EFS.NONE,null);
        for (        IFileStore remoteFile : remoteStores) {
          if (cancelled.get()) {
            break;
          }
          IFileInfo fileInfo=remoteFile.fetchInfo();
          if (fileInfo.getLength() < maxFileSize) {
            String msg="String_Node_Str" + "String_Node_Str" + fileInfo.getName() + "String_Node_Str"+ fileInfo.getLength()+ "String_Node_Str";
            System.out.println(msg);
            stdOut.write(msg + "String_Node_Str");
            IFileStore childStore=localDirectory.getChild(remoteFile.getName());
            remoteFile.copy(childStore,EFS.OVERWRITE,null);
          }
 else {
            long sizeDiff=fileInfo.getLength() - maxFileSize;
            String msg="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + fileInfo.getLength() + "String_Node_Str"+ sizeDiff+ "String_Node_Str"+ maxFileSize+ "String_Node_Str";
            System.out.println(msg);
            stdOut.write(msg + "String_Node_Str");
          }
          stdOut.flush();
        }
      }
 catch (      CoreException e) {
        e.printStackTrace();
      }
catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  status=FormStatus.Processed;
  connection.close();
  return;
}

Fixed version (ground truth):
/** 
 * <!-- begin-UML-doc --> <p> This operation launches the job on a remote machine. </p> <!-- end-UML-doc -->
 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
 */
protected void launchRemotely(){
  IRemoteServices remoteServices=RemoteServices.getRemoteServices("String_Node_Str");
  IRemoteConnection connection=null;
  String remoteDownloadDirectory=execDictionary.get("String_Node_Str");
  String separator=System.getProperty("String_Node_Str");
  String inputFile=execDictionary.get("String_Node_Str");
  int lastIndex=0;
  String localFilePrefix="String_Node_Str";
  File localStorageDir=null;
  if (inputFile != null) {
    lastIndex=inputFile.lastIndexOf(separator);
    localFilePrefix=inputFile.substring(0,lastIndex);
    localStorageDir=new File(localFilePrefix);
  }
 else   if (inputFile == null && !uploadInput) {
    localFilePrefix=System.getProperty("String_Node_Str") + separator + "String_Node_Str"+ separator+ "String_Node_Str";
    localStorageDir=new File(localFilePrefix);
  }
 else {
    status=FormStatus.InfoError;
    return;
  }
  IFileStore localDirectory=EFS.getLocalFileSystem().fromLocalFile(localStorageDir);
  String launchCMDFileName="String_Node_Str";
  if (remoteServices.canCreateConnections()) {
    try {
      connection=remoteServices.getConnectionManager().newConnection(execDictionary.get("String_Node_Str"));
    }
 catch (    RemoteConnectionException e) {
      e.printStackTrace();
      status=FormStatus.InfoError;
      return;
    }
  }
  while (!formSubmitted.get()) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e1) {
      e1.printStackTrace();
      return;
    }
  }
  try {
    launchCMDFileName=writeRemoteCommandFile();
  }
 catch (  Exception e) {
    e.printStackTrace();
    return;
  }
  connection.setAddress(execDictionary.get("String_Node_Str"));
  DataComponent credentials=(DataComponent)formAtomic.get().getComponent(1);
  connection.setUsername(credentials.retrieveAllEntries().get(0).getValue());
  connection.setPassword(credentials.retrieveAllEntries().get(1).getValue());
  try {
    connection.open(null);
  }
 catch (  RemoteConnectionException e) {
    e.printStackTrace();
    status=FormStatus.InfoError;
    return;
  }
  if (connection.isOpen() && !cancelled.get()) {
    System.out.println("String_Node_Str" + "String_Node_Str");
    IRemoteFileManager fileManager=remoteServices.getFileManager(connection);
    IFileStore fileStore=fileManager.getResource(connection.getWorkingDirectory());
    try {
      IFileStore directory=fileStore.getChild(workingDirectoryBaseName).mkdir(EFS.SHALLOW,null);
      System.out.println("String_Node_Str" + "String_Node_Str" + directory.getName());
      for (      String shortInputName : fileMap.keySet()) {
        if (cancelled.get()) {
          break;
        }
        if (uploadInput || (!uploadInput && shortInputName.equals("String_Node_Str"))) {
          IFileStore remoteFileStore=directory.getChild(shortInputName);
          File localFile=new File(fileMap.get(shortInputName));
          IFileStore localFileStore=EFS.getLocalFileSystem().fromLocalFile(localFile);
          localFileStore.copy(remoteFileStore,EFS.NONE,null);
          System.out.println("String_Node_Str" + "String_Node_Str" + shortInputName);
        }
      }
    }
 catch (    CoreException e) {
      e.printStackTrace();
      status=FormStatus.InfoError;
      return;
    }
    String remoteSeparator=connection.getProperty(IRemoteConnection.FILE_SEPARATOR_PROPERTY);
    String currentWd=connection.getWorkingDirectory();
    connection.setWorkingDirectory(currentWd + remoteSeparator + workingDirectoryBaseName);
    System.out.println("String_Node_Str" + "String_Node_Str" + connection.getWorkingDirectory());
    String launchCMD="String_Node_Str";
    if (!execDictionary.get("String_Node_Str").equals("String_Node_Str")) {
      launchCMD="String_Node_Str" + launchCMDFileName;
    }
 else {
      launchCMD="String_Node_Str" + launchCMDFileName;
    }
    IRemoteProcessBuilder processBuilder=remoteServices.getProcessBuilder(connection,"String_Node_Str",launchCMD);
    processBuilder.redirectErrorStream(false);
    try {
      System.out.println("String_Node_Str" + "String_Node_Str");
      System.out.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ launchCMDFileName);
      remoteJob=processBuilder.start(IRemoteProcessBuilder.FORWARD_X11);
    }
 catch (    IOException e) {
      e.printStackTrace();
      status=FormStatus.InfoError;
      return;
    }
    InputStream stdOutStream=remoteJob.getInputStream();
    InputStream stdErrStream=remoteJob.getErrorStream();
    if (logOutput(stdOutStream,stdErrStream).equals(FormStatus.InfoError)) {
      status=FormStatus.InfoError;
      return;
    }
    monitorJob();
    if (!cancelled.get()) {
      String fixedRemoteWD=currentWd + remoteSeparator + workingDirectoryBaseName;
      String remoteDir=(remoteDownloadDirectory == null) ? fixedRemoteWD : remoteDownloadDirectory;
      System.out.println("String_Node_Str" + "String_Node_Str" + localDirectory.getName() + "String_Node_Str"+ remoteDir+ "String_Node_Str");
      IFileStore downloadFileStore=fileManager.getResource(remoteDir);
      try {
        IFileStore[] remoteStores=downloadFileStore.childStores(EFS.NONE,null);
        for (        IFileStore remoteFile : remoteStores) {
          if (cancelled.get()) {
            break;
          }
          IFileInfo fileInfo=remoteFile.fetchInfo();
          if (fileInfo.getLength() < maxFileSize) {
            String msg="String_Node_Str" + "String_Node_Str" + fileInfo.getName() + "String_Node_Str"+ fileInfo.getLength()+ "String_Node_Str";
            System.out.println(msg);
            stdOut.write(msg + "String_Node_Str");
            IFileStore childStore=localDirectory.getChild(remoteFile.getName());
            remoteFile.copy(childStore,EFS.OVERWRITE,null);
          }
 else {
            long sizeDiff=fileInfo.getLength() - maxFileSize;
            String msg="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + fileInfo.getLength() + "String_Node_Str"+ sizeDiff+ "String_Node_Str"+ maxFileSize+ "String_Node_Str";
            System.out.println(msg);
            stdOut.write(msg + "String_Node_Str");
          }
          stdOut.flush();
        }
      }
 catch (      CoreException e) {
        e.printStackTrace();
      }
catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  status=FormStatus.Processed;
  connection.close();
  return;
}