Program: 79397
Project: 79397
Buggy source:
@Override public void customize(){
  newScript(CUSTOMIZING).execute();
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  List<String> commands=Lists.newLinkedList();
  commands.add(sudo("String_Node_Str" + getRiakEtcDir()));
  if (isVersion1()) {
    String vmArgsTemplate=processTemplate(entity.getConfig(RiakNode.RIAK_VM_ARGS_TEMPLATE_URL));
    String saveAsVmArgs=Urls.mergePaths(getRunDir(),"String_Node_Str");
    DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsVmArgs).contents(vmArgsTemplate));
    commands.add(sudo("String_Node_Str" + saveAsVmArgs + "String_Node_Str"+ getRiakEtcDir()));
    String appConfigTemplate=processTemplate(entity.getConfig(RiakNode.RIAK_APP_CONFIG_TEMPLATE_URL));
    String saveAsAppConfig=Urls.mergePaths(getRunDir(),"String_Node_Str");
    DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsAppConfig).contents(appConfigTemplate));
    commands.add(sudo("String_Node_Str" + saveAsAppConfig + "String_Node_Str"+ getRiakEtcDir()));
  }
 else {
    String templateUrl=osDetails.isMac() ? entity.getConfig(RiakNode.RIAK_CONF_TEMPLATE_URL_MAC) : entity.getConfig(RiakNode.RIAK_CONF_TEMPLATE_URL_LINUX);
    String riakConfTemplate=processTemplate(templateUrl);
    String saveAsRiakConf=Urls.mergePaths(getRunDir(),"String_Node_Str");
    DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsRiakConf).contents(riakConfTemplate));
    commands.add(sudo("String_Node_Str" + saveAsRiakConf + "String_Node_Str"+ getRiakEtcDir()));
  }
  if (osDetails.isMac()) {
    commands.add("String_Node_Str");
  }
 else   if (osDetails.isLinux() && isVersion1()) {
    commands.add(sudo("String_Node_Str" + getRiakEtcDir()));
  }
  ScriptHelper customizeScript=newScript(CUSTOMIZING).failOnNonZeroResultCode().body.append(commands);
  if (!isRiakOnPath()) {
    Map<String,String> newPathVariable=ImmutableMap.of("String_Node_Str",sbinPath);
    log.warn("String_Node_Str",getShellEnvironment(),newPathVariable);
    customizeScript.environmentVariablesReset(newPathVariable);
  }
  customizeScript.failOnNonZeroResultCode().execute();
  if (osDetails.isLinux()) {
    ImmutableMap<String,String> sysctl=ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build();
    ScriptHelper optimize=newScript(CUSTOMIZING + "String_Node_Str").body.append(sudo("String_Node_Str" + Joiner.on(' ').withKeyValueSeparator("String_Node_Str").join(sysctl)));
    Optional<Boolean> enable=Optional.fromNullable(entity.getConfig(RiakNode.OPTIMIZE_HOST_NETWORKING));
    if (!enable.isPresent())     optimize.inessential();
    if (enable.or(true))     optimize.execute();
  }
  entity.setAttribute(RiakNode.RIAK_NODE_NAME,format("String_Node_Str",getSubnetHostname()));
}

Fixed version (ground truth):
@Override public void customize(){
  checkRiakOnPath();
  newScript(CUSTOMIZING).execute();
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  List<String> commands=Lists.newLinkedList();
  commands.add(sudo("String_Node_Str" + getRiakEtcDir()));
  if (isVersion1()) {
    String vmArgsTemplate=processTemplate(entity.getConfig(RiakNode.RIAK_VM_ARGS_TEMPLATE_URL));
    String saveAsVmArgs=Urls.mergePaths(getRunDir(),"String_Node_Str");
    DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsVmArgs).contents(vmArgsTemplate));
    commands.add(sudo("String_Node_Str" + saveAsVmArgs + "String_Node_Str"+ getRiakEtcDir()));
    String appConfigTemplate=processTemplate(entity.getConfig(RiakNode.RIAK_APP_CONFIG_TEMPLATE_URL));
    String saveAsAppConfig=Urls.mergePaths(getRunDir(),"String_Node_Str");
    DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsAppConfig).contents(appConfigTemplate));
    commands.add(sudo("String_Node_Str" + saveAsAppConfig + "String_Node_Str"+ getRiakEtcDir()));
  }
 else {
    String templateUrl=osDetails.isMac() ? entity.getConfig(RiakNode.RIAK_CONF_TEMPLATE_URL_MAC) : entity.getConfig(RiakNode.RIAK_CONF_TEMPLATE_URL_LINUX);
    String riakConfTemplate=processTemplate(templateUrl);
    String saveAsRiakConf=Urls.mergePaths(getRunDir(),"String_Node_Str");
    DynamicTasks.queueIfPossible(SshEffectorTasks.put(saveAsRiakConf).contents(riakConfTemplate));
    commands.add(sudo("String_Node_Str" + saveAsRiakConf + "String_Node_Str"+ getRiakEtcDir()));
  }
  if (osDetails.isMac()) {
    commands.add("String_Node_Str");
  }
  if (osDetails.isLinux() && isVersion1()) {
    commands.add(sudo("String_Node_Str" + getRiakEtcDir()));
  }
  ScriptHelper customizeScript=newScript(CUSTOMIZING).failOnNonZeroResultCode().body.append(commands);
  if (!isRiakOnPath()) {
    Map<String,String> newPathVariable=ImmutableMap.of("String_Node_Str",sbinPath);
    log.warn("String_Node_Str",getShellEnvironment(),newPathVariable);
    customizeScript.environmentVariablesReset(newPathVariable);
  }
  customizeScript.failOnNonZeroResultCode().execute();
  if (osDetails.isLinux()) {
    ImmutableMap<String,String> sysctl=ImmutableMap.<String,String>builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").put("String_Node_Str","String_Node_Str").build();
    ScriptHelper optimize=newScript(CUSTOMIZING + "String_Node_Str").body.append(sudo("String_Node_Str" + Joiner.on(' ').withKeyValueSeparator("String_Node_Str").join(sysctl)));
    Optional<Boolean> enable=Optional.fromNullable(entity.getConfig(RiakNode.OPTIMIZE_HOST_NETWORKING));
    if (!enable.isPresent())     optimize.inessential();
    if (enable.or(true))     optimize.execute();
  }
  entity.setAttribute(RiakNode.RIAK_NODE_NAME,format("String_Node_Str",getSubnetHostname()));
}