nus-yam/ex-repair huggingface dataset:
Program: 79601
Project: 79601
Buggy source:
@Override protected void restart(){
  if (((SoftwareProcessImpl)entity()).getDriver() == null)   throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str");
  ((SoftwareProcessImpl)entity()).getDriver().restart();
  new DynamicTasks.AutoQueueVoid("String_Node_Str"){
    protected void main(){
      ((SoftwareProcessImpl)entity()).postDriverRestart();
    }
  }
;
}

Fixed version (ground truth):
@Override protected void restart(){
  if (((SoftwareProcessImpl)entity()).getDriver() == null)   throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str");
  ((SoftwareProcessImpl)entity()).getDriver().restart();
  new DynamicTasks.AutoQueueVoid("String_Node_Str"){
    protected void main(){
      ((SoftwareProcessImpl)entity()).postDriverRestart();
      DynamicTasks.waitForLast();
      entity().setAttribute(Attributes.SERVICE_STATE,Lifecycle.RUNNING);
    }
  }
;
}
Program: 79602
Project: 79602
Buggy source:
protected void main(){
  ((SoftwareProcessImpl)entity()).postDriverRestart();
}

Fixed version (ground truth):
protected void main(){
  ((SoftwareProcessImpl)entity()).postDriverRestart();
  DynamicTasks.waitForLast();
  entity().setAttribute(Attributes.SERVICE_STATE,Lifecycle.RUNNING);
}
Program: 79603
Project: 79603
Buggy source:
@Test public void testReleaseEvenIfErrorDuringStart() throws Exception {
  MyServiceImpl entity=new MyServiceImpl(app){
    @Override public Class getDriverInterface(){
      return SimulatedFailOnStartDriver.class;
    }
  }
;
  Entities.manage(entity);
  try {
    entity.start(ImmutableList.of(loc));
    Assert.fail();
  }
 catch (  Exception e) {
    IllegalStateException cause=Throwables2.getFirstThrowableOfType(e,IllegalStateException.class);
    if (cause == null || !cause.toString().contains("String_Node_Str"))     throw e;
  }
  try {
    entity.stop();
  }
 catch (  Exception e) {
    LOG.info("String_Node_Str",e);
  }
  Assert.assertEquals(loc.getAvailable(),ImmutableSet.of(machine));
}

Fixed version (ground truth):
@Test public void testReleaseEvenIfErrorDuringStart() throws Exception {
  MyServiceImpl entity=new MyServiceImpl(app){
    @Override public Class getDriverInterface(){
      return SimulatedFailOnStartDriver.class;
    }
  }
;
  Entities.manage(entity);
  try {
    entity.start(ImmutableList.of(loc));
    Assert.fail();
  }
 catch (  Exception e) {
    IllegalStateException cause=Throwables2.getFirstThrowableOfType(e,IllegalStateException.class);
    if (cause == null || !cause.toString().contains("String_Node_Str"))     throw e;
  }
  try {
    entity.stop();
  }
 catch (  Exception e) {
    LOG.info("String_Node_Str",e);
  }
  Assert.assertEquals(loc.getAvailable(),ImmutableSet.of(machine));
  Entities.unmanage(entity);
}
Program: 79604
Project: 79604
Buggy source:
@Test public void testReleaseEvenIfErrorDuringStop() throws Exception {
  MyServiceImpl entity=new MyServiceImpl(app){
    @Override public Class getDriverInterface(){
      return SimulatedFailOnStopDriver.class;
    }
  }
;
  Entities.manage(entity);
  entity.start(ImmutableList.of(loc));
  try {
    entity.stop();
    Assert.fail();
  }
 catch (  Exception e) {
    Assert.assertEquals(loc.getAvailable(),ImmutableSet.of(machine));
    IllegalStateException cause=Throwables2.getFirstThrowableOfType(e,IllegalStateException.class);
    if (cause == null || !cause.toString().contains("String_Node_Str"))     throw e;
  }
}

Fixed version (ground truth):
@Test public void testReleaseEvenIfErrorDuringStop() throws Exception {
  MyServiceImpl entity=new MyServiceImpl(app){
    @Override public Class getDriverInterface(){
      return SimulatedFailOnStopDriver.class;
    }
  }
;
  Entities.manage(entity);
  entity.start(ImmutableList.of(loc));
  try {
    entity.stop();
    Assert.fail();
  }
 catch (  Exception e) {
    Assert.assertEquals(loc.getAvailable(),ImmutableSet.of(machine));
    IllegalStateException cause=Throwables2.getFirstThrowableOfType(e,IllegalStateException.class);
    if (cause == null || !cause.toString().contains("String_Node_Str"))     throw e;
  }
  Entities.unmanage(entity);
}
Program: 79606
Project: 79606
Buggy source:
@Override protected void connectSensors(){
  super.connectSensors();
  ConfigToAttributes.apply(this);
  String host=getAttribute(HOSTNAME);
  URI webConsoleUri;
  if (isHttpProtocolEnabled("String_Node_Str")) {
    int port=getConfig(PORT_MAPPER).apply(getAttribute(HTTP_PORT));
    webConsoleUri=URI.create(String.format("String_Node_Str",host,port));
    setAttribute(WEB_CONSOLE_URI,webConsoleUri);
  }
 else   if (isHttpProtocolEnabled("String_Node_Str")) {
    int port=getConfig(PORT_MAPPER).apply(getAttribute(HTTPS_PORT));
    webConsoleUri=URI.create(String.format("String_Node_Str",host,port));
    setAttribute(WEB_CONSOLE_URI,webConsoleUri);
  }
 else {
    setAttribute(WEB_CONSOLE_URI,null);
    webConsoleUri=null;
  }
  if (webConsoleUri != null) {
    httpFeed=HttpFeed.builder().entity(this).period(200).baseUri(webConsoleUri).credentialsIfNotNull(getConfig(MANAGEMENT_USER),getConfig(MANAGEMENT_PASSWORD)).poll(new HttpPollConfig<Boolean>(SERVICE_UP).onSuccess(HttpValueFunctions.responseCodeEquals(200)).setOnFailureOrException(false)).build();
  }
 else {
    setAttribute(SERVICE_UP,true);
  }
}

