nus-yam/ex-repair huggingface dataset:
Program: 87480
Project: 87480
Buggy source:
private void loadDevi(){
  setProgressBarIndeterminateVisibility(true);
  tmpDataUpdated=0;
  deviItems=new ArrayList<DeviData>();
  deviProvider=DataProviderFactory.getDeviProvider(new DeviProviderHandler(){
    @Override public void onData(    DeviData deviData){
      if (deviData.lines.size() > 0) {
        realtimeList.addDeviItem(deviData);
        tmpDataUpdated++;
        if (tmpDataUpdated > 5) {
          realtimeList.notifyDataSetChanged();
          tmpDataUpdated=0;
        }
      }
 else {
        deviItems.add(deviData);
      }
    }
    @Override public void onError(    Exception exception){
      Log.w(TAG,"String_Node_Str" + exception);
      Toast.makeText(RealtimeView.this,"String_Node_Str" + getText(R.string.exception) + "String_Node_Str"+ exception,Toast.LENGTH_LONG).show();
      setProgressBarIndeterminateVisibility(false);
    }
    @Override public void onFinished(){
      refreshDevi();
      setProgressBarIndeterminateVisibility(false);
      deviProvider=null;
      if (tmpDataUpdated > 0) {
        realtimeList.notifyDataSetChanged();
      }
    }
  }
);
  deviProvider.Fetch(station.stationId);
}

Fixed version (ground truth):
private void loadDevi(){
  setProgressBarIndeterminateVisibility(true);
  realtimeList.itemsAddedWithoutNotify=0;
  deviItems=new ArrayList<DeviData>();
  deviProvider=DataProviderFactory.getDeviProvider(new DeviProviderHandler(){
    @Override public void onData(    DeviData deviData){
      if (deviData.lines.size() > 0) {
        realtimeList.addDeviItem(deviData);
        realtimeList.itemsAddedWithoutNotify++;
        if (realtimeList.itemsAddedWithoutNotify > 5) {
          realtimeList.itemsAddedWithoutNotify=0;
          realtimeList.notifyDataSetChanged();
        }
      }
 else {
        deviItems.add(deviData);
      }
    }
    @Override public void onError(    Exception exception){
      Log.w(TAG,"String_Node_Str" + exception);
      Toast.makeText(RealtimeView.this,"String_Node_Str" + getText(R.string.exception) + "String_Node_Str"+ exception,Toast.LENGTH_LONG).show();
      setProgressBarIndeterminateVisibility(false);
    }
    @Override public void onFinished(){
      refreshDevi();
      setProgressBarIndeterminateVisibility(false);
      deviProvider=null;
      if (realtimeList.itemsAddedWithoutNotify > 0) {
        realtimeList.itemsAddedWithoutNotify=0;
        realtimeList.notifyDataSetChanged();
      }
    }
  }
);
  deviProvider.Fetch(station.stationId);
}
Program: 87481
Project: 87481
Buggy source:
@Override public void onFinished(){
  refreshDevi();
  setProgressBarIndeterminateVisibility(false);
  deviProvider=null;
  if (tmpDataUpdated > 0) {
    realtimeList.notifyDataSetChanged();
  }
}

Fixed version (ground truth):
@Override public void onFinished(){
  refreshDevi();
  setProgressBarIndeterminateVisibility(false);
  deviProvider=null;
  if (realtimeList.itemsAddedWithoutNotify > 0) {
    realtimeList.itemsAddedWithoutNotify=0;
    realtimeList.notifyDataSetChanged();
  }
}
Program: 87482
Project: 87482
Buggy source:
private void load(){
  lastUpdate=System.currentTimeMillis();
  setProgressBarIndeterminateVisibility(true);
  if (realtimeProvider != null)   realtimeProvider.Stop();
  if (deviProvider != null)   deviProvider.Stop();
  realtimeList.clear();
  realtimeList.notifyDataSetChanged();
  final TextView infoText=(TextView)findViewById(R.id.emptyText);
  tmpDataUpdated=0;
  realtimeProvider=DataProviderFactory.getRealtimeProvider(new RealtimeProviderHandler(){
    @Override public void onData(    RealtimeData realtimeData){
      realtimeList.addItem(realtimeData);
      tmpDataUpdated++;
      if (tmpDataUpdated > 5) {
        realtimeList.notifyDataSetChanged();
        tmpDataUpdated=0;
      }
    }
    @Override public void onError(    Exception exception){
      Log.w(TAG,"String_Node_Str" + exception);
      Toast.makeText(RealtimeView.this,"String_Node_Str" + getText(R.string.exception) + "String_Node_Str"+ exception,Toast.LENGTH_LONG).show();
      setProgressBarIndeterminateVisibility(false);
    }
    @Override public void onFinished(){
      refreshTitle();
      setProgressBarIndeterminateVisibility(false);
      infoText.setVisibility(realtimeList.getCount() > 0 ? View.GONE : View.VISIBLE);
      if (tmpDataUpdated > 0) {
        realtimeList.notifyDataSetChanged();
      }
      realtimeProvider=null;
      loadDevi();
    }
  }
);
  realtimeProvider.Fetch(station.stationId);
}

Fixed version (ground truth):
private void load(){
  lastUpdate=System.currentTimeMillis();
  setProgressBarIndeterminateVisibility(true);
  if (realtimeProvider != null)   realtimeProvider.Stop();
  if (deviProvider != null)   deviProvider.Stop();
  realtimeList.clear();
  realtimeList.notifyDataSetChanged();
  final TextView infoText=(TextView)findViewById(R.id.emptyText);
  realtimeList.itemsAddedWithoutNotify=0;
  realtimeProvider=DataProviderFactory.getRealtimeProvider(new RealtimeProviderHandler(){
    @Override public void onData(    RealtimeData realtimeData){
      realtimeList.addItem(realtimeData);
      realtimeList.itemsAddedWithoutNotify++;
      if (realtimeList.itemsAddedWithoutNotify > 5) {
        realtimeList.itemsAddedWithoutNotify=0;
        realtimeList.notifyDataSetChanged();
      }
    }
    @Override public void onError(    Exception exception){
      Log.w(TAG,"String_Node_Str" + exception);
      Toast.makeText(RealtimeView.this,"String_Node_Str" + getText(R.string.exception) + "String_Node_Str"+ exception,Toast.LENGTH_LONG).show();
      setProgressBarIndeterminateVisibility(false);
    }
    @Override public void onFinished(){
      refreshTitle();
      setProgressBarIndeterminateVisibility(false);
      infoText.setVisibility(realtimeList.getCount() > 0 ? View.GONE : View.VISIBLE);
      if (realtimeList.itemsAddedWithoutNotify > 0) {
        realtimeList.itemsAddedWithoutNotify=0;
        realtimeList.notifyDataSetChanged();
      }
      realtimeProvider=null;
      loadDevi();
    }
  }
);
  realtimeProvider.Fetch(station.stationId);
}
Program: 87483
Project: 87483
Buggy source:
@Override public int getCount(){
  return itemsSize;
}

