Program: 89793
Project: 89793
Buggy source:
/** 
 * Creates a script for starting the archive database on a given machine. This is only created if the &lt;globalArchiveDatabaseDir&gt; parameter is defined on the machine level. <br/> &gt; #!/bin/bash <br/> &gt; cd InstallDir <br/> &gt; java -cp 'DB-CLASSPATH'  org.apache.derby.drda.NetworkServerControl start < /dev/null >  start_external_database.log 2>&1 &
 * @param dir The directory where the script will be placed.
 * @throws IOFailure If the script cannot be written.
 */
@Override protected void createArchiveDatabaseStartScript(File dir) throws IOFailure {
  String dbDir=machineParameters.getArchiveDatabaseDirValue();
  if (dbDir.isEmpty()) {
    return;
  }
  try {
    File startArcDBScript=new File(dir,Constants.SCRIPT_NAME_ARC_DB_START + scriptExtension);
    String port=settings.getLeafValue(Constants.SETTINGS_ARCHIVE_DATABASE_PORT);
    PrintWriter startDBPrint=new PrintWriter(startArcDBScript);
    try {
      startDBPrint.println(ScriptConstants.BIN_BASH_COMMENT);
      startDBPrint.print(ScriptConstants.CD + Constants.SPACE);
      startDBPrint.println(getInstallDirPath());
      startDBPrint.print(ScriptConstants.JAVA + Constants.SPACE);
      startDBPrint.print(ScriptConstants.JAVA_CLASSPATH);
      startDBPrint.print(Constants.SPACE + getDbClasspaths());
      startDBPrint.print(ScriptConstants.DERBY_ACCESS_METHOD);
      if (port != null && !port.isEmpty()) {
        startDBPrint.print(Constants.SPACE);
        startDBPrint.print(ScriptConstants.DATABASE_PORT_ARGUMENT);
        startDBPrint.print(Constants.SPACE);
        startDBPrint.print(port);
      }
      startDBPrint.print(Constants.SPACE);
      startDBPrint.print(ScriptConstants.DERBY_COMMAND_START);
      startDBPrint.print(Constants.SPACE);
      startDBPrint.print(ScriptConstants.LINUX_DEV_NULL);
      startDBPrint.print(Constants.SPACE);
      startDBPrint.print(Constants.SCRIPT_NAME_ARC_DB_START);
      startDBPrint.print(Constants.EXTENSION_LOG_FILES);
      startDBPrint.print(Constants.SPACE);
      startDBPrint.println(ScriptConstants.LINUX_ERROR_MESSAGE_TO_1);
    }
  finally {
      startDBPrint.close();
    }
  }
 catch (  IOException e) {
    log.trace(Constants.MSG_ERROR_DB_START_FILE,e);
    throw new IOFailure(Constants.MSG_ERROR_DB_START_FILE,e);
  }
}

Fixed version (ground truth):
/** 
 * Creates a script for starting the archive database on a given machine. This is only created if the &lt;globalArchiveDatabaseDir&gt; parameter is defined on the machine level. <br/> &gt; #!/bin/bash <br/> &gt; cd InstallDir <br/> &gt; java -cp 'DB-CLASSPATH'  org.apache.derby.drda.NetworkServerControl start < /dev/null >  start_external_database.log 2>&1 &
 * @param dir The directory where the script will be placed.
 * @throws IOFailure If the script cannot be written.
 */
@Override protected void createArchiveDatabaseStartScript(File dir) throws IOFailure {
  String dbDir=machineParameters.getArchiveDatabaseDirValue();
  if (dbDir.isEmpty()) {
    return;
  }
  try {
    File startArcDBScript=new File(dir,Constants.SCRIPT_NAME_ARC_DB_START + scriptExtension);
    String port=settings.getLeafValue(Constants.SETTINGS_ARCHIVE_DATABASE_PORT);
    PrintWriter startDBPrint=new PrintWriter(startArcDBScript);
    try {
      startDBPrint.println(ScriptConstants.BIN_BASH_COMMENT);
      startDBPrint.print(ScriptConstants.CD + Constants.SPACE);
      startDBPrint.println(getInstallDirPath());
      startDBPrint.print(ScriptConstants.JAVA + Constants.SPACE);
      startDBPrint.print(machineParameters.writeJavaOptions());
      startDBPrint.print(Constants.SPACE);
      startDBPrint.print(ScriptConstants.JAVA_CLASSPATH);
      startDBPrint.print(Constants.SPACE + getDbClasspaths());
      startDBPrint.print(ScriptConstants.DERBY_ACCESS_METHOD);
      if (port != null && !port.isEmpty()) {
        startDBPrint.print(Constants.SPACE);
        startDBPrint.print(ScriptConstants.DATABASE_PORT_ARGUMENT);
        startDBPrint.print(Constants.SPACE);
        startDBPrint.print(port);
      }
      startDBPrint.print(Constants.SPACE);
      startDBPrint.print(ScriptConstants.DERBY_COMMAND_START);
      startDBPrint.print(Constants.SPACE);
      startDBPrint.print(ScriptConstants.LINUX_DEV_NULL);
      startDBPrint.print(Constants.SPACE);
      startDBPrint.print(Constants.SCRIPT_NAME_ARC_DB_START);
      startDBPrint.print(Constants.EXTENSION_LOG_FILES);
      startDBPrint.print(Constants.SPACE);
      startDBPrint.println(ScriptConstants.LINUX_ERROR_MESSAGE_TO_1);
    }
  finally {
      startDBPrint.close();
    }
  }
 catch (  IOException e) {
    log.trace(Constants.MSG_ERROR_DB_START_FILE,e);
    throw new IOFailure(Constants.MSG_ERROR_DB_START_FILE,e);
  }
}