Fixed version (ground truth):
@Override protected void connectSensors(){
  super.connectSensors();
  ConfigToAttributes.apply(this);
  String host;
  if (getAttribute(NO_WEB_CONSOLE_AUTHENTICATION)) {
    host="String_Node_Str";
  }
 else {
    host=getAttribute(HOSTNAME);
  }
  URI webConsoleUri;
  if (isHttpProtocolEnabled("String_Node_Str")) {
    int port=getConfig(PORT_MAPPER).apply(getAttribute(HTTP_PORT));
    webConsoleUri=URI.create(String.format("String_Node_Str",host,port));
    setAttribute(WEB_CONSOLE_URI,webConsoleUri);
  }
 else   if (isHttpProtocolEnabled("String_Node_Str")) {
    int port=getConfig(PORT_MAPPER).apply(getAttribute(HTTPS_PORT));
    webConsoleUri=URI.create(String.format("String_Node_Str",host,port));
    setAttribute(WEB_CONSOLE_URI,webConsoleUri);
  }
 else {
    setAttribute(WEB_CONSOLE_URI,null);
    webConsoleUri=null;
  }
  if (webConsoleUri != null) {
    httpFeed=HttpFeed.builder().entity(this).period(200).baseUri(webConsoleUri).credentialsIfNotNull(getConfig(MANAGEMENT_USER),getConfig(MANAGEMENT_PASSWORD)).poll(new HttpPollConfig<Boolean>(SERVICE_UP).onSuccess(HttpValueFunctions.responseCodeEquals(200)).setOnFailureOrException(false)).build();
  }
 else {
    setAttribute(SERVICE_UP,true);
  }
}
Program: 79607
Project: 79607
Buggy source:
private <T>T parseJson(String json,List<String> elements,Class<T> clazz){
  Function<String,T> func=HttpValueFunctions.chain(JsonFunctions.asJson(),JsonFunctions.walk(elements.toArray(new String[elements.size()])),JsonFunctions.cast(clazz));
  return func.apply(json);
}

Fixed version (ground truth):
private <T>T parseJson(String json,List<String> elements,Class<T> clazz){
  Function<String,T> func=HttpValueFunctions.chain(JsonFunctions.asJson(),JsonFunctions.walk(elements),JsonFunctions.cast(clazz));
  return func.apply(json);
}
Program: 79608
Project: 79608
Buggy source:
@AfterMethod(alwaysRun=true) public void tearDown() throws Exception {
  if (app != null)   Entities.destroyAll(app.getManagementContext());
  if (pseudoBrooklynPropertiesFile != null)   pseudoBrooklynPropertiesFile.delete();
  if (pseudoBrooklynCatalogFile != null)   pseudoBrooklynCatalogFile.delete();
}

Fixed version (ground truth):
@AfterMethod(alwaysRun=true) public void tearDown() throws Exception {
  if (app != null)   Entities.destroyAll(app.getManagementSupport().getManagementContext());
  if (pseudoBrooklynPropertiesFile != null)   pseudoBrooklynPropertiesFile.delete();
  if (pseudoBrooklynCatalogFile != null)   pseudoBrooklynCatalogFile.delete();
}
Program: 79609
Project: 79609
Buggy source:
private <T>List<T> parseJsonList(String json,List<String> elements,Class<T> clazz){
  Function<String,List<T>> func=HttpValueFunctions.chain(JsonFunctions.asJson(),JsonFunctions.forEach(HttpValueFunctions.chain(JsonFunctions.walk(elements.toArray(new String[elements.size()])),JsonFunctions.cast(clazz))));
  return func.apply(json);
}

Fixed version (ground truth):
private <T>List<T> parseJsonList(String json,List<String> elements,Class<T> clazz){
  Function<String,List<T>> func=HttpValueFunctions.chain(JsonFunctions.asJson(),JsonFunctions.forEach(HttpValueFunctions.chain(JsonFunctions.walk(elements),JsonFunctions.cast(clazz))));
  return func.apply(json);
}
Program: 79610
Project: 79610
Buggy source:
@BeforeMethod(alwaysRun=true) public void setUp() throws Exception {
  pseudoBrooklynPropertiesFile=File.createTempFile("String_Node_Str","String_Node_Str");
  pseudoBrooklynPropertiesFile.delete();
  pseudoBrooklynCatalogFile=File.createTempFile("String_Node_Str","String_Node_Str");
  pseudoBrooklynCatalogFile.delete();
  locs=ImmutableList.of(new LocalhostMachineProvisioningLocation());
  app=ApplicationBuilder.newManagedApp(TestApplication.class);
}

Fixed version (ground truth):
@BeforeMethod(alwaysRun=true) public void setUp() throws Exception {
  pseudoBrooklynPropertiesFile=File.createTempFile("String_Node_Str","String_Node_Str");
  pseudoBrooklynPropertiesFile.delete();
  pseudoBrooklynCatalogFile=File.createTempFile("String_Node_Str","String_Node_Str");
  pseudoBrooklynCatalogFile.delete();
  app=ApplicationBuilder.newManagedApp(TestApplication.class);
  Location localhost=app.getManagementSupport().getManagementContext().getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class));
  locs=ImmutableList.of(localhost);
}
Program: 79611
Project: 79611
Buggy source:
/** 
 * augments the given item with annotations and class data for the given class, then adds to catalog 
 * @return 
 */
public CatalogItem<?> addCatalogEntry(CatalogItemDtoAbstract<?> item,Class<?> c){
  Catalog annotations=c.getAnnotation(Catalog.class);
  item.type=c.getName();
  item.name=firstNonEmpty(c.getSimpleName(),c.getName());
  if (annotations != null) {
    item.name=firstNonEmpty(annotations.name(),item.name);
    item.description=firstNonEmpty(annotations.description());
    item.iconUrl=firstNonEmpty(annotations.iconUrl());
  }
  if (log.isTraceEnabled())   log.trace("String_Node_Str" + c + "String_Node_Str"+ catalog+ "String_Node_Str");
  catalog.addEntry(item);
  return item;
}

Fixed version (ground truth):
/** 
 * augments the given item with annotations and class data for the given class, then adds to catalog 
 */
