Program: 79632
Project: 79632
Buggy source:
@Override public void customize(){
  newScript(CUSTOMIZING).failOnNonZeroResultCode().body.append(format("String_Node_Str",getInstallDir(),getVersion()),"String_Node_Str").execute();
  SshMachineLocation machine=getMachine();
  BrooklynNode entity=getEntity();
  String brooklynPropertiesTempRemotePath=String.format("String_Node_Str",getRunDir());
  String brooklynPropertiesRemotePath=entity.getConfig(BrooklynNode.BROOKLYN_PROPERTIES_REMOTE_PATH);
  String brooklynPropertiesContents=entity.getConfig(BrooklynNode.BROOKLYN_PROPERTIES_CONTENTS);
  String brooklynPropertiesUri=entity.getConfig(BrooklynNode.BROOKLYN_PROPERTIES_URI);
  if (brooklynPropertiesContents != null || brooklynPropertiesUri != null) {
    if (brooklynPropertiesContents != null) {
      machine.copyTo(new ByteArrayInputStream(brooklynPropertiesContents.getBytes()),brooklynPropertiesTempRemotePath);
    }
 else     if (brooklynPropertiesUri != null) {
      InputStream propertiesStream=new ResourceUtils(entity).getResourceFromUrl(brooklynPropertiesUri);
      machine.copyTo(propertiesStream,brooklynPropertiesTempRemotePath);
    }
    newScript(CUSTOMIZING).body.append(format("String_Node_Str",brooklynPropertiesTempRemotePath,brooklynPropertiesRemotePath)).execute();
  }
  String brooklynCatalogTempRemotePath=String.format("String_Node_Str",getRunDir());
  String brooklynCatalogRemotePath=entity.getConfig(BrooklynNode.BROOKLYN_CATALOG_REMOTE_PATH);
  String brooklynCatalogContents=entity.getConfig(BrooklynNode.BROOKLYN_CATALOG_CONTENTS);
  String brooklynCatalogUri=entity.getConfig(BrooklynNode.BROOKLYN_CATALOG_URI);
  if (brooklynCatalogContents != null || brooklynCatalogUri != null) {
    if (brooklynCatalogContents != null) {
      machine.copyTo(new ByteArrayInputStream(brooklynCatalogContents.getBytes()),brooklynCatalogTempRemotePath);
    }
 else     if (brooklynCatalogUri != null) {
      InputStream catalogStream=new ResourceUtils(entity).getResourceFromUrl(brooklynCatalogUri);
      machine.copyTo(catalogStream,brooklynCatalogTempRemotePath);
    }
    newScript(CUSTOMIZING).body.append(format("String_Node_Str",brooklynCatalogTempRemotePath,brooklynCatalogRemotePath)).execute();
  }
  for (  Map.Entry<String,String> entry : getEntity().getAttribute(BrooklynNode.COPY_TO_RUNDIR).entrySet()) {
    Map<String,String> substitutions=ImmutableMap.of("String_Node_Str",getRunDir());
    String localResource=entry.getKey();
    String remotePath=entry.getValue();
    String resolvedRemotePath=remotePath;
    for (    Map.Entry<String,String> substitution : substitutions.entrySet()) {
      String key=substitution.getKey();
      String val=substitution.getValue();
      resolvedRemotePath=resolvedRemotePath.replace("String_Node_Str" + key + "String_Node_Str",val).replace("String_Node_Str" + key,val);
    }
    machine.copyTo(MutableMap.of("String_Node_Str","String_Node_Str"),new ResourceUtils(entity).getResourceFromUrl(localResource),resolvedRemotePath);
  }
  for (  String f : getEntity().getClasspath()) {
    String toinstall;
    if (new File(f).isDirectory()) {
      try {
        File jarFile=JarBuilder.buildJar(new File(f));
        toinstall=jarFile.getAbsolutePath();
      }
 catch (      IOException e) {
        throw new IllegalStateException("String_Node_Str" + f,e);
      }
    }
 else {
      toinstall=f;
    }
    int result=machine.installTo(new ResourceUtils(entity),toinstall,getRunDir() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    if (result != 0)     throw new IllegalStateException(format("String_Node_Str",f,entity,machine));
    String destName=f;
    destName=destName.contains("String_Node_Str") ? destName.substring(0,destName.indexOf('?')) : destName;
    destName=destName.substring(destName.lastIndexOf('/') + 1);
    if (destName.toLowerCase().endsWith("String_Node_Str")) {
      result=machine.run(format("String_Node_Str",getRunDir(),destName));
    }
 else     if (destName.toLowerCase().endsWith("String_Node_Str") || destName.toLowerCase().endsWith("String_Node_Str")) {
      result=machine.run(format("String_Node_Str",getRunDir(),destName));
    }
 else     if (destName.toLowerCase().endsWith("String_Node_Str")) {
      result=machine.run(format("String_Node_Str",getRunDir(),destName));
    }
    if (result != 0)     throw new IllegalStateException(format("String_Node_Str",f,entity,machine));
  }
}

Fixed version (ground truth):
@Override public void customize(){
  newScript(CUSTOMIZING).failOnNonZeroResultCode().body.append(format("String_Node_Str",getInstallDir(),getVersion()),"String_Node_Str").execute();
  SshMachineLocation machine=getMachine();
  BrooklynNode entity=getEntity();
  String brooklynPropertiesTempRemotePath=String.format("String_Node_Str",getRunDir());
  String brooklynPropertiesRemotePath=entity.getConfig(BrooklynNode.BROOKLYN_PROPERTIES_REMOTE_PATH);
  String brooklynPropertiesContents=entity.getConfig(BrooklynNode.BROOKLYN_PROPERTIES_CONTENTS);
  String brooklynPropertiesUri=entity.getConfig(BrooklynNode.BROOKLYN_PROPERTIES_URI);
  if (brooklynPropertiesContents != null || brooklynPropertiesUri != null) {
    if (brooklynPropertiesContents != null) {
      machine.copyTo(new ByteArrayInputStream(brooklynPropertiesContents.getBytes()),brooklynPropertiesTempRemotePath);
    }
 else     if (brooklynPropertiesUri != null) {
      InputStream propertiesStream=new ResourceUtils(entity).getResourceFromUrl(brooklynPropertiesUri);
      machine.copyTo(propertiesStream,brooklynPropertiesTempRemotePath);
    }
    newScript(CUSTOMIZING).failOnNonZeroResultCode().body.append(format("String_Node_Str",brooklynPropertiesRemotePath.subSequence(0,brooklynPropertiesRemotePath.lastIndexOf("String_Node_Str"))),format("String_Node_Str",brooklynPropertiesTempRemotePath,brooklynPropertiesRemotePath)).execute();
  }
  String brooklynCatalogTempRemotePath=String.format("String_Node_Str",getRunDir());
  String brooklynCatalogRemotePath=entity.getConfig(BrooklynNode.BROOKLYN_CATALOG_REMOTE_PATH);
  String brooklynCatalogContents=entity.getConfig(BrooklynNode.BROOKLYN_CATALOG_CONTENTS);
  String brooklynCatalogUri=entity.getConfig(BrooklynNode.BROOKLYN_CATALOG_URI);
  if (brooklynCatalogContents != null || brooklynCatalogUri != null) {
    if (brooklynCatalogContents != null) {
      machine.copyTo(new ByteArrayInputStream(brooklynCatalogContents.getBytes()),brooklynCatalogTempRemotePath);
    }
 else     if (brooklynCatalogUri != null) {
      InputStream catalogStream=new ResourceUtils(entity).getResourceFromUrl(brooklynCatalogUri);
      machine.copyTo(catalogStream,brooklynCatalogTempRemotePath);
    }
    newScript(CUSTOMIZING).body.append(format("String_Node_Str",brooklynCatalogTempRemotePath,brooklynCatalogRemotePath)).execute();
  }
  for (  Map.Entry<String,String> entry : getEntity().getAttribute(BrooklynNode.COPY_TO_RUNDIR).entrySet()) {
    Map<String,String> substitutions=ImmutableMap.of("String_Node_Str",getRunDir());
    String localResource=entry.getKey();
    String remotePath=entry.getValue();
    String resolvedRemotePath=remotePath;
    for (    Map.Entry<String,String> substitution : substitutions.entrySet()) {
      String key=substitution.getKey();
      String val=substitution.getValue();
      resolvedRemotePath=resolvedRemotePath.replace("String_Node_Str" + key + "String_Node_Str",val).replace("String_Node_Str" + key,val);
    }
    machine.copyTo(MutableMap.of("String_Node_Str","String_Node_Str"),new ResourceUtils(entity).getResourceFromUrl(localResource),resolvedRemotePath);
  }
  for (  String f : getEntity().getClasspath()) {
    String toinstall;
    if (new File(f).isDirectory()) {
      try {
        File jarFile=JarBuilder.buildJar(new File(f));
        toinstall=jarFile.getAbsolutePath();
      }
 catch (      IOException e) {
        throw new IllegalStateException("String_Node_Str" + f,e);
      }
    }
 else {
      toinstall=f;
    }
    int result=machine.installTo(new ResourceUtils(entity),toinstall,getRunDir() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    if (result != 0)     throw new IllegalStateException(format("String_Node_Str",f,entity,machine));
    String destName=f;
    destName=destName.contains("String_Node_Str") ? destName.substring(0,destName.indexOf('?')) : destName;
    destName=destName.substring(destName.lastIndexOf('/') + 1);
    if (destName.toLowerCase().endsWith("String_Node_Str")) {
      result=machine.run(format("String_Node_Str",getRunDir(),destName));
    }
 else     if (destName.toLowerCase().endsWith("String_Node_Str") || destName.toLowerCase().endsWith("String_Node_Str")) {
      result=machine.run(format("String_Node_Str",getRunDir(),destName));
    }
 else     if (destName.toLowerCase().endsWith("String_Node_Str")) {
      result=machine.run(format("String_Node_Str",getRunDir(),destName));
    }
    if (result != 0)     throw new IllegalStateException(format("String_Node_Str",f,entity,machine));
  }
}