nus-yam/ex-repair huggingface dataset:
Program: 79357
Project: 79357
Buggy source:
/** 
 * Clean up the execution context before finishing using it
 */
public void close(){
  scriptContext.terminate();
}

Fixed version (ground truth):
/** 
 * Clean up the execution context before finishing using it
 */
public void close(){
  scriptContext.exit();
}
Program: 79358
Project: 79358
Buggy source:
/** 
 * Handles query creation and initialization with report-item related expressions 
 * @param item report item
 */
private void prepareVisit(ReportItemDesign item){
  tempQuery=null;
  tempQuery=createQuery(item);
  if (tempQuery != null) {
    pushQuery(tempQuery);
    pushExpressions(tempQuery.getRowExpressions());
  }
  handleReportItemExpressions(item);
}

Fixed version (ground truth):
/** 
 * Handles query creation and initialization with report-item related expressions 
 * @param item report item
 */
private void prepareVisit(ReportItemDesign item){
  tempQuery=null;
  if (item instanceof ListingDesign)   tempQuery=createQuery((ListingDesign)item);
 else   tempQuery=createQuery(item);
  if (tempQuery != null) {
    pushQuery(tempQuery);
    pushExpressions(tempQuery.getRowExpressions());
  }
  handleReportItemExpressions(item);
}
Program: 79359
Project: 79359
Buggy source:
public void visitTableItem(TableItemDesign table){
  BaseQueryDefn query=prepareVisit(table);
  for (int i=0; i < table.getColumnCount(); i++) {
    ColumnDesign column=table.getColumn(i);
    handleStyle(column.getStyle());
  }
  handleTableBand(table.getHeader());
  popExpressions();
  SlotHandle groupsSlot=((TableHandle)table.getHandle()).getGroups();
  for (int i=0; i < table.getGroupCount(); i++) {
    handleTableGroup(table.getGroup(i),(GroupHandle)groupsSlot.get(i));
  }
  if (table.getDetail().getRowCount() != 0) {
    query.setUsesDetails(true);
  }
  pushExpressions(query.getRowExpressions());
  handleTableBand(table.getDetail());
  popExpressions();
  pushExpressions(query.getAfterExpressions());
  handleTableBand(table.getFooter());
  finishVisit(query);
}

Fixed version (ground truth):
public void visitTableItem(TableItemDesign table){
  BaseQueryDefn query=prepareVisit(table);
  for (int i=0; i < table.getColumnCount(); i++) {
    ColumnDesign column=table.getColumn(i);
    handleStyle(column.getStyle());
  }
  pushExpressions(query.getBeforeExpressions());
  handleTableBand(table.getHeader());
  popExpressions();
  SlotHandle groupsSlot=((TableHandle)table.getHandle()).getGroups();
  for (int i=0; i < table.getGroupCount(); i++) {
    handleTableGroup(table.getGroup(i),(GroupHandle)groupsSlot.get(i));
  }
  if (table.getDetail().getRowCount() != 0) {
    query.setUsesDetails(true);
  }
  pushExpressions(query.getRowExpressions());
  handleTableBand(table.getDetail());
  popExpressions();
  pushExpressions(query.getAfterExpressions());
  handleTableBand(table.getFooter());
  finishVisit(query);
}
Program: 79360
Project: 79360
Buggy source:
public DataException(String errorCode,Throwable cause){
  super(cause);
  this.errorCode=errorCode;
}

Fixed version (ground truth):
public DataException(String errorCode,Throwable cause,Object argv[]){
  super(cause);
  this.errorCode=errorCode;
  this.argv=argv;
}
Program: 79361
Project: 79361
Buggy source:
/** 
 * Constructor of KeyHandler
 * @param viewer
 * @param actionRegistry
 */
public ReportViewerKeyHandler(GraphicalViewer viewer,ActionRegistry actionRegistry){
  super(viewer);
  this.actionRegistry=actionRegistry;
  put((char)3,'c',SWT.CTRL,ActionFactory.COPY.getId());
  put((char)22,'v',SWT.CTRL,ActionFactory.PASTE.getId());
  put(SWT.DEL,SWT.DEL,NO_MASK,ActionFactory.DELETE.getId());
  tableDelgate=new TableCellKeyDelegate(viewer);
}

Fixed version (ground truth):
/** 
 * Constructor of KeyHandler
 * @param viewer
 * @param actionRegistry
 */
public ReportViewerKeyHandler(GraphicalViewer viewer,ActionRegistry actionRegistry){
  super(viewer);
  this.actionRegistry=actionRegistry;
  put(SWT.DEL,SWT.DEL,NO_MASK,ActionFactory.DELETE.getId());
  tableDelgate=new TableCellKeyDelegate(viewer);
}
Program: 79362
Project: 79362
Buggy source:
protected IAction createActionHandler(ISelection model){
  Object target=null;
  if (model instanceof IStructuredSelection) {
    target=((IStructuredSelection)model).getFirstElement();
  }
  return new PasteAction(target);
}

Fixed version (ground truth):
protected IAction createActionHandler(ISelection model){
  Object target=null;
  if (model instanceof IStructuredSelection) {
    target=((IStructuredSelection)model).getFirstElement();
  }
  PasteAction action=new PasteAction(target);
  setEnabled(action.isEnabled());
  return action;
}
Program: 79363
Project: 79363
Buggy source:
/** 
 * Get GUI infromation of row.  For CSS table support auto layout, the GUI infor is different with model info.
 * @param row
 * @return
 */
public TableHandleAdapter.RowUIInfomation getRowInfo(Object row){
  if (checkDirty()) {
    reload();
  }
  return (TableHandleAdapter.RowUIInfomation)rowInfo.get(row);
}

Fixed version (ground truth):
/** 
 * Get GUI infromation of row. For CSS table support auto layout, the GUI infor is different with model info.
 * @param row
 * @return
 */
public TableHandleAdapter.RowUIInfomation getRowInfo(Object row){
  if (checkDirty()) {
    reload();
  }
  return (TableHandleAdapter.RowUIInfomation)rowInfo.get(row);
}
Program: 79364
Project: 79364
Buggy source:
/** 
 * Provides insert group function.
 * @return
 * @throws ContentException
 * @throws NameException
 */
public TableGroupHandle insertGroup() throws ContentException, NameException {
  transStar(TRANS_LABEL_INSERT_GROUP);
  RowHandle header=getTableHandle().getElementFactory().newTableRow();
  RowHandle footer=getTableHandle().getElementFactory().newTableRow();
  addCell(header);
  addCell(footer);
  TableGroupHandle groupHandle=getTableHandle().getElementFactory().newTableGroup();
  groupHandle.getSlot(TableGroup.HEADER_SLOT).add(header);
  groupHandle.getSlot(TableGroup.FOOTER_SLOT).add(footer);
  SlotHandle handle=getTableHandle().getGroups();
  handle.add(groupHandle);
  transEnd();
  return groupHandle;
}