public CatalogItem<?> addCatalogEntry(CatalogItemDtoAbstract<?> item,Class<?> c){
  Catalog annotations=c.getAnnotation(Catalog.class);
  item.type=c.getName();
  item.name=firstNonEmpty(c.getSimpleName(),c.getName());
  if (annotations != null) {
    item.name=firstNonEmpty(annotations.name(),item.name);
    item.description=firstNonEmpty(annotations.description());
    item.iconUrl=firstNonEmpty(annotations.iconUrl());
  }
  if (log.isTraceEnabled())   log.trace("String_Node_Str" + c + "String_Node_Str"+ catalog+ "String_Node_Str");
  catalog.addEntry(item);
  return item;
}
Program: 79612
Project: 79612
Buggy source:
/** 
 * adds the given entry to the catalog, with no enrichment; callers may prefer   {@link CatalogClasspathDo#addCatalogEntry(AbstractCatalogItem, Class))}
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public synchronized void addEntry(CatalogItemDtoAbstract<?> entry){
  if (dto.entries == null)   dto.entries=new ArrayList<CatalogItemDtoAbstract<?>>();
  dto.entries.add(entry);
  if (cache != null)   cache.put(entry.getId(),new CatalogItemDo(this,entry));
}

Fixed version (ground truth):
/** 
 * adds the given entry to the catalog, with no enrichment; callers may prefer   {@link CatalogClasspathDo#addCatalogEntry(CatalogItemDtoAbstract,Class)}
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public synchronized void addEntry(CatalogItemDtoAbstract<?> entry){
  if (dto.entries == null)   dto.entries=new ArrayList<CatalogItemDtoAbstract<?>>();
  dto.entries.add(entry);
  if (cache != null)   cache.put(entry.getId(),new CatalogItemDo(this,entry));
}
Program: 79613
Project: 79613
Buggy source:
/** 
 * Convenience for finding named effector in   {@link #getEffectors()} {@link Map}. 
 */
public <T>Effector<T> getEffector(String effectorName){
  return (Effector<T>)entityType.getEffector(effectorName);
}

Fixed version (ground truth):
/** 
 * Convenience for finding named effector in   {@link EntityType#getEffectors()} {@link Map}. 
 */
public <T>Effector<T> getEffector(String effectorName){
  return (Effector<T>)entityType.getEffector(effectorName);
}
Program: 79614
Project: 79614
Buggy source:
/** 
 * Starts managing the given (unmanaged) app, setting the given brooklyn properties on the new management context.
 * @see startManagement(Entity)
 */
public static ManagementContext startManagement(Application app,BrooklynProperties props){
  if (isManaged(app)) {
    throw new IllegalStateException("String_Node_Str" + app + "String_Node_Str");
  }
  ManagementContext mgmt=new LocalManagementContext(props);
  mgmt.getEntityManager().manage(app);
  return mgmt;
}

Fixed version (ground truth):
/** 
 * Starts managing the given (unmanaged) app, setting the given brooklyn properties on the new management context.
 * @see #startManagement(Entity)
 */
public static ManagementContext startManagement(Application app,BrooklynProperties props){
  if (isManaged(app)) {
    throw new IllegalStateException("String_Node_Str" + app + "String_Node_Str");
  }
  ManagementContext mgmt=new LocalManagementContext(props);
  mgmt.getEntityManager().manage(app);
  return mgmt;
}
Program: 79615
Project: 79615
Buggy source:
/** 
 * Like   {@link setAttribute(AttributeSensor, T)}, except does not publish an attribute-change event.
 */
<T>T setAttributeWithoutPublishing(AttributeSensor<T> sensor,T val);

Fixed version (ground truth):
/** 
 * Like   {@link EntityLocal#setAttribute(AttributeSensor,Object)}, except does not publish an attribute-change event.
 */
<T>T setAttributeWithoutPublishing(AttributeSensor<T> sensor,T val);
Program: 79616
Project: 79616
Buggy source:
/** 
 * The default is (in-order) to: <ol> <li>Use the local repo, if any (defaulting to $HOME/.brooklyn/repository) <li>Use brooklyn properties for any download overrides defined there (see   {@link DownloadPropertiesResolver}<li>Use the entity's Attributes.DOWNLOAD_URL <li>Use the cloudsoft fallback repo </ol>
 * @param config
 * @return
 */
public static BasicDownloadsManager newDefault(StringConfigMap config){
  BasicDownloadsManager result=new BasicDownloadsManager();
  DownloadProducerFromLocalRepo localRepoProducer=new DownloadProducerFromLocalRepo(config);
  DownloadProducerFromProperties propertiesProducer=new DownloadProducerFromProperties(config);
  DownloadProducerFromUrlAttribute attributeProducer=new DownloadProducerFromUrlAttribute();
  DownloadProducerFromCloudsoftRepo cloudsoftRepoProducer=new DownloadProducerFromCloudsoftRepo(config);
  result.registerProducer(localRepoProducer);
  result.registerProducer(propertiesProducer);
  result.registerProducer(attributeProducer);
  result.registerProducer(cloudsoftRepoProducer);
  result.registerFilenameProducer(FilenameProducers.fromFilenameProperty());
  result.registerFilenameProducer(FilenameProducers.firstPrimaryTargetOf(propertiesProducer));
  result.registerFilenameProducer(FilenameProducers.firstPrimaryTargetOf(attributeProducer));
  return result;
}

Fixed version (ground truth):
/** 
 * The default is (in-order) to: <ol> <li>Use the local repo, if any (defaulting to $HOME/.brooklyn/repository) <li>Use brooklyn properties for any download overrides defined there (see   {@link DownloadProducerFromProperties}<li>Use the entity's Attributes.DOWNLOAD_URL <li>Use the cloudsoft fallback repo </ol>
 * @param config
 */
public static BasicDownloadsManager newDefault(StringConfigMap config){
  BasicDownloadsManager result=new BasicDownloadsManager();
  DownloadProducerFromLocalRepo localRepoProducer=new DownloadProducerFromLocalRepo(config);
  DownloadProducerFromProperties propertiesProducer=new DownloadProducerFromProperties(config);
  DownloadProducerFromUrlAttribute attributeProducer=new DownloadProducerFromUrlAttribute();
  DownloadProducerFromCloudsoftRepo cloudsoftRepoProducer=new DownloadProducerFromCloudsoftRepo(config);
  result.registerProducer(localRepoProducer);
  result.registerProducer(propertiesProducer);
  result.registerProducer(attributeProducer);
  result.registerProducer(cloudsoftRepoProducer);
  result.registerFilenameProducer(FilenameProducers.fromFilenameProperty());
  result.registerFilenameProducer(FilenameProducers.firstPrimaryTargetOf(propertiesProducer));
  result.registerFilenameProducer(FilenameProducers.firstPrimaryTargetOf(attributeProducer));
  return result;
}
Program: 79617
Project: 79617
Buggy source:
/** 
 * @param val
 * @param file
 * @param executor A sequential executor (e.g. SingleThreadedExecutor, or equivalent)
 * @param serializer
 */