Fixed version (ground truth):
@Override public int getCount(){
  if (itemsAddedWithoutNotify > 0) {
    notifyDataSetChanged();
    itemsAddedWithoutNotify=0;
  }
  return itemsSize;
}
Program: 87484
Project: 87484
Buggy source:
@Override public void onData(DeviData deviData){
  if (deviData.lines.size() > 0) {
    realtimeList.addDeviItem(deviData);
    tmpDataUpdated++;
    if (tmpDataUpdated > 5) {
      realtimeList.notifyDataSetChanged();
      tmpDataUpdated=0;
    }
  }
 else {
    deviItems.add(deviData);
  }
}

Fixed version (ground truth):
@Override public void onData(DeviData deviData){
  if (deviData.lines.size() > 0) {
    realtimeList.addDeviItem(deviData);
    realtimeList.itemsAddedWithoutNotify++;
    if (realtimeList.itemsAddedWithoutNotify > 5) {
      realtimeList.itemsAddedWithoutNotify=0;
      realtimeList.notifyDataSetChanged();
    }
  }
 else {
    deviItems.add(deviData);
  }
}
Program: 87486
Project: 87486
Buggy source:
public SearchStationData(Parcel in){
  stopName=in.readString();
  extra=in.readString();
  stationId=in.readInt();
  hasAirDistance=in.readInt() != 0;
  airDistance=in.readInt();
  utmCoords[0]=in.readInt();
  utmCoords[1]=in.readInt();
  latLongCoords[0]=in.readDouble();
  latLongCoords[1]=in.readDouble();
}

Fixed version (ground truth):
public SearchStationData(Parcel in){
  stopName=in.readString();
  extra=in.readString();
  stationId=in.readInt();
  hasWalkingDistance=in.readInt() != 0;
  walkingDistance=in.readInt();
  utmCoords[0]=in.readInt();
  utmCoords[1]=in.readInt();
  latLongCoords[0]=in.readDouble();
  latLongCoords[1]=in.readDouble();
}
Program: 87487
Project: 87487
Buggy source:
@Override public void writeToParcel(Parcel out,int flags){
  out.writeString(stopName);
  out.writeString(extra);
  out.writeInt(stationId);
  out.writeInt(hasAirDistance ? 1 : 0);
  out.writeInt(airDistance);
  out.writeInt(utmCoords[0]);
  out.writeInt(utmCoords[1]);
  out.writeDouble(latLongCoords[0]);
  out.writeDouble(latLongCoords[1]);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel out,int flags){
  out.writeString(stopName);
  out.writeString(extra);
  out.writeInt(stationId);
  out.writeInt(hasWalkingDistance ? 1 : 0);
  out.writeInt(walkingDistance);
  out.writeInt(utmCoords[0]);
  out.writeInt(utmCoords[1]);
  out.writeDouble(latLongCoords[0]);
  out.writeDouble(latLongCoords[1]);
}
Program: 87488
Project: 87488
Buggy source:
@Override public View getView(int pos,View convertView,ViewGroup arg2){
  ViewHolder holder;
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.selectstation_list,null);
    holder=new ViewHolder();
    holder.star=(ImageView)convertView.findViewById(R.id.star);
    holder.stopName=(TextView)convertView.findViewById(R.id.stopname);
    holder.address=(TextView)convertView.findViewById(R.id.address);
    holder.range=(TextView)convertView.findViewById(R.id.range);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  final SearchStationData station=items.get(pos);
  holder.stopName.setText(station.stopName);
  if (station.extra != null) {
    holder.address.setText(station.extra);
    holder.address.setVisibility(View.VISIBLE);
  }
 else {
    holder.address.setVisibility(View.INVISIBLE);
  }
  if (station.airDistance > 0) {
    holder.range.setText("String_Node_Str" + station.airDistance + "String_Node_Str");
    holder.range.setVisibility(View.VISIBLE);
  }
 else {
    holder.range.setVisibility(View.INVISIBLE);
  }
  if (station.isFavorite) {
    holder.star.setVisibility(View.VISIBLE);
  }
 else {
    holder.star.setVisibility(View.GONE);
  }
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int pos,View convertView,ViewGroup arg2){
  ViewHolder holder;
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.selectstation_list,null);
    holder=new ViewHolder();
    holder.star=(ImageView)convertView.findViewById(R.id.star);
    holder.stopName=(TextView)convertView.findViewById(R.id.stopname);
    holder.address=(TextView)convertView.findViewById(R.id.address);
    holder.range=(TextView)convertView.findViewById(R.id.range);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  final SearchStationData station=items.get(pos);
  holder.stopName.setText(station.stopName);
  if (station.extra != null) {
    holder.address.setText(station.extra);
    holder.address.setVisibility(View.VISIBLE);
  }
 else {
    holder.address.setVisibility(View.INVISIBLE);
  }
  if (station.hasWalkingDistance) {
    holder.range.setText("String_Node_Str" + station.walkingDistance + "String_Node_Str");
    holder.range.setVisibility(View.VISIBLE);
  }
 else {
    holder.range.setVisibility(View.INVISIBLE);
  }
  if (station.isFavorite) {
    holder.star.setVisibility(View.VISIBLE);
  }
 else {
    holder.star.setVisibility(View.GONE);
  }
  return convertView;
}
Program: 87489
Project: 87489
Buggy source:
public static InputStream soapRequest(final Resources resources,final int rid,final String[] args,final String url) throws IOException {
  final String soap=mergeXmlArgument(resources,rid,args);
  HttpPost httppost=new HttpPost(url);
  httppost.setHeader("String_Node_Str","String_Node_Str");
  httppost.setEntity(new StringEntity(soap));
  Log.d("String_Node_Str","String_Node_Str" + soap);
  HttpResponse response=new DefaultHttpClient().execute(httppost);
  Log.d("String_Node_Str","String_Node_Str");
  return response.getEntity().getContent();
}