Fixed version (ground truth):
/** 
 * Provides insert group function.
 * @return
 * @throws ContentException
 * @throws NameException
 */
public TableGroupHandle insertGroup() throws ContentException, NameException {
  if (DEUtil.getDataSetList(getTableHandle()).isEmpty()) {
    return null;
  }
  transStar(TRANS_LABEL_INSERT_GROUP);
  RowHandle header=getTableHandle().getElementFactory().newTableRow();
  RowHandle footer=getTableHandle().getElementFactory().newTableRow();
  addCell(header);
  addCell(footer);
  TableGroupHandle groupHandle=getTableHandle().getElementFactory().newTableGroup();
  groupHandle.getSlot(TableGroup.HEADER_SLOT).add(header);
  groupHandle.getSlot(TableGroup.FOOTER_SLOT).add(footer);
  SlotHandle handle=getTableHandle().getGroups();
  handle.add(groupHandle);
  transEnd();
  return groupHandle;
}
Program: 79365
Project: 79365
Buggy source:
protected void createEditPolicies(){
}

Fixed version (ground truth):
protected void createEditPolicies(){
  installEditPolicy(EditPolicy.LAYOUT_ROLE,new MasterPageEditPolicy());
}
Program: 79366
Project: 79366
Buggy source:
@Override public Object getEntity(){
  if (error != null)   Exceptions.propagate(error);
  return super.getEntity();
}

Fixed version (ground truth):
@Override public Object getEntity(){
  if (error != null) {
    throw new IllegalStateException("String_Node_Str",error);
  }
  return super.getEntity();
}
Program: 79368
Project: 79368
Buggy source:
private synchronized void buildApiClasses(Application app){
  if (apiClasses == null) {
    apiClasses=new HashSet<>();
    if (app != null) {
      Set<Class<?>> classes=app.getClasses();
      if (classes != null) {
        addAnnotatedClasses(apiClasses,classes);
      }
      Set<Object> singletons=app.getSingletons();
      if (singletons != null) {
        for (        Object o : singletons) {
          addAnnotatedClasses(apiClasses,(MutableSet<Class<?>>)MutableSet.of(o.getClass()));
        }
      }
    }
  }
}

Fixed version (ground truth):
private synchronized void buildApiClasses(Application app){
  if (apiClasses == null) {
    apiClasses=new HashSet<>();
    if (app != null) {
      Set<Class<?>> classes=app.getClasses();
      if (classes != null) {
        final Class<?>[] template={};
        addAnnotatedClasses(apiClasses,classes.toArray(template));
      }
      Set<Object> singletons=app.getSingletons();
      if (singletons != null) {
        for (        Object o : singletons) {
          Class<?>[] types={o.getClass()};
          addAnnotatedClasses(apiClasses,types);
        }
      }
    }
  }
}
Program: 79369
Project: 79369
Buggy source:
private void addAnnotatedClasses(Set<Class<?>> output,Set<Class<?>> classes){
  for (  Class<?> clz : classes) {
    if (clz.getAnnotation(Api.class) != null) {
      output.add(clz);
    }
    addAnnotatedClasses(output,Sets.newHashSet(clz.getInterfaces()));
  }
}