public MementoFileWriter(File file,ListeningExecutorService executor,MementoSerializer<? super T> serializer){
  this.file=file;
  this.executor=executor;
  this.serializer=serializer;
  this.tmpFile=new File(file.getParentFile(),file.getName() + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param file
 * @param executor A sequential executor (e.g. SingleThreadedExecutor, or equivalent)
 * @param serializer
 */
public MementoFileWriter(File file,ListeningExecutorService executor,MementoSerializer<? super T> serializer){
  this.file=file;
  this.executor=executor;
  this.serializer=serializer;
  this.tmpFile=new File(file.getParentFile(),file.getName() + "String_Node_Str");
}
Program: 79618
Project: 79618
Buggy source:
/** 
 * returns the sensor value for this attribute on the given entity, if present, otherwise works out what the sensor value should be based on the config key's value <p> calls to this may allocate resources (e.g. ports) so should be called only once and  then (if non-null) assigned as the sensor's value <p> <b>(for this reason this method should generally not be invoked by callers except in tests and by the framework, and similarly should not be overridden; implement convertConfigToSensor instead for single-execution calls. the framework calls this from   {@link EntityLocal#setAttribute(AttributeSensorAndConfigKey)} typically via  {@link ConfigToAttributes#apply(EntityLocal)} e.g. from SoftwareProcess.preStart.)</b> 
 */
public SensorType getAsSensorValue(Entity e){
  SensorType sensorValue=e.getAttribute(this);
  if (sensorValue != null)   return sensorValue;
  ConfigType v=((EntityLocal)e).getConfig(this);
  try {
    return convertConfigToSensor(v,e);
  }
 catch (  Throwable t) {
    throw new IllegalArgumentException("String_Node_Str" + v + "String_Node_Str"+ this+ "String_Node_Str"+ t,t);
  }
}

Fixed version (ground truth):
/** 
 * returns the sensor value for this attribute on the given entity, if present, otherwise works out what the sensor value should be based on the config key's value <p> calls to this may allocate resources (e.g. ports) so should be called only once and  then (if non-null) assigned as the sensor's value <p> <b>(for this reason this method should generally not be invoked by callers except in tests and by the framework, and similarly should not be overridden; implement   {@link #convertConfigToSensor(Object,Entity)} instead for single-execution calls.the framework calls this from  {@link AbstractEntity#setAttribute(AttributeSensorAndConfigKey)} typically via  {@link ConfigToAttributes#apply(EntityLocal)} e.g. from SoftwareProcessImpl.preStart().)</b> 
 */
public SensorType getAsSensorValue(Entity e){
  SensorType sensorValue=e.getAttribute(this);
  if (sensorValue != null)   return sensorValue;
  ConfigType v=((EntityLocal)e).getConfig(this);
  try {
    return convertConfigToSensor(v,e);
  }
 catch (  Throwable t) {
    throw new IllegalArgumentException("String_Node_Str" + v + "String_Node_Str"+ this+ "String_Node_Str"+ t,t);
  }
}
Program: 79619
Project: 79619
Buggy source:
/** 
 * @deprecated since 0.6; use {@link #onException(Function) }
 */
public This onError(Function<? super Exception,T> val){
  return onException(val);
}

Fixed version (ground truth):
/** 
 * @deprecated since 0.6; use {@link #onException(Function)} 
 */
public This onError(Function<? super Exception,T> val){
  return onException(val);
}
Program: 79621
Project: 79621
Buggy source:
/** 
 * Creates a reference to a value, backed by the storage-medium. If a reference with this  name has already been created, then that existing reference will be returned. The returned reference is a live view: changes made to the reference will be persisted,  and changes that others make will be reflected in the reference. The reference is thread-safe. No additional synchronization is required when getting/setting the reference.
 * @param id
 * @return
 */
<T>Reference<T> getReference(String id);

Fixed version (ground truth):
/** 
 * Creates a reference to a value, backed by the storage-medium. If a reference with this  name has already been created, then that existing reference will be returned. The returned reference is a live view: changes made to the reference will be persisted,  and changes that others make will be reflected in the reference. The reference is thread-safe. No additional synchronization is required when getting/setting the reference.
 * @param id
 */
<T>Reference<T> getReference(String id);
Program: 79622
Project: 79622
Buggy source:
/** 
 * Creates a map backed by the storage-medium. If a map with this name has already been created, then that existing map will be returned. The returned map is a live view: changes made to the map will be persisted, and changes  that others make will be reflected in the map. The map is thread-safe:   {@link Map#keySet()} etc will iterate over a snapshot view of thecontents.
 * @param id
 * @return
 */
<K,V>ConcurrentMap<K,V> getMap(String id);

Fixed version (ground truth):
/** 
 * Creates a map backed by the storage-medium. If a map with this name has already been created, then that existing map will be returned. The returned map is a live view: changes made to the map will be persisted, and changes  that others make will be reflected in the map. The map is thread-safe:   {@link Map#keySet()} etc will iterate over a snapshot view of thecontents.
 * @param id
 */
<K,V>ConcurrentMap<K,V> getMap(String id);
Program: 79623
Project: 79623
Buggy source:
/** 
 * records a location and private port against a publicIp and public port, to support   {@link #lookup(Location, int);}superfluous if   {@link #acquirePublicPort(String,Location,int)} was used;but strongly recommended if  {@link #acquirePublicPort(String,int)} was usede.g. if the location is not known ahead of time)
 */
public synchronized void associate(String publicIpId,int publicPort,Location l,int privatePort){
  PortMapping mapping=getPortMappingWithPublicSide(publicIpId,publicPort);
  log.debug("String_Node_Str" + publicPort + "String_Node_Str"+ publicIpId+ "String_Node_Str"+ privatePort+ "String_Node_Str"+ l+ "String_Node_Str"+ mapping+ "String_Node_Str");
  if (mapping == null)   throw new IllegalStateException("String_Node_Str" + publicIpId + "String_Node_Str"+ publicPort);
  PortMapping mapping2=new PortMapping(publicIpId,publicPort,l,privatePort);
  mappings.put(makeKey(mapping.publicIpId,mapping.publicPort),mapping2);
}

Fixed version (ground truth):
/** 
 * records a location and private port against a publicIp and public port, to support   {@link #lookup(Location,int)}; superfluous if   {@link #acquirePublicPort(String,Location,int)} was used;but strongly recommended if  {@link #acquirePublicPortExplicit(String,int)} was usede.g. if the location is not known ahead of time)
 */
public synchronized void associate(String publicIpId,int publicPort,Location l,int privatePort){
  PortMapping mapping=getPortMappingWithPublicSide(publicIpId,publicPort);
  log.debug("String_Node_Str" + publicPort + "String_Node_Str"+ publicIpId+ "String_Node_Str"+ privatePort+ "String_Node_Str"+ l+ "String_Node_Str"+ mapping+ "String_Node_Str");
  if (mapping == null)   throw new IllegalStateException("String_Node_Str" + publicIpId + "String_Node_Str"+ publicPort);
  PortMapping mapping2=new PortMapping(publicIpId,publicPort,l,privatePort);
  mappings.put(makeKey(mapping.publicIpId,mapping.publicPort),mapping2);
}
Program: 79624
Project: 79624
Buggy source:
/** 
 * @deprecated since 0.6
 * @see removeChild(Location)
 */
@Deprecated protected boolean removeChildLocation(Location child){
  return removeChild(child);
}

Fixed version (ground truth):
/** 
 * @deprecated since 0.6
 * @see #removeChild(Location)
 */
@Deprecated protected boolean removeChildLocation(Location child){
  return removeChild(child);
}
Program: 79625
Project: 79625
Buggy source:
public AbstractLocation(Map properties){
  inConstruction=true;
  _legacyConstruction=!InternalLocationFactory.FactoryConstructionTracker.isConstructing();
  if (_legacyConstruction) {
    LOG.warn("String_Node_Str" + getClass().getName() + "String_Node_Str");
    configure(properties);
    boolean deferConstructionChecks=(properties.containsKey("String_Node_Str") && TypeCoercions.coerce(properties.get("String_Node_Str"),Boolean.class));
    if (!deferConstructionChecks) {
      FlagUtils.checkRequiredFields(this);
    }
  }
  inConstruction=false;
}

Fixed version (ground truth):
/** 
 * Construct a new instance of an AbstractLocation. The properties map recognizes the following keys: <ul> <li>name - a name for the location <li>parentLocation - the parent   {@link Location}</ul> Other common properties (retrieved via get/findLocationProperty) include: <ul> <li>latitude <li>longitude <li>displayName <li>iso3166 - list of iso3166-2 code strings <li>timeZone <li>abbreviatedName </ul>
 */
public AbstractLocation(Map properties){
  inConstruction=true;
  _legacyConstruction=!InternalLocationFactory.FactoryConstructionTracker.isConstructing();
  if (_legacyConstruction) {
    LOG.warn("String_Node_Str" + getClass().getName() + "String_Node_Str");
    configure(properties);
    boolean deferConstructionChecks=(properties.containsKey("String_Node_Str") && TypeCoercions.coerce(properties.get("String_Node_Str"),Boolean.class));
    if (!deferConstructionChecks) {
      FlagUtils.checkRequiredFields(this);
    }
  }
  inConstruction=false;
}
Program: 79626
Project: 79626
Buggy source:
/** 
 * @deprecated since 0.6
 * @see addChild(Location)
 */
@Deprecated public void addChildLocation(Location child){
  addChild(child);
}

Fixed version (ground truth):
/** 
 * @deprecated since 0.6
 * @see #addChild(Location)
 */
@Deprecated public void addChildLocation(Location child){
  addChild(child);
}
Program: 79627
Project: 79627
Buggy source:
/** 
 * @See {@link #setBaseClassPathForScanning(Iterable)} 
 */
public Iterable<URL> getBaseClassPathForScanning(){
  return baseClassPathForScanning;
}

Fixed version (ground truth):
/** 
 * @see #setBaseClassPathForScanning(Iterable)
 */
public Iterable<URL> getBaseClassPathForScanning(){
  return baseClassPathForScanning;
}
Program: 79628
Project: 79628
Buggy source:
/** 
 * Whether the entity's management lifecycle is complete (i.e. both "onManagementStarting" and "onManagementStarted" have been called, and it is has not been unmanaged). 
 * @return
 */
public boolean isFullyManaged(){
  return (nonDeploymentManagementContext == null) && currentlyDeployed.get();
}

Fixed version (ground truth):
/** 
 * Whether the entity's management lifecycle is complete (i.e. both "onManagementStarting" and "onManagementStarted" have been called, and it is has not been unmanaged). 
 */
public boolean isFullyManaged(){
  return (nonDeploymentManagementContext == null) && currentlyDeployed.get();
}
Program: 79629
Project: 79629
Buggy source:
/** 
 * @see SubscriptionContext#subscribeToMembers(Entity,Sensor,SensorEventListener) 
 */
public <T>SubscriptionHandle subscribeToMembers(Group parent,Sensor<T> sensor,SensorEventListener<? super T> listener){
  SubscriptionHandle handle=context.subscribeToMembers(parent,sensor,listener);
synchronized (subscriptions) {
    subscriptions.put(parent,handle);
  }
  return handle;
}

Fixed version (ground truth):
/** 
 * @see SubscriptionContext#subscribeToMembers(Group,Sensor,SensorEventListener)
 */
public <T>SubscriptionHandle subscribeToMembers(Group parent,Sensor<T> sensor,SensorEventListener<? super T> listener){
  SubscriptionHandle handle=context.subscribeToMembers(parent,sensor,listener);
synchronized (subscriptions) {
    subscriptions.put(parent,handle);
  }
  return handle;
}
Program: 79630
Project: 79630
Buggy source:
@Test public void testGenerateGroupIdInVcloud(){
  ConfigBag cfg=new ConfigBag().configure(JcloudsLocationConfig.CLOUD_PROVIDER,"String_Node_Str").configure(JcloudsLocationConfig.CALLER_CONTEXT,"String_Node_Str");
  String result=new CloudMachineNamer(cfg).generateNewGroupId();
  log.info("String_Node_Str" + result);
  Assert.assertTrue(result.length() <= 15);
  String user=Strings.maxlen(System.getProperty("String_Node_Str"),2);
  Assert.assertTrue(result.indexOf(user) >= 0);
  Assert.assertTrue(result.indexOf("String_Node_Str") >= 0);
}

Fixed version (ground truth):
@Test public void testGenerateGroupIdInVcloud(){
  ConfigBag cfg=new ConfigBag().configure(JcloudsLocationConfig.CLOUD_PROVIDER,"String_Node_Str").configure(JcloudsLocationConfig.CALLER_CONTEXT,"String_Node_Str");
  String result=new CloudMachineNamer(cfg).generateNewGroupId();
  log.info("String_Node_Str" + result);
  Assert.assertTrue(result.length() <= 15);
  String user=Strings.maxlen(System.getProperty("String_Node_Str"),2).toLowerCase();
  Assert.assertTrue(result.indexOf(user) >= 0);
  Assert.assertTrue(result.indexOf("String_Node_Str") >= 0);
}
Program: 79631
Project: 79631
Buggy source:
@Test public void testGenerateGroupIdWithEntity(){
  TestApplication app=ApplicationBuilder.newManagedApp(EntitySpecs.spec(TestApplication.class).displayName("String_Node_Str"));
  TestEntity child=app.createAndManageChild(EntitySpecs.spec(TestEntity.class).displayName("String_Node_Str"));
  try {
    ConfigBag cfg=new ConfigBag().configure(JcloudsLocationConfig.CALLER_CONTEXT,child);
    String result=new CloudMachineNamer(cfg).generateNewGroupId();
    log.info("String_Node_Str" + result);
    Assert.assertTrue(result.length() <= 60);
    String user=Strings.maxlen(System.getProperty("String_Node_Str"),4);
    Assert.assertTrue(result.indexOf(user) >= 0);
    Assert.assertTrue(result.indexOf("String_Node_Str") >= 0);
    Assert.assertTrue(result.indexOf("String_Node_Str") >= 0);
    Assert.assertTrue(result.indexOf("String_Node_Str" + Strings.maxlen(app.getId(),4).toLowerCase()) >= 0);
    Assert.assertTrue(result.indexOf("String_Node_Str" + Strings.maxlen(child.getId(),4).toLowerCase()) >= 0);
  }
  finally {
    app.stop();
  }
}

Fixed version (ground truth):
@Test public void testGenerateGroupIdWithEntity(){
  TestApplication app=ApplicationBuilder.newManagedApp(EntitySpecs.spec(TestApplication.class).displayName("String_Node_Str"));
  TestEntity child=app.createAndManageChild(EntitySpecs.spec(TestEntity.class).displayName("String_Node_Str"));
  try {
    ConfigBag cfg=new ConfigBag().configure(JcloudsLocationConfig.CALLER_CONTEXT,child);
    String result=new CloudMachineNamer(cfg).generateNewGroupId();
    log.info("String_Node_Str" + result);
    Assert.assertTrue(result.length() <= 60);
    String user=Strings.maxlen(System.getProperty("String_Node_Str"),4).toLowerCase();
    Assert.assertTrue(result.indexOf(user) >= 0);
    Assert.assertTrue(result.indexOf("String_Node_Str") >= 0);
    Assert.assertTrue(result.indexOf("String_Node_Str") >= 0);
    Assert.assertTrue(result.indexOf("String_Node_Str" + Strings.maxlen(app.getId(),4).toLowerCase()) >= 0);
    Assert.assertTrue(result.indexOf("String_Node_Str" + Strings.maxlen(child.getId(),4).toLowerCase()) >= 0);
  }
  finally {
    app.stop();
  }
}
Program: 79633
Project: 79633
Buggy source:
private String getValueForDisplay(EntityLocal entity,Object value){
  if (value instanceof Future) {
    if (((Future)value).isDone()) {
      try {
        value=((Future)value).get();
      }
 catch (      Exception e) {
        value="String_Node_Str" + value + "String_Node_Str"+ e+ "String_Node_Str";
      }
    }
  }
  return (value != null) ? value.toString() : null;
}

Fixed version (ground truth):
private String getValueForDisplay(EntityLocal entity,Object value){
  return brooklyn().getStringValueForDisplay(value);
}
Program: 79634
Project: 79634
Buggy source:
@Override public Map<String,Object> batchConfigRead(String application,String entityToken,String policyToken){
  Policy policy=brooklyn().getPolicy(application,entityToken,policyToken);
  Map<ConfigKey<?>,Object> source=policy.getAllConfig();
  Map<String,Object> result=Maps.newLinkedHashMap();
  for (  Map.Entry<ConfigKey<?>,Object> ek : source.entrySet()) {
    result.put(ek.getKey().getName(),getValueForDisplay(policy,ek.getValue()));
  }
  return result;
}

Fixed version (ground truth):
@Override public Map<String,Object> batchConfigRead(String application,String entityToken,String policyToken){
  Policy policy=brooklyn().getPolicy(application,entityToken,policyToken);
  Map<ConfigKey<?>,Object> source=policy.getAllConfig();
  Map<String,Object> result=Maps.newLinkedHashMap();
  for (  Map.Entry<ConfigKey<?>,Object> ek : source.entrySet()) {
    result.put(ek.getKey().getName(),getStringValueForDisplay(brooklyn(),policy,ek.getValue()));
  }
  return result;
}
Program: 79635
Project: 79635
Buggy source:
@Override public Response set(String application,String entityToken,String policyToken,String configKeyName,String value){
  Policy policy=brooklyn().getPolicy(application,entityToken,policyToken);
  ConfigKey<?> ck=policy.getPolicyType().getConfigKey(configKeyName);
  if (ck == null)   throw WebResourceUtils.notFound("String_Node_Str",configKeyName,policy,entityToken);
  policy.setConfig((ConfigKey)ck,TypeCoercions.coerce(value,ck.getType()));
  return Response.status(Response.Status.OK).build();
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public Response set(String application,String entityToken,String policyToken,String configKeyName,String value){
  Policy policy=brooklyn().getPolicy(application,entityToken,policyToken);
  ConfigKey<?> ck=policy.getPolicyType().getConfigKey(configKeyName);
  if (ck == null)   throw WebResourceUtils.notFound("String_Node_Str",configKeyName,policy,entityToken);
  policy.setConfig((ConfigKey)ck,TypeCoercions.coerce(value,ck.getType()));
  return Response.status(Response.Status.OK).build();
}
Program: 79636
Project: 79636
Buggy source:
@Override public String get(String application,String entityToken,String policyToken,String configKeyName){
  Policy policy=brooklyn().getPolicy(application,entityToken,policyToken);
  ConfigKey<?> ck=policy.getPolicyType().getConfigKey(configKeyName);
  if (ck == null)   throw WebResourceUtils.notFound("String_Node_Str",configKeyName,policy,entityToken);
  return getValueForDisplay(policy,policy.getConfig(ck));
}

Fixed version (ground truth):
@Override public String get(String application,String entityToken,String policyToken,String configKeyName){
  Policy policy=brooklyn().getPolicy(application,entityToken,policyToken);
  ConfigKey<?> ck=policy.getPolicyType().getConfigKey(configKeyName);
  if (ck == null)   throw WebResourceUtils.notFound("String_Node_Str",configKeyName,policy,entityToken);
  return getStringValueForDisplay(brooklyn(),policy,policy.getConfig(ck));
}
Program: 79637
Project: 79637
Buggy source:
@Override public List<PolicyConfigSummary> list(final String application,final String entityToken,final String policyToken){
  EntityLocal entity=brooklyn().getEntity(application,entityToken);
  Policy policy=brooklyn().getPolicy(entity,policyToken);
  List<PolicyConfigSummary> result=Lists.newArrayList();
  for (  ConfigKey<?> key : policy.getPolicyType().getConfigKeys()) {
    result.add(PolicyTransformer.policyConfigSummary(entity,policy,key));
  }
  return result;
}

Fixed version (ground truth):
@Override public List<PolicyConfigSummary> list(final String application,final String entityToken,final String policyToken){
  EntityLocal entity=brooklyn().getEntity(application,entityToken);
  Policy policy=brooklyn().getPolicy(entity,policyToken);
  List<PolicyConfigSummary> result=Lists.newArrayList();
  for (  ConfigKey<?> key : policy.getPolicyType().getConfigKeys()) {
    result.add(PolicyTransformer.policyConfigSummary(brooklyn(),entity,policy,key));
  }
  return result;
}
Program: 79638
Project: 79638
Buggy source:
public static PolicyConfigSummary policyConfigSummary(EntityLocal entity,Policy policy,ConfigKey<?> config){
  String applicationUri="String_Node_Str" + entity.getApplicationId();
  String entityUri=applicationUri + "String_Node_Str" + entity.getId();
  String policyUri=entityUri + "String_Node_Str" + policy.getId();
  Map<String,URI> links=ImmutableMap.<String,URI>builder().put("String_Node_Str",URI.create(policyUri + "String_Node_Str" + config.getName())).put("String_Node_Str",URI.create(applicationUri)).put("String_Node_Str",URI.create(entityUri)).put("String_Node_Str",URI.create(policyUri)).build();
  return new PolicyConfigSummary(config.getName(),config.getTypeName(),config.getDescription(),config.getDefaultValue(),false,links);
}

Fixed version (ground truth):
public static PolicyConfigSummary policyConfigSummary(BrooklynRestResourceUtils utils,EntityLocal entity,Policy policy,ConfigKey<?> config){
  String applicationUri="String_Node_Str" + entity.getApplicationId();
  String entityUri=applicationUri + "String_Node_Str" + entity.getId();
  String policyUri=entityUri + "String_Node_Str" + policy.getId();
  Map<String,URI> links=ImmutableMap.<String,URI>builder().put("String_Node_Str",URI.create(policyUri + "String_Node_Str" + config.getName())).put("String_Node_Str",URI.create(applicationUri)).put("String_Node_Str",URI.create(entityUri)).put("String_Node_Str",URI.create(policyUri)).build();
  return new PolicyConfigSummary(config.getName(),config.getTypeName(),config.getDescription(),PolicyConfigResource.getStringValueForDisplay(utils,policy,config.getDefaultValue()),config.isReconfigurable(),links);
}
Program: 79639
Project: 79639
Buggy source:
public void added(Entity member){
synchronized (mutex) {
    Optional<Location> location=Iterables.tryFind(member.getLocations(),Predicates.instanceOf(SshMachineLocation.class));
    if (location.isPresent() && Strings.isNonBlank(member.getAttribute(Attributes.ADDRESS))) {
      SshMachineLocation machine=(SshMachineLocation)location.get();
      if (!entityLocations.containsKey(machine)) {
        entityLocations.put(machine,member);
        update(machine);
      }
    }
 else {
      LOG.warn("String_Node_Str",member);
    }
  }
}

Fixed version (ground truth):
public void added(Entity member){
synchronized (mutex) {
    Optional<Location> location=Iterables.tryFind(member.getLocations(),Predicates.instanceOf(SshMachineLocation.class));
    if (location.isPresent() && Strings.isNonBlank(member.getAttribute(getConfig(HOSTNAME_SENSOR)))) {
      SshMachineLocation machine=(SshMachineLocation)location.get();
      if (!entityLocations.containsKey(machine)) {
        entityLocations.put(machine,member);
        update(machine);
      }
    }
 else {
      LOG.warn("String_Node_Str",member);
    }
  }
}
Program: 79640
Project: 79640
Buggy source:
@Override public void onManagementStarted(){
  Map<?,?> flags=MutableMap.builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str",ImmutableSet.of(Attributes.ADDRESS)).build();
  policy=new AbstractMembershipTrackingPolicy(flags){
    @Override protected void onEntityChange(    Entity member){
      added(member);
    }
    @Override protected void onEntityAdded(    Entity member){
    }
    @Override protected void onEntityRemoved(    Entity member){
      removed(member);
    }
  }
;
  addPolicy(policy);
  policy.setGroup(entities);
  for (  Entity each : entities.getMembers()) {
    added(each);
  }
}

Fixed version (ground truth):
@Override public void onManagementStarted(){
  Map<?,?> flags=MutableMap.builder().put("String_Node_Str","String_Node_Str").put("String_Node_Str",ImmutableSet.of(getConfig(HOSTNAME_SENSOR))).build();
  policy=new AbstractMembershipTrackingPolicy(flags){
    @Override protected void onEntityChange(    Entity member){
      added(member);
    }
    @Override protected void onEntityAdded(    Entity member){
    }
    @Override protected void onEntityRemoved(    Entity member){
      removed(member);
    }
  }
;
  addPolicy(policy);
  policy.setGroup(entities);
  for (  Entity each : entities.getMembers()) {
    added(each);
  }
}
Program: 79641
Project: 79641
Buggy source:
public void update(SshMachineLocation machine){
synchronized (mutex) {
    String[] templateList=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
    for (    String fileName : templateList) {
      String contents=((BindDnsServerSshDriver)getDriver()).processTemplate("String_Node_Str" + fileName);
      machine.copyTo(new ByteArrayInputStream(contents.getBytes()),"String_Node_Str" + fileName);
    }
    machine.execCommands("String_Node_Str",ImmutableList.of(CommonCommands.sudo("String_Node_Str")));
  }
}

Fixed version (ground truth):
public void update(SshMachineLocation machine){
synchronized (mutex) {
    String[] templateList=new String[]{"String_Node_Str","String_Node_Str"};
    for (    String fileName : templateList) {
      String contents=((BindDnsServerSshDriver)getDriver()).processTemplate("String_Node_Str" + fileName);
      machine.copyTo(new ByteArrayInputStream(contents.getBytes()),"String_Node_Str" + fileName);
      machine.execScript("String_Node_Str",ImmutableList.of(CommonCommands.sudo("String_Node_Str" + fileName + "String_Node_Str"+ fileName)));
    }
    machine.execCommands("String_Node_Str",ImmutableList.of(CommonCommands.sudo("String_Node_Str")));
  }
}
Program: 79642
Project: 79642
Buggy source:
@Override public void stop(){
  newScript(MutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),STOPPING).body.append(CommonCommands.sudo("String_Node_Str")).execute();
}

Fixed version (ground truth):
@Override public void stop(){
  newScript(MutableMap.of("String_Node_Str",false),STOPPING).body.append(CommonCommands.sudo("String_Node_Str")).execute();
}
Program: 79643
Project: 79643
Buggy source:
@Override public void install(){
  List<String> commands=ImmutableList.of(CommonCommands.installPackage(MutableMap.of("String_Node_Str","String_Node_Str"),"String_Node_Str"));
  newScript(MutableMap.of("String_Node_Str","String_Node_Str"),INSTALLING).failOnNonZeroResultCode().body.append(commands).execute();
}

Fixed version (ground truth):
@Override public void install(){
  List<String> commands=ImmutableList.of(CommonCommands.installPackage(MutableMap.of("String_Node_Str","String_Node_Str"),"String_Node_Str"));
  newScript(INSTALLING).failOnNonZeroResultCode().body.append(commands).execute();
}
Program: 79644
Project: 79644
Buggy source:
@Override public boolean isRunning(){
  return newScript(MutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),CHECK_RUNNING).body.append(CommonCommands.sudo("String_Node_Str")).execute() == 0;
}

Fixed version (ground truth):
@Override public boolean isRunning(){
  return newScript(MutableMap.of("String_Node_Str",false),CHECK_RUNNING).body.append(CommonCommands.sudo("String_Node_Str")).execute() == 0;
}
Program: 79645
Project: 79645
Buggy source:
@Override public void launch(){
  newScript(MutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),LAUNCHING).body.append(CommonCommands.sudo("String_Node_Str")).execute();
}