Fixed version (ground truth):
public static InputStream soapRequest(final Resources resources,final int rid,final String[] args,final String url) throws IOException {
  final String soap=mergeXmlArgument(resources,rid,args);
  HttpPost httppost=new HttpPost(url);
  httppost.setHeader("String_Node_Str","String_Node_Str");
  httppost.setEntity(new StringEntity(soap));
  Log.d("String_Node_Str","String_Node_Str" + soap);
  HttpResponse response=new DefaultHttpClient().execute(httppost);
  return response.getEntity().getContent();
}
Program: 87490
Project: 87490
Buggy source:
public void updateHistory(SearchStationData station){
  if (hasStation(station.stationId)) {
    final String rowIdSql="String_Node_Str" + KEY_ROWID + "String_Node_Str"+ table+ "String_Node_Str";
    final String sql=String.format("String_Node_Str",table,KEY_USED,KEY_USED,KEY_ROWID,rowIdSql,KEY_STATIONID,station.stationId);
    Log.i("String_Node_Str",sql);
    final Cursor c=db.rawQuery(sql,null);
    c.moveToFirst();
    c.close();
  }
 else {
    add(station);
  }
  db.delete(table,KEY_ROWID + "String_Node_Str" + table+ "String_Node_Str",null);
}

Fixed version (ground truth):
public void updateHistory(SearchStationData station){
  if (hasStation(station.stationId)) {
    final String rowIdSql="String_Node_Str" + KEY_ROWID + "String_Node_Str"+ table+ "String_Node_Str";
    final String sql=String.format("String_Node_Str",table,KEY_USED,KEY_USED,KEY_ROWID,rowIdSql,KEY_STATIONID,station.stationId);
    final Cursor c=db.rawQuery(sql,null);
    c.moveToFirst();
    c.close();
  }
 else {
    add(station);
  }
  db.delete(table,KEY_ROWID + "String_Node_Str" + table+ "String_Node_Str",null);
}
Program: 87491
Project: 87491
Buggy source:
public void addFavoritesToList(List<SearchStationData> items){
  Cursor cursor=db.query(table,COLUMNS,null,null,null,null,KEY_USED + "String_Node_Str");
  while (cursor.moveToNext()) {
    SearchStationData station=new SearchStationData(cursor.getString(0),cursor.getString(1),cursor.getInt(2),new int[]{cursor.getInt(3),cursor.getInt(4)});
    station.isFavorite=true;
    items.add(station);
  }
  cursor.close();
}

Fixed version (ground truth):
public void addFavoritesToList(List<SearchStationData> items){
  Cursor cursor=db.query(table,COLUMNS,null,null,null,null,KEY_USED + "String_Node_Str");
  while (cursor.moveToNext()) {
    SearchStationData station=new SearchStationData(cursor.getString(0),cursor.getString(1),cursor.getInt(2),new int[]{cursor.getInt(4),cursor.getInt(5)});
    station.isFavorite=true;
    items.add(station);
  }
  cursor.close();
}
Program: 87492
Project: 87492
Buggy source:
public void addHistoryToList(ArrayList<SearchStationData> items){
  Cursor cursor=db.query(table,COLUMNS,null,null,null,null,KEY_USED + "String_Node_Str");
  while (cursor.moveToNext()) {
    SearchStationData station=new SearchStationData(cursor.getString(0),cursor.getString(1),cursor.getInt(2),new int[]{cursor.getInt(3),cursor.getInt(4)});
    boolean foundDuplicate=false;
    for (    SearchStationData listStation : items) {
      if (station.stationId == listStation.stationId) {
        foundDuplicate=true;
        break;
      }
    }
    if (!foundDuplicate) {
      items.add(station);
    }
  }
  cursor.close();
}

Fixed version (ground truth):
public void addHistoryToList(ArrayList<SearchStationData> items){
  Cursor cursor=db.query(table,COLUMNS,null,null,null,null,KEY_USED + "String_Node_Str");
  while (cursor.moveToNext()) {
    SearchStationData station=new SearchStationData(cursor.getString(0),cursor.getString(1),cursor.getInt(2),new int[]{cursor.getInt(4),cursor.getInt(5)});
    boolean foundDuplicate=false;
    for (    SearchStationData listStation : items) {
      if (station.stationId == listStation.stationId) {
        foundDuplicate=true;
        break;
      }
    }
    if (!foundDuplicate) {
      items.add(station);
    }
  }
  cursor.close();
}
Program: 87493
Project: 87493
Buggy source:
/** 
 * Returns the query string to count entities.
 * @return string to count entities
 */
protected String getCountQueryString(){
  PersistenceProvider provider=PersistenceProvider.fromEntityManager(getEntityManager());
  String countQuery=String.format(COUNT_QUERY_STRING,provider.getCountQueryPlaceholder(),"String_Node_Str");
  return getQueryString(countQuery,getDomainClass());
}

Fixed version (ground truth):
/** 
 * Returns the query string to count entities.
 * @return string to count entities
 */
@Deprecated protected String getCountQueryString(){
  PersistenceProvider provider=PersistenceProvider.fromEntityManager(getEntityManager());
  String countQuery=String.format(COUNT_QUERY_STRING,provider.getCountQueryPlaceholder(),"String_Node_Str");
  return getQueryString(countQuery,getDomainClass());
}
Program: 87494
Project: 87494
Buggy source:
@Transactional(readOnly=true) public Long count(){
  return getEntityManager().createQuery(getCountQueryString(),Long.class).getSingleResult();
}

Fixed version (ground truth):
private Long count(Specification<T> spec){
  return getCountQuery(spec).getSingleResult();
}
Program: 87495
Project: 87495
Buggy source:
/** 
 * @param query
 * @param pageable
 * @return
 */
private Page<T> readPage(final TypedQuery<T> query,final Pageable pageable){
  query.setFirstResult(pageable.getFirstItem());
  query.setMaxResults(pageable.getPageSize());
  return new PageImpl<T>(query.getResultList(),pageable,count());
}

Fixed version (ground truth):
/** 
 * @param query
 * @param spec
 * @param pageable
 * @return
 */
private Page<T> readPage(final TypedQuery<T> query,final Pageable pageable,final Specification<T> spec){
  query.setFirstResult(pageable.getFirstItem());
  query.setMaxResults(pageable.getPageSize());
  return new PageImpl<T>(query.getResultList(),pageable,count(spec));
}
Program: 87496
Project: 87496
Buggy source:
/** 
 * Creates a WHERE clause for a query of the referenced entity in form of a  {@link Predicate} for the given {@link Root} and {@link CriteriaQuery}.
 * @param root
 * @param query
 * @return a {@link Predicate}, must not be   {@literal null}.
 */
Predicate toPredicate(Root<T> root,CriteriaQuery<T> query,CriteriaBuilder builder);