Fixed version (ground truth):
private void addAnnotatedClasses(Set<Class<?>> output,Class<?>[] classes){
  for (  Class<?> clz : classes) {
    if (clz.getAnnotation(Api.class) != null) {
      output.add(clz);
    }
    addAnnotatedClasses(output,clz.getInterfaces());
  }
}
Program: 79370
Project: 79370
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override protected void initEnrichers(){
  super.initEnrichers();
  propagateMasterAttribute(MySqlNode.HOSTNAME);
  propagateMasterAttribute(MySqlNode.ADDRESS);
  propagateMasterAttribute(MySqlNode.SUBNET_HOSTNAME);
  propagateMasterAttribute(MySqlNode.SUBNET_ADDRESS);
  propagateMasterAttribute(MySqlNode.MYSQL_PORT);
  propagateMasterAttribute(MySqlNode.DATASTORE_URL);
  enrichers().add(Enrichers.builder().aggregating(MySqlNode.DATASTORE_URL).publishing(SLAVE_DATASTORE_URL_LIST).computing((Function)Functions.identity()).entityFilter(Predicates.not(MySqlClusterUtils.IS_MASTER)).fromMembers().build());
  enrichers().add(Enrichers.builder().aggregating(MySqlNode.QUERIES_PER_SECOND_FROM_MYSQL).publishing(QUERIES_PER_SECOND_FROM_MYSQL_PER_NODE).fromMembers().computingAverage().defaultValueForUnreportedSensors(0d).build());
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override protected void initEnrichers(){
  super.initEnrichers();
  propagateMasterAttribute(MySqlNode.HOSTNAME);
  propagateMasterAttribute(MySqlNode.ADDRESS);
  propagateMasterAttribute(MySqlNode.SUBNET_HOSTNAME);
  propagateMasterAttribute(MySqlNode.SUBNET_ADDRESS);
  propagateMasterAttribute(MySqlNode.MYSQL_PORT);
  propagateMasterAttribute(MySqlNode.DATASTORE_URL);
  enrichers().add(Enrichers.builder().aggregating(MySqlNode.DATASTORE_URL).publishing(SLAVE_DATASTORE_URL_LIST).computing((Function<Collection<String>,List<String>>)(Function)Functions.identity()).entityFilter(Predicates.not(MySqlClusterUtils.IS_MASTER)).fromMembers().build());
  enrichers().add(Enrichers.builder().aggregating(MySqlNode.QUERIES_PER_SECOND_FROM_MYSQL).publishing(QUERIES_PER_SECOND_FROM_MYSQL_PER_NODE).fromMembers().computingAverage().defaultValueForUnreportedSensors(0d).build());
}
Program: 79372
Project: 79372
Buggy source:
/** 
 * @return the ports required for a specific child entity 
 */
protected Collection<Integer> getRequiredOpenPorts(Entity entity){
  Set<Integer> ports=MutableSet.of(22);
  for (  ConfigKey<?> k : entity.getEntityType().getConfigKeys()) {
    if (PortRange.class.isAssignableFrom(k.getType())) {
      PortRange p=(PortRange)entity.getConfig(k);
      if (p != null && !p.isEmpty())       ports.add(p.iterator().next());
    }
  }
  LOG.debug("String_Node_Str",ports,entity);
  for (  Entity child : entity.getChildren()) {
    ports.addAll(getRequiredOpenPorts(child));
  }
  return ports;
}

Fixed version (ground truth):
/** 
 * @return the ports required for a specific child entity 
 */
protected Collection<Integer> getRequiredOpenPorts(Entity entity){
  Set<Integer> ports=MutableSet.of(22);
  for (  ConfigKey<?> k : entity.getEntityType().getConfigKeys()) {
    Object value;
    if (PortRange.class.isAssignableFrom(k.getType()) || k.getName().matches("String_Node_Str")) {
      value=entity.config().get(k);
    }
 else {
      Maybe<Object> maybeValue=((AbstractEntity.BasicConfigurationSupport)entity.config()).getRaw(k);
      value=maybeValue.isPresent() ? maybeValue.get() : null;
    }
    Maybe<PortRange> maybePortRange=TypeCoercions.tryCoerce(value,new TypeToken<PortRange>(){
    }
);
    if (maybePortRange.isPresentAndNonNull()) {
      PortRange p=maybePortRange.get();
      if (p != null && !p.isEmpty())       ports.add(p.iterator().next());
    }
  }
  LOG.debug("String_Node_Str",ports,entity);
  for (  Entity child : entity.getChildren()) {
    ports.addAll(getRequiredOpenPorts(child));
  }
  return ports;
}
Program: 79373
Project: 79373
Buggy source:
/** 
 * returns the ports that this entity wants to use; default implementation returns   {@link SoftwareProcess#REQUIRED_OPEN_LOGIN_PORTS} plus first value for each  {@link PortAttributeSensorAndConfigKey} config key {@link PortRange}plus any ports defined with a config keys ending in   {@code .port}.
 */
protected Collection<Integer> getRequiredOpenPorts(){
  Set<Integer> ports=MutableSet.copyOf(getConfig(REQUIRED_OPEN_LOGIN_PORTS));
  Map<ConfigKey<?>,?> allConfig=config().getBag().getAllConfigAsConfigKeyMap();
  Set<ConfigKey<?>> configKeys=Sets.newHashSet(allConfig.keySet());
  configKeys.addAll(getEntityType().getConfigKeys());
  for (  ConfigKey<?> k : configKeys) {
    if (PortRange.class.isAssignableFrom(k.getType())) {
      PortRange p=(PortRange)getConfig(k);
      if (p != null && !p.isEmpty())       ports.add(p.iterator().next());
    }
 else     if (k.getName().matches("String_Node_Str")) {
      Object value=getConfig(k);
      if (value instanceof Integer) {
        ports.add((Integer)value);
      }
    }
  }
  log.debug("String_Node_Str",ports,this);
  return ports;
}

Fixed version (ground truth):
/** 
 * returns the ports that this entity wants to use; default implementation returns   {@link SoftwareProcess#REQUIRED_OPEN_LOGIN_PORTS} plus first value for each  {@link PortAttributeSensorAndConfigKey} config key {@link PortRange}plus any ports defined with a config keys ending in   {@code .port}.
 */
protected Collection<Integer> getRequiredOpenPorts(){
  Set<Integer> ports=MutableSet.copyOf(getConfig(REQUIRED_OPEN_LOGIN_PORTS));
  Map<ConfigKey<?>,?> allConfig=config().getBag().getAllConfigAsConfigKeyMap();
  Set<ConfigKey<?>> configKeys=Sets.newHashSet(allConfig.keySet());
  configKeys.addAll(getEntityType().getConfigKeys());
  for (  ConfigKey<?> k : configKeys) {
    Object value;
    if (PortRange.class.isAssignableFrom(k.getType()) || k.getName().matches("String_Node_Str")) {
      value=config().get(k);
    }
 else {
      Maybe<Object> maybeValue=config().getRaw(k);
      value=maybeValue.isPresent() ? maybeValue.get() : null;
    }
    Maybe<PortRange> maybePortRange=TypeCoercions.tryCoerce(value,new TypeToken<PortRange>(){
    }
);
    if (maybePortRange.isPresentAndNonNull()) {
      PortRange p=maybePortRange.get();
      if (p != null && !p.isEmpty())       ports.add(p.iterator().next());
    }
  }
  log.debug("String_Node_Str",ports,this);
  return ports;
}
Program: 79376
Project: 79376
Buggy source:
@Override public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  try {
    Object result1=method.invoke(result0,args);
    if (result1 instanceof Response) {
      String responseClass=method.getAnnotation(ApiOperation.class).responseClass();
      Class<?> type=Class.forName(responseClass);
      result1=BuiltResponsePreservingError.copyResponseAndClose((Response)result1,type);
    }
    return result1;
  }
 catch (  Throwable e) {
    if (e instanceof InvocationTargetException) {
      e=((InvocationTargetException)e).getTargetException();
    }
    throw Exceptions.propagate(e);
  }
}