Fixed version (ground truth):
@Override public void launch(){
  newScript(MutableMap.of("String_Node_Str",false),LAUNCHING).body.append(CommonCommands.sudo("String_Node_Str")).execute();
}
Program: 79646
Project: 79646
Buggy source:
@Override public void customize(){
  Map<String,Object> ports=new HashMap<String,Object>();
  ports.put("String_Node_Str",entity.getAttribute(BindDnsServer.DNS_PORT));
  NetworkUtils.checkPortsValid(ports);
  newScript(MutableMap.of("String_Node_Str","String_Node_Str"),CUSTOMIZING).body.append(CommonCommands.sudo("String_Node_Str"),CommonCommands.sudo("String_Node_Str"),CommonCommands.sudo("String_Node_Str")).execute();
}

Fixed version (ground truth):
@Override public void customize(){
  Integer dnsPort=getEntity().getDnsPort();
  Map<String,Object> ports=MutableMap.<String,Object>of("String_Node_Str",dnsPort);
  NetworkUtils.checkPortsValid(ports);
  newScript(CUSTOMIZING).body.append(CommonCommands.sudo("String_Node_Str" + dnsPort + "String_Node_Str"),CommonCommands.sudo("String_Node_Str" + dnsPort + "String_Node_Str"),CommonCommands.sudo("String_Node_Str")).execute();
}
Program: 79647
Project: 79647
Buggy source:
public void run(){
  try {
    if (timeout > 0) {
      Thread.sleep(timeout);
      if (!ended.get()) {
        log.debug("String_Node_Str" + context + "String_Node_Str"+ Strings.join(cmd,"String_Node_Str"));
        proc.destroy();
        killed.set(true);
      }
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public void run(){
  if (timeout <= 0)   return;
  try {
    Thread.sleep(timeout);
    if (!ended.get()) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + context + "String_Node_Str"+ Strings.join(cmd,"String_Node_Str"));
      }
      proc.destroy();
      killed.set(true);
    }
  }
 catch (  Exception e) {
  }
}
Program: 79649
Project: 79649
Buggy source:
/** 
 * returns the items with exactly one "/" between items (whether or not the individual items start or end with /), except where character before the / is a : (url syntax) in which case it will permit multiple (will not remove any) 
 */
