Program: 89600
Project: 89600
Buggy source:
/** 
 * Creates the operation system specific installation script for  this machine. Pseudo code: - echo copying 'NetarchiveSuite.zip' to: 'machine' - scp 'NetarchiveSuite.zip' 'login'@'machine': - echo unzipping 'NetarchiveSuite.zip' at: 'machine' - ssh 'login'@'machine' 'unzip' 'environmentName' -o 'NetarchiveSuite.zip - $'create directories'. - echo preparing for copying of settings and scripts - if [ $( ssh 'login'@'machine' cmd /c if exist  'environmentName'\\conf\\jmxremote.password echo 1 ) ]; then echo Y |  ssh 'login'@'machine' cmd /c cacls  'environmentName'\\conf\\jmxremote.password /P BITARKIV\\'login':F; fi - if [ $( ssh 'login'@'machine' cmd /c if exist  'environmentName'\\conf\\jmxremote.access echo 1 ) ]; then echo Y | ssh  'login'@'machine' cmd /c cacls 'environmentName'\\conf\\jmxremote.access /P BITARKIV\\'login':F; fi - echo copying settings and scripts - scp -r 'machine'/* 'login'@'machine':'environmentName'\\conf\\ - $'apply database script' - echo make password files readonly * if 'jmxremote-password-path' != 'jmxremote-password-defaultpath' - ssh 'login'@'machine' move /Y 'jmxremote-password-defaultpath'  'jmxremote-password-path' * if 'jmxremote-access-path' != 'jmxremote-access-defaultpath' - ssh 'login'@'machine' move /Y 'jmxremote-access-defaultpath'  'jmxremote-access-path' - echo Y | ssh 'login'@'machine' cmd /c cacls  'environmentName'\\'jmxremote-password-path' /P BITARKIV\\'login':R - echo Y | ssh 'login'@'machine' cmd /c cacls  'environmentName'\\'jmxremote-access-path' /P BITARKIV\\'login':R variables: 'NetarchiveSuite.zip' = The NetarchiveSuitePackage with '.zip' extension. 'machine' = The machine name. 'login' = The username for the machine. 'unzip' = The command for unzipping. 'environmentName' = the environmentName from the configuration file. $'...' = call other function.
 * @return Operation system specific part of the installscript
 */
@Override protected String osInstallScript(){
  StringBuilder res=new StringBuilder();
  res.append(ScriptConstants.ECHO_COPYING + Constants.SPACE);
  res.append(netarchiveSuiteFileName);
  res.append(Constants.SPACE + ScriptConstants.TO + Constants.COLON+ Constants.SPACE);
  res.append(name);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.SCP + Constants.SPACE);
  res.append(netarchiveSuiteFileName);
  res.append(Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.COLON);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.ECHO_UNZIPPING + Constants.SPACE);
  res.append(netarchiveSuiteFileName);
  res.append(Constants.SPACE + ScriptConstants.AT + Constants.COLON+ Constants.SPACE);
  res.append(name);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.SSH + Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_UNZIP_COMMAND + Constants.SPACE);
  res.append(getEnvironmentName());
  res.append(Constants.SPACE + ScriptConstants.SCRIPT_OUTPUT + Constants.SPACE);
  res.append(netarchiveSuiteFileName);
  res.append(Constants.NEWLINE);
  res.append(osInstallScriptCreateDir());
  res.append(ScriptConstants.ECHO_PREPARING_FOR_COPY);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.IF + Constants.SPACE + Constants.SQUARE_BRACKET_BEGIN+ Constants.SPACE+ Constants.DOLLAR_SIGN+ Constants.BRACKET_BEGIN+ Constants.SPACE+ ScriptConstants.SSH+ Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_COMMAND_RUN + Constants.SPACE+ ScriptConstants.IF+ Constants.SPACE+ ScriptConstants.EXIST+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.JMX_PASSWORD_FILE_NAME);
  res.append(Constants.SPACE + ScriptConstants.ECHO_ONE);
  res.append(Constants.SPACE + Constants.BRACKET_END + Constants.SPACE+ Constants.SQUARE_BRACKET_END+ Constants.SEMICOLON+ Constants.SPACE+ ScriptConstants.THEN+ Constants.SPACE);
  res.append(ScriptConstants.ECHO_Y + Constants.SPACE + Constants.SEPARATOR+ Constants.SPACE+ ScriptConstants.SSH+ Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_COMMAND_RUN + Constants.SPACE+ ScriptConstants.CACLS+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.JMX_PASSWORD_FILE_NAME + Constants.SPACE + ScriptConstants.SLASH_P+ Constants.SPACE+ ScriptConstants.BITARKIV_BACKSLASH_BACKSLASH);
  res.append(machineParameters.getMachineUserName().getText());
  res.append(ScriptConstants.COLON_F + Constants.SEMICOLON + Constants.SPACE+ ScriptConstants.FI+ Constants.SEMICOLON);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.IF + Constants.SPACE + Constants.SQUARE_BRACKET_BEGIN+ Constants.SPACE+ Constants.DOLLAR_SIGN+ Constants.BRACKET_BEGIN+ Constants.SPACE+ ScriptConstants.SSH+ Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_COMMAND_RUN + Constants.SPACE+ ScriptConstants.IF+ Constants.SPACE+ ScriptConstants.EXIST+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.JMX_ACCESS_FILE_NAME);
  res.append(Constants.SPACE + ScriptConstants.ECHO_ONE);
  res.append(Constants.SPACE + Constants.BRACKET_END + Constants.SPACE+ Constants.SQUARE_BRACKET_END+ Constants.SEMICOLON+ Constants.SPACE+ ScriptConstants.THEN+ Constants.SPACE+ ScriptConstants.ECHO_Y+ Constants.SPACE);
  res.append(Constants.SEPARATOR + Constants.SPACE + ScriptConstants.SSH+ Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_COMMAND_RUN + Constants.SPACE+ ScriptConstants.CACLS+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.JMX_ACCESS_FILE_NAME + Constants.SPACE + ScriptConstants.SLASH_P+ Constants.SPACE+ ScriptConstants.BITARKIV_BACKSLASH_BACKSLASH);
  res.append(machineParameters.getMachineUserName().getText());
  res.append(ScriptConstants.COLON_F + Constants.SEMICOLON + Constants.SPACE+ ScriptConstants.FI+ Constants.SEMICOLON);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.ECHO_COPY_SETTINGS_AND_SCRIPTS);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.SCP + Constants.SPACE + ScriptConstants.DASH_R+ Constants.SPACE);
  res.append(name);
  res.append(Constants.SLASH + Constants.STAR + Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.COLON);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.NEWLINE);
  res.append(osInstallExternalJarFiles());
  res.append(osInstallDatabase());
  res.append(osInstallArchiveDatabase());
  res.append(getJMXremoteFilesCommand());
  return res.toString();
}