Fixed version (ground truth):
/** 
 * Creates a WHERE clause for a query of the referenced entity in form of a  {@link Predicate} for the given {@link Root} and {@link CriteriaQuery}.
 * @param root
 * @param query
 * @return a {@link Predicate}, must not be   {@literal null}.
 */
Predicate toPredicate(Root<T> root,CriteriaQuery<?> query,CriteriaBuilder builder);
Program: 87497
Project: 87497
Buggy source:
/** 
 * Negates the given   {@link Specification}.
 * @param < T >
 * @param spec
 * @return
 */
public static <T>Specifications<T> not(final Specification<T> spec){
  return new Specifications<T>(spec){
    @Override public Predicate toPredicate(    Root<T> root,    CriteriaQuery<T> query,    CriteriaBuilder builder){
      return builder.not(spec.toPredicate(root,query,builder));
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Negates the given   {@link Specification}.
 * @param < T >
 * @param spec
 * @return
 */
public static <T>Specifications<T> not(final Specification<T> spec){
  return new Specifications<T>(spec){
    @Override public Predicate toPredicate(    Root<T> root,    CriteriaQuery<?> query,    CriteriaBuilder builder){
      return builder.not(spec.toPredicate(root,query,builder));
    }
  }
;
}
Program: 87498
Project: 87498
Buggy source:
/** 
 * ORs the given specification to the current one.
 * @param other
 * @return
 */
public Specification<T> or(final Specification<T> other){
  return new Specification<T>(){
    public Predicate toPredicate(    Root<T> root,    CriteriaQuery<T> query,    CriteriaBuilder builder){
      return builder.or(spec.toPredicate(root,query,builder),other.toPredicate(root,query,builder));
    }
  }
;
}

Fixed version (ground truth):
/** 
 * ORs the given specification to the current one.
 * @param other
 * @return
 */
public Specification<T> or(final Specification<T> other){
  return new Specification<T>(){
    public Predicate toPredicate(    Root<T> root,    CriteriaQuery<?> query,    CriteriaBuilder builder){
      return builder.or(spec.toPredicate(root,query,builder),other.toPredicate(root,query,builder));
    }
  }
;
}
Program: 87499
Project: 87499
Buggy source:
/** 
 * ANDs the given   {@link Specification} to the current one.
 * @param other
 * @return
 */
public Specification<T> and(final Specification<T> other){
  return new Specification<T>(){
    public Predicate toPredicate(    Root<T> root,    CriteriaQuery<T> query,    CriteriaBuilder builder){
      return builder.and(spec.toPredicate(root,query,builder),other.toPredicate(root,query,builder));
    }
  }
;
}

Fixed version (ground truth):
/** 
 * ANDs the given   {@link Specification} to the current one.
 * @param other
 * @return
 */
public Specification<T> and(final Specification<T> other){
  return new Specification<T>(){
    public Predicate toPredicate(    Root<T> root,    CriteriaQuery<?> query,    CriteriaBuilder builder){
      return builder.and(spec.toPredicate(root,query,builder),other.toPredicate(root,query,builder));
    }
  }
;
}
Program: 87500
Project: 87500
Buggy source:
public Predicate toPredicate(Root<T> root,CriteriaQuery<T> query,CriteriaBuilder builder){
  return spec.toPredicate(root,query,builder);
}

Fixed version (ground truth):
public Predicate toPredicate(Root<T> root,CriteriaQuery<?> query,CriteriaBuilder builder){
  return spec.toPredicate(root,query,builder);
}
Program: 87501
Project: 87501
Buggy source:
private static <T>Specification<T> simplePropertySpec(final String property,final Object value){
  return new Specification<T>(){
    public Predicate toPredicate(    Root<T> root,    CriteriaQuery<T> query,    CriteriaBuilder builder){
      return builder.equal(root.get(property),value);
    }
  }
;
}

Fixed version (ground truth):
private static <T>Specification<T> simplePropertySpec(final String property,final Object value){
  return new Specification<T>(){
    public Predicate toPredicate(    Root<T> root,    CriteriaQuery<?> query,    CriteriaBuilder builder){
      return builder.equal(root.get(property),value);
    }
  }
;
}
Program: 87502
Project: 87502
Buggy source:
public Predicate toPredicate(Root<T> root,CriteriaQuery<T> query,CriteriaBuilder builder){
  return builder.equal(root.get(property),value);
}

Fixed version (ground truth):
public Predicate toPredicate(Root<T> root,CriteriaQuery<?> query,CriteriaBuilder builder){
  return builder.equal(root.get(property),value);
}
Program: 87503
Project: 87503
Buggy source:
/** 
 * Creates an anonymous factory to extract the actual  {@link javax.persistence.EntityManager} from the{@link javax.persistence.EntityManagerFactory} bean name reference.
 * @param entityManagerFactoryBeanName
 * @param source
 * @return
 */
private BeanDefinition getEntityManagerBeanDefinitionFor(String entityManagerFactoryBeanName,Object source){
  AbstractBeanDefinition bean=BeanDefinitionBuilder.rootBeanDefinition("String_Node_Str").getRawBeanDefinition();
  bean.setFactoryBeanName(entityManagerFactoryBeanName);
  bean.setFactoryMethodName("String_Node_Str");
  bean.setSource(source);
  return bean;
}

Fixed version (ground truth):
/** 
 * Creates an anonymous factory to extract the actual  {@link javax.persistence.EntityManager} from the{@link javax.persistence.EntityManagerFactory} bean name reference.
 * @param entityManagerFactoryBeanName
 * @param source
 * @return
 */
private BeanDefinition getEntityManagerBeanDefinitionFor(String entityManagerFactoryBeanName,Object source){
  BeanDefinitionBuilder builder=BeanDefinitionBuilder.rootBeanDefinition("String_Node_Str");
  builder.setFactoryMethod("String_Node_Str");
  builder.addConstructorArgReference(entityManagerFactoryBeanName);
  AbstractBeanDefinition bean=builder.getRawBeanDefinition();
  bean.setSource(source);
  return bean;
}
Program: 87504
Project: 87504
Buggy source:
/** 
 * Returns the generic type with the given index from the given  {@link Class} if it implements {@link GenericDao} or{@link ExtendedGenericDao}.
 * @param clazz
 * @param index
 * @return the domain class for index 0, the id class for index 1.
 */
private static Class<?> getGenericType(Class<?> clazz,int index){
  for (  Type type : clazz.getGenericInterfaces()) {
    if (type instanceof ParameterizedType) {
      ParameterizedType parammeterizedType=(ParameterizedType)type;
      if (isGenericDao(parammeterizedType)) {
        return (Class<?>)parammeterizedType.getActualTypeArguments()[index];
      }
    }
    Class<? extends Persistable<?>> result=getDomainClass((Class<?>)type);
    if (null != result) {
      return result;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the generic type with the given index from the given  {@link Class} if it implements {@link GenericDao} or{@link ExtendedGenericDao}.
 * @param clazz
 * @param index
 * @return the domain class for index 0, the id class for index 1.
 */
private static Class<?> getGenericType(Class<?> clazz,int index){
  for (  Type type : clazz.getGenericInterfaces()) {
    if (type instanceof ParameterizedType) {
      ParameterizedType parammeterizedType=(ParameterizedType)type;
      if (isGenericDao(parammeterizedType)) {
        return (Class<?>)parammeterizedType.getActualTypeArguments()[index];
      }
    }
    Class<?> result=getGenericType((Class<?>)type,index);
    if (null != result) {
      return result;
    }
  }
  return null;
}
Program: 87505
Project: 87505
Buggy source:
/** 
 * Returns whether the parameter with the given index is a special parameter.
 * @see #TYPES
 * @param index
 * @return
 */
public boolean isSpecialParameter(int index){
  return TYPES.contains(method.getParameterTypes()[index]);
}

Fixed version (ground truth):
/** 
 * Returns whether the parameter with the given index is a special parameter.
 * @see #TYPES
 * @param index
 * @return
 */
public final boolean isSpecialParameter(int index){
  return TYPES.contains(method.getParameterTypes()[index]);
}
Program: 87506
Project: 87506
Buggy source:
/** 
 * Executes the   {@link javax.persistence.Query} backing the{@link QueryMethod} with the given parameters.
 * @param em
 * @param parameters
 * @return
 */
public Object executeQuery(Object... methodParameters){
  Parameters parameters=new Parameters(method,methodParameters);
  if (isCollectionQuery()) {
    return COLLECTION.execute(hadesQuery,parameters);
  }
  if (isPageQuery()) {
    return PAGE.execute(hadesQuery,parameters);
  }
  if (isModifyingQuery()) {
    return MODIFY.execute(hadesQuery,parameters);
  }
  return SINGLE_ENTITY.execute(hadesQuery,parameters);
}

Fixed version (ground truth):
/** 
 * Executes the   {@link javax.persistence.Query} backing the{@link QueryMethod} with the given parameters.
 * @param em
 * @param parameters
 * @return
 */
public Object executeQuery(Object... methodParameters){
  Parameters executionParameters=new Parameters(method,methodParameters);
  if (isCollectionQuery()) {
    return COLLECTION.execute(hadesQuery,executionParameters);
  }
  if (isPageQuery()) {
    return PAGE.execute(hadesQuery,executionParameters);
  }
  if (isModifyingQuery()) {
    return MODIFY.execute(hadesQuery,executionParameters);
  }
  return SINGLE_ENTITY.execute(hadesQuery,executionParameters);
}
Program: 87507
Project: 87507
Buggy source:
public void delete(final List<T> entities){
  QueryUtils.applyAndBind(getDeleteAllQueryString(),entities,getEntityManager()).executeUpdate();
}

Fixed version (ground truth):
public void delete(final List<T> entities){
  if (null == entities || entities.isEmpty()) {
    return;
  }
  QueryUtils.applyAndBind(getDeleteAllQueryString(),entities,getEntityManager()).executeUpdate();
}
Program: 87508
Project: 87508
Buggy source:
@Override protected String getDaoImplPostfix(){
  String daoImplPostfix=element.getAttribute(DAO_IMPL_POSTFIX);
  return StringUtils.hasLength(daoImplPostfix) ? daoImplPostfix : parent.getDaoImplPostfix();
}

Fixed version (ground truth):
@Override protected String getDaoImplPostfix(){
  String daoImplPostfix=getElement().getAttribute(DAO_IMPL_POSTFIX);
  return StringUtils.hasLength(daoImplPostfix) ? daoImplPostfix : parent.getDaoImplPostfix();
}
Program: 87509
Project: 87509
Buggy source:
/** 
 * Returns if a custom DAO implementation shall be autodetected.
 * @return
 */
public boolean autodetectCustomImplementation(){
  return !StringUtils.hasText(element.getAttribute(CUSTOM_IMPL_REF));
}

Fixed version (ground truth):
/** 
 * Returns if a custom DAO implementation shall be autodetected.
 * @return
 */
public boolean autodetectCustomImplementation(){
  return !StringUtils.hasText(getElement().getAttribute(CUSTOM_IMPL_REF));
}
Program: 87510
Project: 87510
Buggy source:
@Override public String getFinderPrefix(){
  String finderPrefix=element.getAttribute(FINDER_PREFIX);
  return StringUtils.hasText(finderPrefix) ? finderPrefix : parent.getFinderPrefix();
}

Fixed version (ground truth):
@Override public String getFinderPrefix(){
  String finderPrefix=getElement().getAttribute(FINDER_PREFIX);
  return StringUtils.hasText(finderPrefix) ? finderPrefix : parent.getFinderPrefix();
}
Program: 87511
Project: 87511
Buggy source:
/** 
 * Returns the bean reference to the custom DAO implementation.
 * @return
 */
public String getCustomImplementationRef(){
  return element.getAttribute(CUSTOM_IMPL_REF);
}

Fixed version (ground truth):
/** 
 * Returns the bean reference to the custom DAO implementation.
 * @return
 */
public String getCustomImplementationRef(){
  return getElement().getAttribute(CUSTOM_IMPL_REF);
}
Program: 87512
Project: 87512
Buggy source:
@Override protected String getDaoBasePackageName(){
  String daoPackageName=element.getAttribute(DAO_PACKAGE_NAME);
  return StringUtils.hasText(daoPackageName) ? daoPackageName : parent.getDaoBasePackageName();
}

Fixed version (ground truth):
@Override protected String getDaoBasePackageName(){
  String daoPackageName=getElement().getAttribute(DAO_PACKAGE_NAME);
  return StringUtils.hasText(daoPackageName) ? daoPackageName : parent.getDaoBasePackageName();
}
Program: 87513
Project: 87513
Buggy source:
/** 
 * Creates a new   {@link FinderMethod} from the given parameters. Looks upthe correct query to use for following invocations of the method given.
 * @param method
 * @param prefix
 * @param domainClass
 * @param strategy
 * @param em
 */
public FinderMethod(Method method,String prefix,Class<?> domainClass,QueryLookupStrategy strategy,EntityManager em){
  Assert.notNull(method,"String_Node_Str");
  Assert.hasText(prefix,"String_Node_Str");
  Assert.notNull(domainClass,"String_Node_Str");
  Assert.notNull(em,"String_Node_Str");
  if (!method.getName().startsWith(prefix)) {
    throw new IllegalArgumentException(String.format("String_Node_Str" + "String_Node_Str",prefix));
  }
  this.method=method;
  this.prefix=prefix;
  this.domainClass=domainClass;
  this.em=em;
  strategy=null == strategy ? QueryLookupStrategy.getDefault() : strategy;
  this.hadesQuery=strategy.resolveQuery(this);
}

Fixed version (ground truth):
/** 
 * Creates a new   {@link FinderMethod} from the given parameters. Looks upthe correct query to use for following invocations of the method given.
 * @param method
 * @param prefix
 * @param domainClass
 * @param strategy
 * @param em
 */
public FinderMethod(Method method,String prefix,Class<?> domainClass,QueryLookupStrategy strategy,EntityManager em){
  Assert.notNull(method,"String_Node_Str");
  Assert.hasText(prefix,"String_Node_Str");
  Assert.notNull(domainClass,"String_Node_Str");
  Assert.notNull(em,"String_Node_Str");
  if (!method.getName().startsWith(prefix)) {
    throw new IllegalArgumentException(String.format("String_Node_Str" + "String_Node_Str",prefix));
  }
  this.method=method;
  this.prefix=prefix;
  this.domainClass=domainClass;
  this.em=em;
  QueryLookupStrategy strategyToUse=null == strategy ? QueryLookupStrategy.getDefault() : strategy;
  this.hadesQuery=strategyToUse.resolveQuery(this);
}
Program: 87514
Project: 87514
Buggy source:
/** 
 * Constructs a query from the given method. The method has to start with  {@code #FINDER_PREFIX}.
 * @return the query string
 */
String constructQuery(){
  final String AND="String_Node_Str";
  final String OR="String_Node_Str";
  String methodName=method.getName();
  int numberOfBlocks=0;
  methodName=methodName.substring(prefix.length(),methodName.length());
  StringBuilder queryBuilder=new StringBuilder(getQueryString(READ_ALL_QUERY,domainClass) + "String_Node_Str");
  String[] orParts=StringUtils.delimitedListToStringArray(methodName,OR);
  for (  String orPart : Arrays.asList(orParts)) {
    String[] andParts=StringUtils.delimitedListToStringArray(orPart,AND);
    StringBuilder andBuilder=new StringBuilder();
    for (    String andPart : Arrays.asList(andParts)) {
      andBuilder.append("String_Node_Str");
      andBuilder.append(StringUtils.uncapitalize(andPart));
      andBuilder.append("String_Node_Str");
      andBuilder.append("String_Node_Str");
      numberOfBlocks++;
    }
    andBuilder.delete(andBuilder.length() - 5,andBuilder.length());
    queryBuilder.append(andBuilder);
    queryBuilder.append("String_Node_Str");
  }
  if (numberOfBlocks != method.getParameterTypes().length) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  queryBuilder.delete(queryBuilder.length() - 4,queryBuilder.length());
  String query=queryBuilder.toString();
  if (LOG.isDebugEnabled()) {
    LOG.debug(String.format("String_Node_Str",query,method.getName()));
  }
  return query;
}

Fixed version (ground truth):
/** 
 * Constructs a query from the given method. The method has to start with  {@code #FINDER_PREFIX}.
 * @return the query string
 */
String constructQuery(){
  final String and="String_Node_Str";
  final String or="String_Node_Str";
  String methodName=method.getName();
  int numberOfBlocks=0;
  methodName=methodName.substring(prefix.length(),methodName.length());
  StringBuilder queryBuilder=new StringBuilder(getQueryString(READ_ALL_QUERY,domainClass) + "String_Node_Str");
  String[] orParts=StringUtils.delimitedListToStringArray(methodName,or);
  for (  String orPart : Arrays.asList(orParts)) {
    String[] andParts=StringUtils.delimitedListToStringArray(orPart,and);
    StringBuilder andBuilder=new StringBuilder();
    for (    String andPart : Arrays.asList(andParts)) {
      andBuilder.append("String_Node_Str");
      andBuilder.append(StringUtils.uncapitalize(andPart));
      andBuilder.append("String_Node_Str");
      andBuilder.append("String_Node_Str");
      numberOfBlocks++;
    }
    andBuilder.delete(andBuilder.length() - 5,andBuilder.length());
    queryBuilder.append(andBuilder);
    queryBuilder.append("String_Node_Str");
  }
  if (numberOfBlocks != method.getParameterTypes().length) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  queryBuilder.delete(queryBuilder.length() - 4,queryBuilder.length());
  String query=queryBuilder.toString();
  if (LOG.isDebugEnabled()) {
    LOG.debug(String.format("String_Node_Str",query,method.getName()));
  }
  return query;
}
Program: 87515
Project: 87515
Buggy source:
/** 
 * Returns sort properties.
 * @return the property
 */
public String[] getProperties(){
  return properties;
}

Fixed version (ground truth):
/** 
 * Returns sort properties.
 * @return the property
 */
public String[] getProperties(){
  return properties.clone();
}
Program: 87516
Project: 87516
Buggy source:
/** 
 * Creates a new instance of   {@code Sort}.
 * @param order
 * @param properties
 */
public Sort(Order order,String... properties){
  this.properties=properties;
  this.order=order;
}

Fixed version (ground truth):
/** 
 * Creates a new instance of   {@code Sort}.
 * @param order
 * @param properties
 */
public Sort(Order order,String... properties){
  this.properties=properties.clone();
  this.order=order;
}
Program: 87517
Project: 87517
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (!obj.getClass().equals(this.getClass())) {
    return false;
  }
  AbstractPersistable<?> that=(AbstractPersistable<?>)obj;
  return null == this.getId() ? false : this.getId().equals(that.getId());
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (null == obj) {
    return false;
  }
  if (this == obj) {
    return true;
  }
  if (!getClass().equals(obj.getClass())) {
    return false;
  }
  AbstractPersistable<?> that=(AbstractPersistable<?>)obj;
  return null == this.getId() ? false : this.getId().equals(that.getId());
}
Program: 87518
Project: 87518
Buggy source:
public int getTotalPages(){
  return (int)Math.ceil(new Long(total).doubleValue() / new Integer(pageSize).doubleValue());
}

Fixed version (ground truth):
public int getTotalPages(){
  return (int)Math.ceil((double)total / (double)pageSize);
}
Program: 87519
Project: 87519
Buggy source:
/** 
 * Asserts that   {@link #equals(Object)} returns true for self references andother references of the exact same class and id and  {@code false}otherwise.
 * @throws Exception
 */
@Test public void correctEquals() throws Exception {
  assertEquals(user,user);
  assertNotEquals(user,new SampleUser(null));
  user.setId(1L);
  assertEquals(user,new SampleUser(1L));
  assertNotEquals(user,new SampleRole(1L));
}

Fixed version (ground truth):
/** 
 * Asserts that   {@link #equals(Object)} returns true for self references andother references of the exact same class and id and  {@code false}otherwise.
 * @throws Exception
 */
@Test public void correctEquals() throws Exception {
  assertEquals(user,user);
  assertNotEquals(user,new SampleUser(null));
  user.setId(1L);
  assertEquals(user,new SampleUser(1L));
  assertNotEquals(user,new SampleUser(1L){
    private static final long serialVersionUID=7716397091688803365L;
  }
);
  assertNotEquals(user,new SampleRole(1L));
}
Program: 87520
Project: 87520
Buggy source:
@Override public String toString(){
  return String.format("String_Node_Str",this.getClass().getName(),getId().toString());
}

Fixed version (ground truth):
@Override public String toString(){
  return String.format("String_Node_Str",this.getClass().getName(),getId());
}
Program: 87521
Project: 87521
Buggy source:
@SuppressWarnings("String_Node_Str") public Page<T> readByExample(final Pageable pageable,final Sort sort,final T... examples){
  Assert.notNull(pageable,"String_Node_Str");
  if (null == examples || examples.length == 0) {
    return readAll(pageable,sort);
  }
  Criteria criteria=prepareCriteria(examples);
  if (null != pageable) {
    criteria.setFirstResult(pageable.getFirstItem());
    criteria.setMaxResults(pageable.getNumberOfItems());
  }
  if (null != sort) {
    applySorting(criteria,sort);
  }
  return new PageImpl(criteria.list(),pageable,count());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Page<T> readByExample(final Pageable pageable,final Sort sort,final T... examples){
  Assert.notNull(pageable,"String_Node_Str");
  if (null == examples || examples.length == 0) {
    return readAll(pageable,sort);
  }
  Criteria countCriteria=prepareCriteria(examples);
  countCriteria.setProjection(Projections.rowCount());
  Integer count=(Integer)countCriteria.uniqueResult();
  Criteria listCriteria=prepareCriteria(examples);
  if (null != sort) {
    applySorting(listCriteria,sort);
  }
  if (null != pageable) {
    listCriteria.setFirstResult(pageable.getFirstItem());
    listCriteria.setMaxResults(pageable.getNumberOfItems());
  }
  return new PageImpl(listCriteria.list(),pageable,count);
}
Program: 87522
Project: 87522
Buggy source:
/** 
 * Returns the query string to retrieve all entities.
 * @return
 */
private String getReadAllQuery(){
  return "String_Node_Str" + getDomainClass().getSimpleName() + "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Returns the query string to retrieve all entities.
 * @return
 */
protected String getReadAllQuery(){
  return "String_Node_Str" + getDomainClass().getSimpleName() + "String_Node_Str";
}
Program: 87523
Project: 87523
Buggy source:
@Override protected void onSetUpInTransaction() throws Exception {
  referenceUsers=new ArrayList<User>();
  for (int i=0; i < NUMBER_OF_INSTANCES; i++) {
    User user=new User("String_Node_Str" + i,"String_Node_Str" + i,"String_Node_Str" + (NUMBER_OF_INSTANCES - i));
    referenceUsers.add(userExtendedDao.save(user));
  }
  assertEquals(10,userExtendedDao.count().longValue());
}

Fixed version (ground truth):
@Override protected void onSetUpInTransaction() throws Exception {
  referenceUsers=new ArrayList<User>();
  for (int i=0; i < NUMBER_OF_INSTANCES; i++) {
    User user=new User("String_Node_Str" + i,"String_Node_Str" + i % 2,"String_Node_Str" + (NUMBER_OF_INSTANCES - i));
    referenceUsers.add(userExtendedDao.save(user));
  }
  assertEquals(NUMBER_OF_INSTANCES,userExtendedDao.count().longValue());
}
Program: 87524
Project: 87524
Buggy source:
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=false) public void onBlockBreakLowest(final BlockBreakEvent event){
  if (!stack.isEmpty()) {
    checkStack();
    final Player player=event.getPlayer();
    final StackEntry entry=stack.get(stack.size() - 1);
    if (player.equals(entry.player))     addExemption(entry);
  }
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=false) public void onBlockBreakLowest(final BlockBreakEvent event){
  checkStack();
  if (!stack.isEmpty()) {
    final Player player=event.getPlayer();
    final StackEntry entry=stack.get(stack.size() - 1);
    if (player.equals(entry.player))     addExemption(entry);
  }
}
Program: 87525
Project: 87525
Buggy source:
public Pair<Integer,List<JSONObject>> getModelsByCategoryId(final long categoryId,final int pageNumber){
  List<JSONObject> allModels=getAllModelsByCategoryId(categoryId);
  int modelsNumber=allModels.size();
  int pagesNumber=modelsNumber % MODELS_ON_PAGE_NUM == 0 ? modelsNumber / MODELS_ON_PAGE_NUM : modelsNumber / MODELS_ON_PAGE_NUM + 1;
  int indexFrom, indexTo;
  if (pageNumber < pagesNumber) {
    indexFrom=(pageNumber - 1) * MODELS_ON_PAGE_NUM;
    indexTo=pageNumber * MODELS_ON_PAGE_NUM - 1;
  }
 else   if (pageNumber == pagesNumber) {
    indexFrom=(pageNumber - 1) * MODELS_ON_PAGE_NUM;
    indexTo=modelsNumber - 1;
  }
 else {
    indexFrom=0;
    indexTo=pagesNumber > 1 ? MODELS_ON_PAGE_NUM - 1 : modelsNumber - 1;
  }
  return new Pair<Integer,List<JSONObject>>(pagesNumber,allModels.subList(indexFrom,indexTo));
}

Fixed version (ground truth):
public Pair<Integer,List<JSONObject>> getModelsByCategoryId(final long categoryId,final int pageNumber){
  List<JSONObject> allModels=getAllModelsByCategoryId(categoryId);
  int modelsNumber=allModels.size();
  if (modelsNumber == 0) {
    return new Pair<Integer,List<JSONObject>>(1,new ArrayList<JSONObject>());
  }
  int pagesNumber=modelsNumber % MODELS_ON_PAGE_NUM == 0 ? modelsNumber / MODELS_ON_PAGE_NUM : modelsNumber / MODELS_ON_PAGE_NUM + 1;
  int indexFrom, indexTo;
  if (pageNumber < pagesNumber) {
    indexFrom=(pageNumber - 1) * MODELS_ON_PAGE_NUM;
    indexTo=pageNumber * MODELS_ON_PAGE_NUM - 1;
  }
 else   if (pageNumber == pagesNumber) {
    indexFrom=(pageNumber - 1) * MODELS_ON_PAGE_NUM;
    indexTo=modelsNumber - 1;
  }
 else {
    indexFrom=0;
    indexTo=pagesNumber > 1 ? MODELS_ON_PAGE_NUM - 1 : modelsNumber - 1;
  }
  return new Pair<Integer,List<JSONObject>>(pagesNumber,allModels.subList(indexFrom,indexTo));
}
Program: 87529
Project: 87529
Buggy source:
@Override protected void setValues(PreparedStatement ps,JSONObject element) throws SQLException {
  try {
    ps.setString(1,element.toString());
    ps.setLong(2,Long.parseLong(element.getString(EntityType.TYPE_ID_ATTR)));
    ps.setLong(3,Long.parseLong(element.getString(ID_ATTR)));
  }
 catch (  JSONException e) {
    log.error("String_Node_Str",e);
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override protected void setValues(final PreparedStatement ps,final JSONObject element) throws SQLException {
  try {
    ps.setString(1,element.toString());
    ps.setLong(2,Long.parseLong(element.getString(EntityType.TYPE_ID_ATTR)));
    ps.setLong(3,Long.parseLong(element.getString(ID_ATTR)));
  }
 catch (  JSONException e) {
    log.error("String_Node_Str" + element,e);
  }
}
Program: 87530
Project: 87530
Buggy source:
public void improveEntities(final Collection<JSONObject> entities){
  jdbcTemplate.update("String_Node_Str",new IterativeBatchPreparedStatementSetter<JSONObject>(entities){
    @Override protected void setValues(    PreparedStatement ps,    JSONObject element) throws SQLException {
      try {
        ps.setString(1,element.toString());
        ps.setLong(2,Long.parseLong(element.getString(EntityType.TYPE_ID_ATTR)));
        ps.setLong(3,Long.parseLong(element.getString(ID_ATTR)));
      }
 catch (      JSONException e) {
        log.error("String_Node_Str",e);
        throw new RuntimeException(e);
      }
    }
  }
);
}

Fixed version (ground truth):
public void improveEntities(final Collection<JSONObject> entities){
  jdbcTemplate.batchUpdate("String_Node_Str",new IterativeBatchPreparedStatementSetter<JSONObject>(entities){
    @Override protected void setValues(    final PreparedStatement ps,    final JSONObject element) throws SQLException {
      try {
        ps.setString(1,element.toString());
        ps.setLong(2,Long.parseLong(element.getString(EntityType.TYPE_ID_ATTR)));
        ps.setLong(3,Long.parseLong(element.getString(ID_ATTR)));
      }
 catch (      JSONException e) {
        log.error("String_Node_Str" + element,e);
      }
    }
  }
);
}
Program: 87531
Project: 87531
Buggy source:
@Test public void testEClass() throws Exception {
  XtextResourceSet rs=resourceSetProvider.get();
  URI xCoreURI=getURI("String_Node_Str","String_Node_Str");
  @SuppressWarnings("String_Node_Str") Resource xCoreResoure=rs.getResource(xCoreURI,true);
  Greeting g=parseHelper.parse("String_Node_Str",rs);
  validationHelper.assertNoErrors(g);
  EClass anEClass=g.getEClass();
  assertEquals("String_Node_Str",anEClass.getName());
  EObject eObject=anEClass.getEPackage().getEFactoryInstance().create(anEClass);
  assertTrue(eObject.getClass().toString(),eObject instanceof TestModel);
}

Fixed version (ground truth):
@Test public void testEClass() throws Exception {
  XtextResourceSet rs=resourceSetProvider.get();
  Resource rx=rs.getResource(URI.createURI("String_Node_Str"),true);
  Resource rx2=rs.getResource(URI.createURI("String_Node_Str"),true);
  rx.load(null);
  rx2.load(null);
  URI xCoreURI=getURI("String_Node_Str","String_Node_Str");
  @SuppressWarnings("String_Node_Str") Resource xCoreResoure=rs.getResource(xCoreURI,true);
  validationHelper.assertNoErrors(xCoreResoure.getContents().get(0));
  Greeting g=parseHelper.parse("String_Node_Str",rs);
  validationHelper.assertNoErrors(g);
  EClass anEClass=g.getEClass();
  assertEquals("String_Node_Str",anEClass.getName());
  EObject eObject=anEClass.getEPackage().getEFactoryInstance().create(anEClass);
  assertTrue(eObject.getClass().toString(),eObject instanceof TestModel);
}
Program: 87532
Project: 87532
Buggy source:
@Override public void accessed(PropertyChangeNotifier cn){
  cn.setChangeListener(ThreadLocal.get());
}

Fixed version (ground truth):
@Override public void accessed(PropertyChangeNotifier cn){
  if (ThreadLocal.get() != null)   cn.setChangeListener(ThreadLocal.get());
}
Program: 87533
Project: 87533
Buggy source:
@After public void tearDown(){
  db.dispose();
}

Fixed version (ground truth):
@After public void tearDown(){
}
Program: 87534
Project: 87534
Buggy source:
/** 
 * Tests that using an EObject in observe(), like the EMFProperties Data Binding API expects fails. The XtextProperties Data Binding API needs to be observing an XTextDocument (IReadAccess<XtextResource>, IWriteAccess<XtextResource>). 
 */
@Test public void testErrorObserveObjectInsteadOfResourceAcess(){
  Binding binding1=db.bindValue(BeanProperties.value("String_Node_Str").observe(bean),EMFXtextProperties.value(titleFeature).observe(eObject));
  bean.setName("String_Node_Str");
  assertIllegalArgumentExceptionValidationError(binding1);
  db.removeBinding(binding1);
}

Fixed version (ground truth):
/** 
 * Tests that using an EObject in observe(), like the EMFProperties Data Binding API expects fails. The XtextProperties Data Binding API needs to be observing an XTextDocument (IReadAccess<XtextResource>, IWriteAccess<XtextResource>). 
 */
@Test(expected=IllegalArgumentException.class) public void testErrorObserveObjectInsteadOfResourceAcess(){
  Binding binding1=db.bindValue(BeanProperties.value("String_Node_Str").observe(bean),EMFXtextProperties.value(titleFeature).observe(eObject));
}