public static String mergePaths(String... items){
  StringBuilder result=new StringBuilder();
  for (  String item : items) {
    boolean trimThisMerge=result.length() > 0 && !result.toString().endsWith("String_Node_Str") && !result.toString().endsWith("String_Node_Str") && !result.toString().endsWith("String_Node_Str");
    if (trimThisMerge) {
      while (result.charAt(result.length() - 1) == '/')       result.deleteCharAt(result.length() - 1);
      result.append('/');
    }
    int i=result.length();
    result.append(item);
    if (trimThisMerge) {
      while (result.charAt(i) == '/')       result.deleteCharAt(i);
    }
  }
  return result.toString();
}

Fixed version (ground truth):
/** 
 * returns the items with exactly one "/" between items (whether or not the individual items start or end with /), except where character before the / is a : (url syntax) in which case it will permit multiple (will not remove any) 
 */
public static String mergePaths(String... items){
  StringBuilder result=new StringBuilder();
  for (  String item : items) {
    boolean trimThisMerge=result.length() > 0 && !result.toString().endsWith("String_Node_Str") && !result.toString().endsWith("String_Node_Str") && !result.toString().endsWith("String_Node_Str");
    if (trimThisMerge) {
      while (result.charAt(result.length() - 1) == '/')       result.deleteCharAt(result.length() - 1);
      result.append('/');
    }
    int i=result.length();
    result.append(item);
    if (trimThisMerge) {
      while (result.length() > i && result.charAt(i) == '/')       result.deleteCharAt(i);
    }
  }
  return result.toString();
}
Program: 79650
Project: 79650
Buggy source:
protected void waitForApplicationToBeRunning(URI applicationRef) throws InterruptedException, TimeoutException {
  int count=0;
  while (getApplicationStatus(applicationRef) != ApplicationSummary.Status.RUNNING) {
    if (getApplicationStatus(applicationRef) == ApplicationSummary.Status.ERROR)     throw new RuntimeException("String_Node_Str");
    Thread.sleep(100);
    count+=1;
    if (count >= 100) {
      throw new TimeoutException("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
protected void waitForApplicationToBeRunning(final URI applicationRef){
  boolean started=Repeater.create("String_Node_Str").until(new Callable<Boolean>(){
    @Override public Boolean call() throws Exception {
      ApplicationSummary.Status status=getApplicationStatus(applicationRef);
      if (status == ApplicationSummary.Status.ERROR) {
        fail("String_Node_Str");
      }
      return status == ApplicationSummary.Status.RUNNING;
    }
  }
).every(10,TimeUnit.SECONDS).limitTimeTo(3,TimeUnit.MINUTES).run();
  assertTrue(started);
}