Fixed version (ground truth):
/** 
 * Creates the operation system specific installation script for  this machine. Pseudo code: - echo copying 'NetarchiveSuite.zip' to: 'machine' - scp 'NetarchiveSuite.zip' 'login'@'machine': - echo unzipping 'NetarchiveSuite.zip' at: 'machine' - ssh 'login'@'machine' 'unzip' 'environmentName' -o 'NetarchiveSuite.zip - $'create directories'. - echo preparing for copying of settings and scripts - if [ $( ssh 'login'@'machine' cmd /c if exist  'environmentName'\\conf\\jmxremote.password echo 1 ) ]; then echo Y |  ssh 'login'@'machine' cmd /c cacls  'environmentName'\\conf\\jmxremote.password /P BITARKIV\\'login':F; fi - if [ $( ssh 'login'@'machine' cmd /c if exist  'environmentName'\\conf\\jmxremote.access echo 1 ) ]; then echo Y | ssh  'login'@'machine' cmd /c cacls 'environmentName'\\conf\\jmxremote.access /P BITARKIV\\'login':F; fi - echo copying settings and scripts - scp -r 'machine'/* 'login'@'machine':'environmentName'\\conf\\ - $'apply database script' - echo make password files readonly * if 'jmxremote-password-path' != 'jmxremote-password-defaultpath' - ssh 'login'@'machine' move /Y 'jmxremote-password-defaultpath'  'jmxremote-password-path' * if 'jmxremote-access-path' != 'jmxremote-access-defaultpath' - ssh 'login'@'machine' move /Y 'jmxremote-access-defaultpath'  'jmxremote-access-path' - echo Y | ssh 'login'@'machine' cmd /c cacls  'environmentName'\\'jmxremote-password-path' /P BITARKIV\\'login':R - echo Y | ssh 'login'@'machine' cmd /c cacls  'environmentName'\\'jmxremote-access-path' /P BITARKIV\\'login':R variables: 'NetarchiveSuite.zip' = The NetarchiveSuitePackage with '.zip' extension. 'machine' = The machine name. 'login' = The username for the machine. 'unzip' = The command for unzipping. 'environmentName' = the environmentName from the configuration file. $'...' = call other function.
 * @return Operation system specific part of the installscript
 */