Fixed version (ground truth):
@Override public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  try {
    Object result1=method.invoke(result0,args);
    Class<?> type=String.class;
    if (result1 instanceof Response) {
      if (((Response)result1).getStatus() / 100 == 2) {
        String responseClass=method.getAnnotation(ApiOperation.class).responseClass();
        type=Class.forName(responseClass);
      }
      result1=BuiltResponsePreservingError.copyResponseAndClose((Response)result1,type);
    }
    return result1;
  }
 catch (  Throwable e) {
    if (e instanceof InvocationTargetException) {
      e=((InvocationTargetException)e).getTargetException();
    }
    throw Exceptions.propagate(e);
  }
}
Program: 79377
Project: 79377
Buggy source:
@SuppressWarnings("String_Node_Str") private <T>T proxy(Class<T> clazz){
  final T result0=ProxyFactory.create(clazz,target,clientExecutor);
  return (T)Proxy.newProxyInstance(clazz.getClassLoader(),new Class<?>[]{clazz},new InvocationHandler(){
    @Override public Object invoke(    Object proxy,    Method method,    Object[] args) throws Throwable {
      try {
        Object result1=method.invoke(result0,args);
        if (result1 instanceof Response) {
          String responseClass=method.getAnnotation(ApiOperation.class).responseClass();
          Class<?> type=Class.forName(responseClass);
          result1=BuiltResponsePreservingError.copyResponseAndClose((Response)result1,type);
        }
        return result1;
      }
 catch (      Throwable e) {
        if (e instanceof InvocationTargetException) {
          e=((InvocationTargetException)e).getTargetException();
        }
        throw Exceptions.propagate(e);
      }
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private <T>T proxy(Class<T> clazz){
  final T result0=ProxyFactory.create(clazz,target,clientExecutor);
  return (T)Proxy.newProxyInstance(clazz.getClassLoader(),new Class<?>[]{clazz},new InvocationHandler(){
    @Override public Object invoke(    Object proxy,    Method method,    Object[] args) throws Throwable {
      try {
        Object result1=method.invoke(result0,args);
        Class<?> type=String.class;
        if (result1 instanceof Response) {
          if (((Response)result1).getStatus() / 100 == 2) {
            String responseClass=method.getAnnotation(ApiOperation.class).responseClass();
            type=Class.forName(responseClass);
          }
          result1=BuiltResponsePreservingError.copyResponseAndClose((Response)result1,type);
        }
        return result1;
      }
 catch (      Throwable e) {
        if (e instanceof InvocationTargetException) {
          e=((InvocationTargetException)e).getTargetException();
        }
        throw Exceptions.propagate(e);
      }
    }
  }
);
}
Program: 79378
Project: 79378
Buggy source:
public static boolean isReachable(HostAndPort endpoint){
  try {
    Socket s=new Socket(endpoint.getHostText(),endpoint.getPort());
    try {
      s.close();
    }
 catch (    Exception e) {
      log.debug("String_Node_Str" + endpoint + "String_Node_Str",e);
    }
    return true;
  }
 catch (  Exception e) {
    if (log.isTraceEnabled())     log.trace("String_Node_Str" + endpoint + "String_Node_Str",e);
    return false;
  }
}

Fixed version (ground truth):
public static boolean isReachable(HostAndPort endpoint){
  try {
    Socket s=new Socket(endpoint.getHostText(),endpoint.getPort());
    closeQuietly(s);
    return true;
  }
 catch (  Exception e) {
    if (log.isTraceEnabled())     log.trace("String_Node_Str" + endpoint + "String_Node_Str",e);
    return false;
  }
}
Program: 79380
Project: 79380
Buggy source:
@Test(groups="String_Node_Str") public void testIsPortAvailableReportsTrueWhenPortIsFree() throws Exception {
  int port=58769;
  int numFree=0;
  for (int i=0; i < 10; i++) {
    if (Networking.isPortAvailable(port))     numFree++;
  }
  if (numFree <= 5)   fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testIsPortAvailableReportsTrueWhenPortIsFree() throws Exception {
  int port=58769;
  int numFree=0;
  for (int i=0; i < 10; i++) {
    if (Networking.isPortAvailable(port))     numFree++;
  }
  if (numFree <= 5)   fail("String_Node_Str");
}
Program: 79381
Project: 79381
Buggy source:
@Test(groups="String_Node_Str") public void testIsPortAvailableReportsFalseWhenPortIsInUse() throws Exception {
  int port=58767;
  ServerSocket ss=null;
  do {
    port++;
    if (Networking.isPortAvailable(port)) {
      try {
        ss=new ServerSocket(port);
        log.info("String_Node_Str" + port + "String_Node_Str"+ JavaClassNames.niceClassAndMethod());
        assertFalse(Networking.isPortAvailable(port),"String_Node_Str");
      }
  finally {
        if (ss != null) {
          ss.close();
        }
      }
    }
  }
 while (ss == null && port < 60000);
  Assert.assertNotNull(ss,"String_Node_Str");
  final int portF=port;
  Asserts.succeedsEventually(new Runnable(){
    @Override public void run(){
      assertTrue(Networking.isPortAvailable(portF),"String_Node_Str" + portF + "String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
@Test public void testIsPortAvailableReportsFalseWhenPortIsInUse() throws Exception {
  int port=58767;
  ServerSocket ss=null;
  do {
    port++;
    if (Networking.isPortAvailable(port)) {
      try {
        ss=new ServerSocket(port);
        log.info("String_Node_Str" + port + "String_Node_Str"+ JavaClassNames.niceClassAndMethod());
        assertFalse(Networking.isPortAvailable(port),"String_Node_Str");
      }
  finally {
        if (ss != null) {
          ss.close();
        }
      }
    }
  }
 while (ss == null && port < 60000);
  Assert.assertNotNull(ss,"String_Node_Str");
  final int portF=port;
  Asserts.succeedsEventually(new Runnable(){
    @Override public void run(){
      assertTrue(Networking.isPortAvailable(portF),"String_Node_Str" + portF + "String_Node_Str");
    }
  }
);
}
Program: 79382
Project: 79382
Buggy source:
@Test(groups="String_Node_Str") public void testIsPortAvailableReportsPromptly() throws Exception {
  int port=58767;
  boolean available=false;
  do {
    port++;
    Stopwatch watch=Stopwatch.createStarted();
    if (Networking.isPortAvailable(null,port)) {
      available=true;
    }
    long elapsedMillis=watch.elapsed(TimeUnit.MILLISECONDS);
    assertTrue(elapsedMillis < 5000,"String_Node_Str" + elapsedMillis + "String_Node_Str"+ port+ "String_Node_Str");
  }
 while (!available && port < 60000);
  Assert.assertTrue(available);
}

Fixed version (ground truth):
@Test public void testIsPortAvailableReportsPromptly() throws Exception {
  int port=58767;
  boolean available=false;
  do {
    port++;
    Stopwatch watch=Stopwatch.createStarted();
    if (Networking.isPortAvailable(null,port)) {
      available=true;
    }
    long elapsedMillis=watch.elapsed(TimeUnit.MILLISECONDS);
    assertTrue(elapsedMillis < 5000,"String_Node_Str" + elapsedMillis + "String_Node_Str"+ port+ "String_Node_Str");
  }
 while (!available && port < 60000);
  Assert.assertTrue(available);
}
Program: 79384
Project: 79384
Buggy source:
@Effector(description="String_Node_Str") public void leaveCluster(@EffectorParam(name="String_Node_Str") String nodeName);

Fixed version (ground truth):
@Effector(description="String_Node_Str") public void leaveCluster();
Program: 79385
Project: 79385
Buggy source:
public void leaveCluster(String nodeName);

Fixed version (ground truth):
public void leaveCluster();
Program: 79386
Project: 79386
Buggy source:
@Override public void leaveCluster(String nodeName){
  getDriver().leaveCluster(nodeName);
}

Fixed version (ground truth):
@Override public void leaveCluster(){
  getDriver().leaveCluster();
}
Program: 79387
Project: 79387
Buggy source:
@Override public void leaveCluster(String nodeName){
  if (hasJoinedCluster()) {
    ScriptHelper leaveClusterScript=newScript("String_Node_Str").body.append(sudo(format("String_Node_Str",getRiakAdminCmd(),nodeName))).body.append(sudo(format("String_Node_Str",getRiakAdminCmd()))).body.append(sudo(format("String_Node_Str",getRiakAdminCmd()))).failOnNonZeroResultCode();
    if (!isRiakOnPath()) {
      Map<String,String> newPathVariable=ImmutableMap.of("String_Node_Str",sbinPath);
      log.warn("String_Node_Str",getShellEnvironment(),newPathVariable);
      leaveClusterScript.environmentVariablesReset(newPathVariable);
    }
    leaveClusterScript.execute();
    entity.setAttribute(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER,Boolean.FALSE);
  }
 else {
    log.warn("String_Node_Str",entity.getId());
  }
}

Fixed version (ground truth):
@Override public void leaveCluster(){
  if (hasJoinedCluster()) {
    ScriptHelper leaveClusterScript=newScript("String_Node_Str").body.append(sudo(format("String_Node_Str",getRiakAdminCmd()))).body.append(sudo(format("String_Node_Str",getRiakAdminCmd()))).body.append(sudo(format("String_Node_Str",getRiakAdminCmd()))).failOnNonZeroResultCode();
    if (!isRiakOnPath()) {
      Map<String,String> newPathVariable=ImmutableMap.of("String_Node_Str",sbinPath);
      log.warn("String_Node_Str",getShellEnvironment(),newPathVariable);
      leaveClusterScript.environmentVariablesReset(newPathVariable);
    }
    leaveClusterScript.execute();
    entity.setAttribute(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER,Boolean.FALSE);
  }
 else {
    log.warn("String_Node_Str",entity.getId());
  }
}
Program: 79388
Project: 79388
Buggy source:
@Override public void stop(){
  leaveCluster("String_Node_Str");
  String command=format("String_Node_Str",getRiakCmd());
  command=isPackageInstall() ? sudo(command) : command;
  ScriptHelper stopScript=newScript(ImmutableMap.of(USE_PID_FILE,false),STOPPING).body.append(command);
  if (!isRiakOnPath()) {
    Map<String,String> newPathVariable=ImmutableMap.of("String_Node_Str",sbinPath);
    log.warn("String_Node_Str",getShellEnvironment(),newPathVariable);
    stopScript.environmentVariablesReset(newPathVariable);
  }
  int result=stopScript.failOnNonZeroResultCode().execute();
  if (result != 0) {
    newScript(ImmutableMap.of(USE_PID_FILE,false),STOPPING).execute();
  }
}

Fixed version (ground truth):
@Override public void stop(){
  leaveCluster();
  String command=format("String_Node_Str",getRiakCmd());
  command=isPackageInstall() ? sudo(command) : command;
  ScriptHelper stopScript=newScript(ImmutableMap.of(USE_PID_FILE,false),STOPPING).body.append(command);
  if (!isRiakOnPath()) {
    Map<String,String> newPathVariable=ImmutableMap.of("String_Node_Str",sbinPath);
    log.warn("String_Node_Str",getShellEnvironment(),newPathVariable);
    stopScript.environmentVariablesReset(newPathVariable);
  }
  int result=stopScript.failOnNonZeroResultCode().execute();
  if (result != 0) {
    newScript(ImmutableMap.of(USE_PID_FILE,false),STOPPING).execute();
  }
}
Program: 79389
Project: 79389
Buggy source:
@Override protected Collection<Integer> getRequiredOpenPorts(){
  int erlangRangeStart=getConfig(ERLANG_PORT_RANGE_START).iterator().next();
  int erlangRangeEnd=getConfig(ERLANG_PORT_RANGE_END).iterator().next();
  Set<Integer> newPorts=MutableSet.<Integer>copyOf(super.getRequiredOpenPorts());
  newPorts.remove(erlangRangeStart);
  newPorts.remove(erlangRangeEnd);
  for (int i=erlangRangeStart; i <= erlangRangeEnd; i++)   newPorts.add(i);
  return newPorts;
}

Fixed version (ground truth):
@Override protected Collection<Integer> getRequiredOpenPorts(){
  int erlangRangeStart=getConfig(ERLANG_PORT_RANGE_START).iterator().next();
  int erlangRangeEnd=getConfig(ERLANG_PORT_RANGE_END).iterator().next();
  Set<Integer> ports=MutableSet.copyOf(super.getRequiredOpenPorts());
  Set<Integer> erlangPorts=ContiguousSet.create(Range.open(erlangRangeStart,erlangRangeEnd),DiscreteDomain.integers());
  ports.addAll(erlangPorts);
  return ports;
}
Program: 79391
Project: 79391
Buggy source:
private List<String> installFromPackageCloud(){
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  return ImmutableList.<String>builder().add(osDetails.getName().toLowerCase().contains("String_Node_Str") ? addSbinPathCommand() : "String_Node_Str").add(ifNotExecutable("String_Node_Str",Joiner.on('\n').join(installCurl()))).addAll(ifExecutableElse("String_Node_Str",installDebianBased(),installRpmBased())).build();
}

Fixed version (ground truth):
private List<String> installFromPackageCloud(){
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  return ImmutableList.<String>builder().add(osDetails.getName().toLowerCase().contains("String_Node_Str") ? addSbinPathCommand() : "String_Node_Str").add(ifNotExecutable("String_Node_Str",INSTALL_CURL)).addAll(ifExecutableElse("String_Node_Str",installDebianBased(),installRpmBased())).build();
}
Program: 79392
Project: 79392
Buggy source:
protected List<String> installMac(){
  String saveAs=resolver.getFilename();
  String url=entity.getAttribute(RiakNode.DOWNLOAD_URL_MAC).toString();
  return ImmutableList.<String>builder().add(INSTALL_TAR).add(INSTALL_CURL).add(commandToDownloadUrlAs(url,saveAs)).add("String_Node_Str" + saveAs).build();
}

Fixed version (ground truth):
protected List<String> installMac(){
  String saveAs=resolver.getFilename();
  String url=entity.getAttribute(RiakNode.DOWNLOAD_URL_MAC);
  return ImmutableList.<String>builder().add(INSTALL_TAR).add(INSTALL_CURL).add(commandToDownloadUrlAs(url,saveAs)).add("String_Node_Str" + saveAs).build();
}
Program: 79393
Project: 79393
Buggy source:
@Override public void preInstall(){
  resolver=Entities.newDownloader(this);
  setExpandedInstallDir(Os.mergePaths(getInstallDir(),resolver.getUnpackedDirectoryName(format("String_Node_Str",getVersion()))));
}

Fixed version (ground truth):
@Override public void preInstall(){
  resolver=Entities.newDownloader(this);
  setExpandedInstallDir(Os.mergePaths(getInstallDir(),resolver.getUnpackedDirectoryName(format("String_Node_Str",getVersion()))));
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  if (osDetails.isLinux()) {
    entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL,true);
  }
 else   if (osDetails.isMac()) {
    entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL,false);
  }
}
Program: 79395
Project: 79395
Buggy source:
@Override public void install(){
  if (entity.getConfig(Attributes.DOWNLOAD_URL) != null) {
    LOG.warn("String_Node_Str",entity.getConfig(Attributes.DOWNLOAD_URL));
  }
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  List<String> commands=Lists.newLinkedList();
  if (osDetails.isLinux()) {
    if (getEntity().isPackageDownloadUrlProvided()) {
      commands.addAll(installLinuxFromPackageUrl(getExpandedInstallDir()));
    }
 else {
      commands.addAll(installFromPackageCloud());
    }
    entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL,true);
  }
 else   if (osDetails.isMac()) {
    entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL,false);
    commands.addAll(installMac());
  }
 else   if (osDetails.isWindows()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
 else {
    throw new IllegalStateException("String_Node_Str" + getMachine() + "String_Node_Str"+ getMachine().getMachineDetails().getOsDetails());
  }
  try {
    newScript(INSTALLING).body.append(commands).failIfBodyEmpty().failOnNonZeroResultCode().inessential().execute();
  }
 catch (  RuntimeException e) {
    if (osDetails.isLinux()) {
      newScript(INSTALLING_FALLBACK).body.append(installLinuxFromPackageUrl(getExpandedInstallDir())).failIfBodyEmpty().failOnNonZeroResultCode().execute();
    }
  }
  checkRiakOnPath();
}

Fixed version (ground truth):
@Override public void install(){
  if (entity.getConfig(Attributes.DOWNLOAD_URL) != null) {
    LOG.warn("String_Node_Str",entity.getConfig(Attributes.DOWNLOAD_URL));
  }
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  List<String> commands=Lists.newLinkedList();
  if (osDetails.isLinux()) {
    if (getEntity().isPackageDownloadUrlProvided()) {
      commands.addAll(installLinuxFromPackageUrl());
    }
 else {
      commands.addAll(installFromPackageCloud());
    }
  }
 else   if (osDetails.isMac()) {
    commands.addAll(installMac());
  }
 else   if (osDetails.isWindows()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
 else {
    throw new IllegalStateException("String_Node_Str" + getMachine() + "String_Node_Str"+ getMachine().getMachineDetails().getOsDetails());
  }
  int result=newScript(INSTALLING).body.append(commands).failIfBodyEmpty().execute();
  if (result != 0 && osDetails.isLinux()) {
    result=newScript(INSTALLING_FALLBACK).body.append(installLinuxFromPackageUrl()).execute();
  }
  if (result != 0) {
    throw new IllegalStateException(String.format("String_Node_Str",result));
  }
}
Program: 79396
Project: 79396
Buggy source:
@Override protected Collection<Integer> getRequiredOpenPorts(){
  int erlangRangeStart=getConfig(ERLANG_PORT_RANGE_START).iterator().next();
  int erlangRangeEnd=getConfig(ERLANG_PORT_RANGE_END).iterator().next();
  Set<Integer> newPorts=MutableSet.<Integer>copyOf(super.getRequiredOpenPorts());
  newPorts.remove(erlangRangeStart);
  newPorts.remove(erlangRangeEnd);
  for (int i=erlangRangeStart; i <= erlangRangeEnd; i++)   newPorts.add(i);
  return newPorts;
}

Fixed version (ground truth):
@Override protected Collection<Integer> getRequiredOpenPorts(){
  int erlangRangeStart=getConfig(ERLANG_PORT_RANGE_START).iterator().next();
  int erlangRangeEnd=getConfig(ERLANG_PORT_RANGE_END).iterator().next();
  Set<Integer> ports=MutableSet.copyOf(super.getRequiredOpenPorts());
  Set<Integer> erlangPorts=ContiguousSet.create(Range.open(erlangRangeStart,erlangRangeEnd),DiscreteDomain.integers());
  ports.addAll(erlangPorts);
  return ports;
}
Program: 79398
Project: 79398
Buggy source:
private List<String> installFromPackageCloud(){
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  return ImmutableList.<String>builder().add(osDetails.getName().toLowerCase().contains("String_Node_Str") ? addSbinPathCommand() : "String_Node_Str").add(ifNotExecutable("String_Node_Str",Joiner.on('\n').join(installCurl()))).addAll(ifExecutableElse("String_Node_Str",installDebianBased(),installRpmBased())).build();
}

Fixed version (ground truth):
private List<String> installFromPackageCloud(){
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  return ImmutableList.<String>builder().add(osDetails.getName().toLowerCase().contains("String_Node_Str") ? addSbinPathCommand() : "String_Node_Str").add(ifNotExecutable("String_Node_Str",INSTALL_CURL)).addAll(ifExecutableElse("String_Node_Str",installDebianBased(),installRpmBased())).build();
}
Program: 79399
Project: 79399
Buggy source:
protected List<String> installMac(){
  String saveAs=resolver.getFilename();
  String url=entity.getAttribute(RiakNode.DOWNLOAD_URL_MAC).toString();
  return ImmutableList.<String>builder().add(INSTALL_TAR).add(INSTALL_CURL).add(commandToDownloadUrlAs(url,saveAs)).add("String_Node_Str" + saveAs).build();
}

Fixed version (ground truth):
protected List<String> installMac(){
  String saveAs=resolver.getFilename();
  String url=entity.getAttribute(RiakNode.DOWNLOAD_URL_MAC);
  return ImmutableList.<String>builder().add(INSTALL_TAR).add(INSTALL_CURL).add(commandToDownloadUrlAs(url,saveAs)).add("String_Node_Str" + saveAs).build();
}
Program: 79400
Project: 79400
Buggy source:
@Override public void preInstall(){
  resolver=Entities.newDownloader(this);
  setExpandedInstallDir(Os.mergePaths(getInstallDir(),resolver.getUnpackedDirectoryName(format("String_Node_Str",getVersion()))));
}

Fixed version (ground truth):
@Override public void preInstall(){
  resolver=Entities.newDownloader(this);
  setExpandedInstallDir(Os.mergePaths(getInstallDir(),resolver.getUnpackedDirectoryName(format("String_Node_Str",getVersion()))));
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  if (osDetails.isLinux()) {
    entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL,true);
  }
 else   if (osDetails.isMac()) {
    entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL,false);
  }
}
Program: 79402
Project: 79402
Buggy source:
@Override public void install(){
  if (entity.getConfig(Attributes.DOWNLOAD_URL) != null) {
    LOG.warn("String_Node_Str",entity.getConfig(Attributes.DOWNLOAD_URL));
  }
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  List<String> commands=Lists.newLinkedList();
  if (osDetails.isLinux()) {
    if (getEntity().isPackageDownloadUrlProvided()) {
      commands.addAll(installLinuxFromPackageUrl(getExpandedInstallDir()));
    }
 else {
      commands.addAll(installFromPackageCloud());
    }
    entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL,true);
  }
 else   if (osDetails.isMac()) {
    entity.setAttribute(RiakNode.RIAK_PACKAGE_INSTALL,false);
    commands.addAll(installMac());
  }
 else   if (osDetails.isWindows()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
 else {
    throw new IllegalStateException("String_Node_Str" + getMachine() + "String_Node_Str"+ getMachine().getMachineDetails().getOsDetails());
  }
  try {
    newScript(INSTALLING).body.append(commands).failIfBodyEmpty().failOnNonZeroResultCode().inessential().execute();
  }
 catch (  RuntimeException e) {
    if (osDetails.isLinux()) {
      newScript(INSTALLING_FALLBACK).body.append(installLinuxFromPackageUrl(getExpandedInstallDir())).failIfBodyEmpty().failOnNonZeroResultCode().execute();
    }
  }
  checkRiakOnPath();
}

Fixed version (ground truth):
@Override public void install(){
  if (entity.getConfig(Attributes.DOWNLOAD_URL) != null) {
    LOG.warn("String_Node_Str",entity.getConfig(Attributes.DOWNLOAD_URL));
  }
  OsDetails osDetails=getMachine().getMachineDetails().getOsDetails();
  List<String> commands=Lists.newLinkedList();
  if (osDetails.isLinux()) {
    if (getEntity().isPackageDownloadUrlProvided()) {
      commands.addAll(installLinuxFromPackageUrl());
    }
 else {
      commands.addAll(installFromPackageCloud());
    }
  }
 else   if (osDetails.isMac()) {
    commands.addAll(installMac());
  }
 else   if (osDetails.isWindows()) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
 else {
    throw new IllegalStateException("String_Node_Str" + getMachine() + "String_Node_Str"+ getMachine().getMachineDetails().getOsDetails());
  }
  int result=newScript(INSTALLING).body.append(commands).failIfBodyEmpty().execute();
  if (result != 0 && osDetails.isLinux()) {
    result=newScript(INSTALLING_FALLBACK).body.append(installLinuxFromPackageUrl()).execute();
  }
  if (result != 0) {
    throw new IllegalStateException(String.format("String_Node_Str",result));
  }
}
Program: 79403
Project: 79403
Buggy source:
public static CatalogItemMemento newCatalogItemMemento(CatalogItem<?,?> catalogItem){
  BasicCatalogItemMemento.Builder builder=BasicCatalogItemMemento.builder();
  populateBrooklynObjectMementoBuilder(catalogItem,builder);
  builder.catalogItemJavaType(catalogItem.getCatalogItemJavaType()).catalogItemType(catalogItem.getCatalogItemType()).description(catalogItem.getDescription()).iconUrl(catalogItem.getIconUrl()).javaType(catalogItem.getJavaType()).libraries(catalogItem.getLibraries()).symbolicName(catalogItem.getSymbolicName()).specType(catalogItem.getSpecType()).version(catalogItem.getVersion()).planYaml(catalogItem.getPlanYaml()).deprecated(catalogItem.isDeprecated());
  return builder.build();
}

Fixed version (ground truth):
public static CatalogItemMemento newCatalogItemMemento(CatalogItem<?,?> catalogItem){
  if (catalogItem instanceof CatalogItemDo<?,?>) {
    catalogItem=((CatalogItemDo<?,?>)catalogItem).getDto();
  }
  BasicCatalogItemMemento.Builder builder=BasicCatalogItemMemento.builder();
  populateBrooklynObjectMementoBuilder(catalogItem,builder);
  builder.catalogItemJavaType(catalogItem.getCatalogItemJavaType()).catalogItemType(catalogItem.getCatalogItemType()).description(catalogItem.getDescription()).iconUrl(catalogItem.getIconUrl()).javaType(catalogItem.getJavaType()).libraries(catalogItem.getLibraries()).symbolicName(catalogItem.getSymbolicName()).specType(catalogItem.getSpecType()).version(catalogItem.getVersion()).planYaml(catalogItem.getPlanYaml()).deprecated(catalogItem.isDeprecated());
  return builder.build();
}
Program: 79404
Project: 79404
Buggy source:
private Map<String,Object> augmentPropertiesWithSshConfigGivenToProps(Map<String,?> props){
  Map<String,Object> augmentedProps=Maps.newHashMap(props);
  for (  ConfigKey<?> config : SSH_CONFIG_GIVEN_TO_PROPS) {
    if (!props.containsKey(config.getName()))     augmentedProps.put(config.getName(),getConfig(config));
  }
  return augmentedProps;
}

Fixed version (ground truth):
private Map<String,Object> augmentPropertiesWithSshConfigGivenToProps(Map<String,?> props){
  Map<String,Object> augmentedProps=Maps.newHashMap(props);
  for (  ConfigKey<?> config : SSH_CONFIG_GIVEN_TO_PROPS) {
    if (!augmentedProps.containsKey(config.getName()) && hasConfig(config,true))     augmentedProps.put(config.getName(),getConfig(config));
  }
  return augmentedProps;
}
Program: 79406
Project: 79406
Buggy source:
private Map<String,Object> augmentPropertiesWithSshConfigGivenToProps(Map<String,?> props){
  Map<String,Object> augmentedProps=Maps.newHashMap(props);
  for (  ConfigKey<?> config : SSH_CONFIG_GIVEN_TO_PROPS) {
    if (!props.containsKey(config.getName()))     augmentedProps.put(config.getName(),getConfig(config));
  }
  return augmentedProps;
}

Fixed version (ground truth):
private Map<String,Object> augmentPropertiesWithSshConfigGivenToProps(Map<String,?> props){
  Map<String,Object> augmentedProps=Maps.newHashMap(props);
  for (  ConfigKey<?> config : SSH_CONFIG_GIVEN_TO_PROPS) {
    if (!augmentedProps.containsKey(config.getName()) && hasConfig(config,true))     augmentedProps.put(config.getName(),getConfig(config));
  }
  return augmentedProps;
}
Program: 79410
Project: 79410
Buggy source:
@Override public boolean apply(@Nullable Entity entity){
  return entity instanceof CouchbaseNode && (Boolean.TRUE.equals(entity.getAttribute(entity.IS_IN_CLUSTER)) || Boolean.TRUE.equals(entity.getAttribute(entity.IS_PRIMARY_NODE)));
}

Fixed version (ground truth):
@Override public boolean apply(@Nullable Entity entity){
  return entity instanceof CouchbaseNode && (Boolean.TRUE.equals(entity.getAttribute(CouchbaseNode.IS_IN_CLUSTER)) || Boolean.TRUE.equals(entity.getAttribute(CouchbaseNode.IS_PRIMARY_NODE)));
}
Program: 79412
Project: 79412
Buggy source:
/** 
 * returns the first port available on the local machine >= the port supplied 
 */
public static int nextAvailablePort(int port){
  checkArgument(port >= MIN_PORT_NUMBER && port <= MAX_PORT_NUMBER,"String_Node_Str",port,MIN_PORT_NUMBER,MAX_PORT_NUMBER);
  int originalPort=port;
  while (!isPortAvailable(port) && port <= MAX_PORT_NUMBER)   port++;
  if (port > MAX_PORT_NUMBER)   throw new RuntimeException("String_Node_Str" + originalPort);
  return port;
}

Fixed version (ground truth):
/** 
 * returns the first port available on the local machine >= the port supplied 
 */
public static int nextAvailablePort(int port){
  checkArgument(port >= MIN_PORT_NUMBER && port <= MAX_PORT_NUMBER,"String_Node_Str",port,MIN_PORT_NUMBER,MAX_PORT_NUMBER);
  int originalPort=port;
  while (!isPortAvailable(port) && port < MAX_PORT_NUMBER)   port++;
  if (port >= MAX_PORT_NUMBER)   throw new RuntimeException("String_Node_Str" + originalPort);
  return port;
}
Program: 79413
Project: 79413
Buggy source:
@Test public void testCheckRunningForcesInessential(){
  MyService entity=app.createAndManageChild(EntitySpec.create(MyService.class,MyServiceInessentialDriverImpl.class));
  Assert.assertFalse(entity.getAttribute(Startable.SERVICE_UP));
  entity.start(ImmutableList.of(loc));
  SimulatedInessentialIsRunningDriver driver=(SimulatedInessentialIsRunningDriver)entity.getDriver();
  Assert.assertTrue(driver.isRunning());
  Assert.assertTrue(entity.getAttribute(Startable.SERVICE_UP));
  EntityTestUtils.assertAttributeEqualsEventually(entity,SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,true);
  EntityTestUtils.assertAttributeEqualsEventually(entity,Startable.SERVICE_UP,true);
  log.debug("String_Node_Str");
  driver.setFailExecution(true);
  EntityTestUtils.assertAttributeEqualsEventually(entity,SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,false);
  EntityTestUtils.assertAttributeEqualsEventually(entity,Startable.SERVICE_UP,false);
  log.debug("String_Node_Str");
  driver.setFailExecution(false);
  EntityTestUtils.assertAttributeEqualsEventually(entity,SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,true);
  EntityTestUtils.assertAttributeEqualsEventually(entity,Startable.SERVICE_UP,true);
}

Fixed version (ground truth):
@Test public void testCheckRunningForcesInessential(){
  MyService entity=app.createAndManageChild(EntitySpec.create(MyService.class,MyServiceInessentialDriverImpl.class));
  entity.start(ImmutableList.of(loc));
  SimulatedInessentialIsRunningDriver driver=(SimulatedInessentialIsRunningDriver)entity.getDriver();
  Assert.assertTrue(driver.isRunning());
  EntityTestUtils.assertAttributeEqualsEventually(entity,SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,true);
  EntityTestUtils.assertAttributeEqualsEventually(entity,Startable.SERVICE_UP,true);
  log.debug("String_Node_Str");
  driver.setFailExecution(true);
  EntityTestUtils.assertAttributeEqualsEventually(entity,SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,false);
  log.debug("String_Node_Str");
  driver.setFailExecution(false);
  EntityTestUtils.assertAttributeEqualsEventually(entity,SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,true);
}
Program: 79414
Project: 79414
Buggy source:
@Override protected void disconnectSensors(){
  disconnectServiceUpIsRunning();
  if (serviceStats != null)   serviceStats.stop();
  if (replicaSetStats != null)   replicaSetStats.stop();
}

Fixed version (ground truth):
@Override protected void disconnectSensors(){
  super.disconnectSensors();
  disconnectServiceUpIsRunning();
  if (serviceStats != null)   serviceStats.stop();
  if (replicaSetStats != null)   replicaSetStats.stop();
}
Program: 79415
Project: 79415
Buggy source:
private void calculateClusterAddresses(){
  String addresses="String_Node_Str";
  for (  Entity entity : this.getMembers()) {
    if (entity instanceof RiakNode && entity.getAttribute(Attributes.SERVICE_UP)) {
      RiakNode riakNode=(RiakNode)entity;
      addresses+=riakNode.getAttribute(Attributes.SUBNET_HOSTNAME) + "String_Node_Str" + riakNode.getAttribute(RiakNode.RIAK_WEB_PORT)+ "String_Node_Str";
    }
  }
  if (addresses.length() > 0) {
    setAttribute(RiakCluster.NODE_LIST,addresses.substring(0,addresses.length() - 1));
  }
 else {
    setAttribute(RiakCluster.NODE_LIST,null);
  }
}

Fixed version (ground truth):
private void calculateClusterAddresses(){
  List<String> addresses=Lists.newArrayList();
  for (  Entity entity : this.getMembers()) {
    if (entity instanceof RiakNode && entity.getAttribute(Attributes.SERVICE_UP)) {
      RiakNode riakNode=(RiakNode)entity;
      addresses.add(riakNode.getAttribute(Attributes.SUBNET_HOSTNAME) + "String_Node_Str" + riakNode.getAttribute(RiakNode.RIAK_WEB_PORT));
    }
  }
  setAttribute(RiakCluster.NODE_LIST,Joiner.on("String_Node_Str").join(addresses));
}
Program: 79417
Project: 79417
Buggy source:
@Override public String apply(@javax.annotation.Nullable StorageMetadata input){
  return input.getName();
}

Fixed version (ground truth):
@Override public String apply(@javax.annotation.Nullable StorageMetadata input){
  String result=input.getName();
  result=Strings.removeFromStart(result,containerSubPath);
  result=Strings.removeFromStart(result,"String_Node_Str");
  return result;
}