@Override protected String osInstallScript(){
  StringBuilder res=new StringBuilder();
  res.append(ScriptConstants.ECHO_COPYING + Constants.SPACE);
  res.append(netarchiveSuiteFileName);
  res.append(Constants.SPACE + ScriptConstants.TO + Constants.COLON+ Constants.SPACE);
  res.append(name);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.SCP + Constants.SPACE);
  res.append(netarchiveSuiteFileName);
  res.append(Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.COLON);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.ECHO_DELETING_OLD_LIBRARIES);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.SSH + Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_COMMAND_RUN + Constants.SPACE+ ScriptConstants.IF+ Constants.SPACE+ ScriptConstants.EXIST+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalLibDirPath()) + Constants.SPACE + "String_Node_Str"+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalLibDirPath()));
  res.append(Constants.SPACE + Constants.NEWLINE);
  res.append(ScriptConstants.ECHO_UNZIPPING + Constants.SPACE);
  res.append(netarchiveSuiteFileName);
  res.append(Constants.SPACE + ScriptConstants.AT + Constants.COLON+ Constants.SPACE);
  res.append(name);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.SSH + Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_UNZIP_COMMAND + Constants.SPACE);
  res.append(getEnvironmentName());
  res.append(Constants.SPACE + ScriptConstants.SCRIPT_OUTPUT + Constants.SPACE);
  res.append(netarchiveSuiteFileName);
  res.append(Constants.NEWLINE);
  res.append(osInstallScriptCreateDir());
  res.append(ScriptConstants.ECHO_PREPARING_FOR_COPY);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.IF + Constants.SPACE + Constants.SQUARE_BRACKET_BEGIN+ Constants.SPACE+ Constants.DOLLAR_SIGN+ Constants.BRACKET_BEGIN+ Constants.SPACE+ ScriptConstants.SSH+ Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_COMMAND_RUN + Constants.SPACE+ ScriptConstants.IF+ Constants.SPACE+ ScriptConstants.EXIST+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.JMX_PASSWORD_FILE_NAME);
  res.append(Constants.SPACE + ScriptConstants.ECHO_ONE);
  res.append(Constants.SPACE + Constants.BRACKET_END + Constants.SPACE+ Constants.SQUARE_BRACKET_END+ Constants.SEMICOLON+ Constants.SPACE+ ScriptConstants.THEN+ Constants.SPACE);
  res.append(ScriptConstants.ECHO_Y + Constants.SPACE + Constants.SEPARATOR+ Constants.SPACE+ ScriptConstants.SSH+ Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_COMMAND_RUN + Constants.SPACE+ ScriptConstants.CACLS+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.JMX_PASSWORD_FILE_NAME + Constants.SPACE + ScriptConstants.SLASH_P+ Constants.SPACE+ ScriptConstants.BITARKIV_BACKSLASH_BACKSLASH);
  res.append(machineParameters.getMachineUserName().getText());
  res.append(ScriptConstants.COLON_F + Constants.SEMICOLON + Constants.SPACE+ ScriptConstants.FI+ Constants.SEMICOLON);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.IF + Constants.SPACE + Constants.SQUARE_BRACKET_BEGIN+ Constants.SPACE+ Constants.DOLLAR_SIGN+ Constants.BRACKET_BEGIN+ Constants.SPACE+ ScriptConstants.SSH+ Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_COMMAND_RUN + Constants.SPACE+ ScriptConstants.IF+ Constants.SPACE+ ScriptConstants.EXIST+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.JMX_ACCESS_FILE_NAME);
  res.append(Constants.SPACE + ScriptConstants.ECHO_ONE);
  res.append(Constants.SPACE + Constants.BRACKET_END + Constants.SPACE+ Constants.SQUARE_BRACKET_END+ Constants.SEMICOLON+ Constants.SPACE+ ScriptConstants.THEN+ Constants.SPACE+ ScriptConstants.ECHO_Y+ Constants.SPACE);
  res.append(Constants.SEPARATOR + Constants.SPACE + ScriptConstants.SSH+ Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.SPACE + ScriptConstants.WINDOWS_COMMAND_RUN + Constants.SPACE+ ScriptConstants.CACLS+ Constants.SPACE);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.JMX_ACCESS_FILE_NAME + Constants.SPACE + ScriptConstants.SLASH_P+ Constants.SPACE+ ScriptConstants.BITARKIV_BACKSLASH_BACKSLASH);
  res.append(machineParameters.getMachineUserName().getText());
  res.append(ScriptConstants.COLON_F + Constants.SEMICOLON + Constants.SPACE+ ScriptConstants.FI+ Constants.SEMICOLON);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.ECHO_COPY_SETTINGS_AND_SCRIPTS);
  res.append(Constants.NEWLINE);
  res.append(ScriptConstants.SCP + Constants.SPACE + ScriptConstants.DASH_R+ Constants.SPACE);
  res.append(name);
  res.append(Constants.SLASH + Constants.STAR + Constants.SPACE);
  res.append(machineUserLogin());
  res.append(Constants.COLON);
  res.append(ScriptConstants.doubleBackslashes(getLocalConfDirPath()));
  res.append(Constants.NEWLINE);
  res.append(osInstallExternalJarFiles());
  res.append(osInstallDatabase());
  res.append(osInstallArchiveDatabase());
  res.append(getJMXremoteFilesCommand());
  return res.toString();
}