nus-yam/ex-repair huggingface dataset:
Program: 56419
Project: 56419
Buggy source:
@Override public Loader<SimpleCursor> onCreateLoader(int i,Bundle bundle){
  return new SimpleCursorLoader(getActivity(),ProviderSchematic.RelatedMovies.fromMovie(movieId),null,null,null,null);
}

Fixed version (ground truth):
@Override public Loader<SimpleCursor> onCreateLoader(int i,Bundle bundle){
  return new SimpleCursorLoader(getActivity(),RelatedMovies.fromMovie(movieId),MoviesAdapter.PROJECTION,null,null,null);
}
Program: 56420
Project: 56420
Buggy source:
@Override public void run(){
  setVisibility(GONE);
  collapse();
}

Fixed version (ground truth):
@Override public void run(){
  setVisibility(GONE);
  collapse();
  setAnimationProgress(1.0f);
}
Program: 56421
Project: 56421
Buggy source:
private void animateOut(){
  if (watchingViewListener != null) {
    watchingViewListener.onAnimatingOut(this);
  }
  if (getVisibility() != GONE) {
    animate().alpha(0.0f).withEndAction(new Runnable(){
      @Override public void run(){
        setVisibility(GONE);
        collapse();
      }
    }
);
  }
}

Fixed version (ground truth):
private void animateOut(){
  if (watchingViewListener != null) {
    watchingViewListener.onAnimatingOut(this);
  }
  if (getVisibility() != GONE) {
    animate().alpha(0.0f).withEndAction(new Runnable(){
      @Override public void run(){
        setVisibility(GONE);
        collapse();
        setAnimationProgress(1.0f);
      }
    }
);
  }
}
Program: 56422
Project: 56422
Buggy source:
private void clearVariables(){
  type=null;
  showId=-1L;
  showTitle=null;
  episodeId=-1L;
  episodeTitle=null;
  movieId=-1L;
  movieTitle=null;
  poster=null;
  startTime=0L;
  endTime=0L;
  isExpanded=false;
}

Fixed version (ground truth):
private void clearVariables(){
  type=null;
  showId=-1L;
  showTitle=null;
  episodeId=-1L;
  episodeTitle=null;
  movieId=-1L;
  movieTitle=null;
  poster=null;
  startTime=0L;
  endTime=0L;
}
Program: 56423
Project: 56423
Buggy source:
public void watchingMovie(long movieId,String movieTitle,String overview,String poster,long startTime,long endTime){
  clearVariables();
  this.type=Type.MOVIE;
  this.movieId=movieId;
  this.movieTitle=movieTitle;
  this.movieOverview=overview;
  this.poster=poster;
  this.startTime=startTime;
  this.endTime=endTime;
  posterView.setImage(poster);
  titleView.setText(movieTitle);
  subtitleView.setVisibility(GONE);
  animateIn();
}

Fixed version (ground truth):
public void watchingMovie(long movieId,String movieTitle,String overview,String poster,long startTime,long endTime){
  if (type != Type.MOVIE || movieId != this.movieId) {
    clearVariables();
    this.type=Type.MOVIE;
    this.movieId=movieId;
  }
  this.movieTitle=movieTitle;
  this.movieOverview=overview;
  this.poster=poster;
  this.startTime=startTime;
  this.endTime=endTime;
  posterView.setImage(poster);
  titleView.setText(movieTitle);
  subtitleView.setVisibility(GONE);
  progress.setMax((int)(endTime - startTime));
  progress.setProgress((int)(System.currentTimeMillis() - startTime));
  animateIn();
}
Program: 56424
Project: 56424
Buggy source:
public void watchingShow(long showId,String showTitle,long episodeId,String episodeTitle,String poster,long startTime,long endTime){
  clearVariables();
  this.type=Type.SHOW;
  this.showId=showId;
  this.showTitle=showTitle;
  this.episodeId=episodeId;
  this.episodeTitle=episodeTitle;
  this.poster=poster;
  this.startTime=startTime;
  this.endTime=endTime;
  posterView.setImage(poster);
  titleView.setText(showTitle);
  subtitleView.setVisibility(VISIBLE);
  subtitleView.setText(episodeTitle);
  progress.setMax((int)(endTime - startTime));
  progress.setProgress((int)(System.currentTimeMillis() - startTime));
  animateIn();
}

Fixed version (ground truth):
public void watchingShow(long showId,String showTitle,long episodeId,String episodeTitle,String poster,long startTime,long endTime){
  if (type != Type.SHOW || showId != this.showId) {
    clearVariables();
    this.type=Type.SHOW;
    this.showId=showId;
  }
  this.showTitle=showTitle;
  this.episodeId=episodeId;
  this.episodeTitle=episodeTitle;
  this.poster=poster;
  this.startTime=startTime;
  this.endTime=endTime;
  posterView.setImage(poster);
  titleView.setText(showTitle);
  subtitleView.setVisibility(VISIBLE);
  subtitleView.setText(episodeTitle);
  progress.setMax((int)(endTime - startTime));
  progress.setProgress((int)(System.currentTimeMillis() - startTime));
  animateIn();
}
Program: 56427
Project: 56427
Buggy source:
@Override public void handleResponse(SyncResponse response){
  movieHelper.setIsInWatchlist(traktId,inWatchlist,TimeUtils.getMillis(listedAt));
}

Fixed version (ground truth):
@Override public void handleResponse(SyncResponse response){
  queue(new SyncMoviesWatchlist());
}
Program: 56428
Project: 56428
Buggy source:
@Override public void handleResponse(SyncResponse response){
  episodeHelper.setIsInWatchlist(traktId,season,episode,inWatchlist,TimeUtils.getMillis(listedAt));
}

Fixed version (ground truth):
@Override public void handleResponse(SyncResponse response){
  queue(new SyncEpisodeWatchlist());
}
Program: 56429
Project: 56429
Buggy source:
@Override public void handleResponse(SyncResponse response){
}

Fixed version (ground truth):
@Override public void handleResponse(SyncResponse response){
  queue(new SyncShowsWatchlist());
}
Program: 56430
Project: 56430
Buggy source:
private void scheduleAlarm(){
  Intent intent=new Intent(AuthJobService.this,AuthJobReceiver.class);
  final int retryDelay=Math.max(1,this.retryDelay);
  final int nextDelay=Math.min(retryDelay * 2,MAX_RETRY_DELAY);
  intent.putExtra(RETRY_DELAY,nextDelay);
  PendingIntent pi=PendingIntent.getBroadcast(AuthJobService.this,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
  AlarmManager am=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
  final long runAt=SystemClock.elapsedRealtime() + retryDelay * DateUtils.MINUTE_IN_MILLIS;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && retryDelay < 10) {
    am.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP,runAt,pi);
  }
 else {
    am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,runAt,pi);
  }
  Timber.d("String_Node_Str",retryDelay);
}

Fixed version (ground truth):
private void scheduleAlarm(){
  Intent intent=new Intent(AuthJobService.this,AuthJobReceiver.class);
  final int retryDelay=Math.max(1,this.retryDelay);
  final int nextDelay=Math.min(retryDelay * 2,MAX_RETRY_DELAY);
  intent.putExtra(RETRY_DELAY,nextDelay);
  PendingIntent pi=PendingIntent.getBroadcast(AuthJobService.this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
  AlarmManager am=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
  am.cancel(pi);
  final long runAt=SystemClock.elapsedRealtime() + retryDelay * DateUtils.MINUTE_IN_MILLIS;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && retryDelay < 10) {
    am.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP,runAt,pi);
  }
 else {
    am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,runAt,pi);
  }
  Timber.d("String_Node_Str",retryDelay);
}
Program: 56431
Project: 56431
Buggy source:
private void scheduleAlarm(){
  Intent intent=new Intent(JobService.this,JobReceiver.class);
  final int retryDelay=Math.max(1,this.retryDelay);
  final int nextDelay=Math.min(retryDelay * 2,MAX_RETRY_DELAY);
  intent.putExtra(RETRY_DELAY,nextDelay);
  PendingIntent pi=PendingIntent.getBroadcast(JobService.this,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);
  AlarmManager am=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
  final long runAt=SystemClock.elapsedRealtime() + retryDelay * DateUtils.MINUTE_IN_MILLIS;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && retryDelay < 10) {
    am.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP,runAt,pi);
  }
 else {
    am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,runAt,pi);
  }
  Timber.d("String_Node_Str",retryDelay);
}

Fixed version (ground truth):
private void scheduleAlarm(){
  Intent intent=new Intent(JobService.this,JobReceiver.class);
  final int retryDelay=Math.max(1,this.retryDelay);
  final int nextDelay=Math.min(retryDelay * 2,MAX_RETRY_DELAY);
  intent.putExtra(RETRY_DELAY,nextDelay);
  PendingIntent pi=PendingIntent.getBroadcast(JobService.this,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
  AlarmManager am=(AlarmManager)getSystemService(Context.ALARM_SERVICE);
  am.cancel(pi);
  final long runAt=SystemClock.elapsedRealtime() + retryDelay * DateUtils.MINUTE_IN_MILLIS;
  am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,runAt,pi);
  Timber.d("String_Node_Str",retryDelay);
}
Program: 56435
Project: 56435
Buggy source:
public boolean shouldUpdate(long traktId,String lastUpdated){
  if (lastUpdated == null)   return true;
  Cursor movie=null;
  try {
    movie=resolver.query(Movies.MOVIES,new String[]{MovieColumns.LAST_UPDATED,MovieColumns.WATCHED,MovieColumns.IN_COLLECTION,MovieColumns.IN_WATCHLIST},MovieColumns.TRAKT_ID + "String_Node_Str",new String[]{String.valueOf(traktId)},null);
    if (movie.moveToFirst()) {
      final boolean watched=Cursors.getBoolean(movie,MovieColumns.WATCHED);
      final boolean collected=Cursors.getBoolean(movie,MovieColumns.IN_COLLECTION);
      final boolean inWatchlist=Cursors.getBoolean(movie,MovieColumns.IN_WATCHLIST);
      final boolean isUpdated=TimeUtils.getMillis(lastUpdated) > Cursors.getLong(movie,MovieColumns.LAST_UPDATED);
      if (isUpdated) {
        if (watched || collected || inWatchlist) {
          return true;
        }
      }
    }
    return false;
  }
  finally {
    if (movie != null)     movie.close();
  }
}

Fixed version (ground truth):
public boolean shouldUpdate(long traktId,String lastUpdated){
  if (lastUpdated == null)   return true;
  Cursor movie=null;
  try {
    movie=resolver.query(Movies.MOVIES,new String[]{MovieColumns.WATCHED,MovieColumns.IN_COLLECTION,MovieColumns.IN_WATCHLIST},MovieColumns.TRAKT_ID + "String_Node_Str",new String[]{String.valueOf(traktId)},null);
    if (movie.moveToFirst()) {
      final boolean watched=Cursors.getBoolean(movie,MovieColumns.WATCHED);
      final boolean collected=Cursors.getBoolean(movie,MovieColumns.IN_COLLECTION);
      final boolean inWatchlist=Cursors.getBoolean(movie,MovieColumns.IN_WATCHLIST);
      if (watched || collected || inWatchlist) {
        return true;
      }
    }
    return false;
  }
  finally {
    if (movie != null)     movie.close();
  }
}
Program: 56436
Project: 56436
Buggy source:
public boolean shouldUpdate(long traktId,String lastUpdatedIso){
  long lastUpdated=TimeUtils.getMillis(lastUpdatedIso);
  Cursor show=null;
  try {
    show=resolver.query(Shows.SHOWS,new String[]{ShowColumns.LAST_UPDATED,ShowColumns.WATCHED_COUNT,ShowColumns.IN_COLLECTION_COUNT,ShowColumns.IN_WATCHLIST_COUNT,ShowColumns.IN_COLLECTION_COUNT,ShowColumns.IN_WATCHLIST},ShowColumns.TRAKT_ID + "String_Node_Str",new String[]{String.valueOf(traktId)},null);
    if (show.moveToFirst()) {
      final int watchedCount=Cursors.getInt(show,ShowColumns.WATCHED_COUNT);
      final int collectedCount=Cursors.getInt(show,ShowColumns.IN_COLLECTION_COUNT);
      final int watchlistCount=Cursors.getInt(show,ShowColumns.IN_WATCHLIST_COUNT);
      final boolean inWatchlist=Cursors.getBoolean(show,ShowColumns.IN_WATCHLIST);
      final boolean isUpdated=lastUpdated > Cursors.getLong(show,ShowColumns.LAST_UPDATED);
      if (isUpdated) {
        if (watchedCount > 0 || collectedCount > 0 || watchlistCount > 0 || inWatchlist) {
          return true;
        }
      }
    }
    return false;
  }
  finally {
    if (show != null)     show.close();
  }
}

Fixed version (ground truth):
public boolean shouldUpdate(long traktId){
  Cursor show=null;
  try {
    show=resolver.query(Shows.SHOWS,new String[]{ShowColumns.WATCHED_COUNT,ShowColumns.IN_COLLECTION_COUNT,ShowColumns.IN_WATCHLIST_COUNT,ShowColumns.IN_COLLECTION_COUNT,ShowColumns.IN_WATCHLIST},ShowColumns.TRAKT_ID + "String_Node_Str",new String[]{String.valueOf(traktId)},null);
    if (show.moveToFirst()) {
      final int watchedCount=Cursors.getInt(show,ShowColumns.WATCHED_COUNT);
      final int collectedCount=Cursors.getInt(show,ShowColumns.IN_COLLECTION_COUNT);
      final int watchlistCount=Cursors.getInt(show,ShowColumns.IN_WATCHLIST_COUNT);
      final boolean inWatchlist=Cursors.getBoolean(show,ShowColumns.IN_WATCHLIST);
      if (watchedCount > 0 || collectedCount > 0 || watchlistCount > 0 || inWatchlist) {
        return true;
      }
    }
    return false;
  }
  finally {
    if (show != null)     show.close();
  }
}
Program: 56437
Project: 56437
Buggy source:
@Override public void handleResponse(List<UpdatedItem> updated){
  for (  UpdatedItem item : updated) {
    final String updatedAt=item.getUpdatedAt();
    final Movie movie=item.getMovie();
    final long traktId=movie.getIds().getTrakt();
    final long movieId=movieHelper.getId(traktId);
    if (movieId != -1L) {
      final boolean shouldUpdate=movieHelper.shouldUpdate(traktId,updatedAt);
      if (shouldUpdate) {
        queue(new SyncMovie(traktId));
      }
 else {
        ContentValues values=new ContentValues();
        values.put(MovieColumns.NEEDS_SYNC,true);
        getContentResolver().update(Movies.withId(movieId),values,null,null);
      }
    }
  }
  if (updated.size() >= LIMIT) {
    queue(new SyncUpdatedMovies(updatedSince,page + 1));
  }
}

Fixed version (ground truth):
@Override public void handleResponse(List<UpdatedItem> updated){
  for (  UpdatedItem item : updated) {
    final String updatedAt=item.getUpdatedAt();
    final Movie movie=item.getMovie();
    final long traktId=movie.getIds().getTrakt();
    final long movieId=movieHelper.getId(traktId);
    if (movieId != -1L) {
      if (movieHelper.isUpdated(traktId,updatedAt)) {
        final boolean shouldUpdate=movieHelper.shouldUpdate(traktId,updatedAt);
        if (shouldUpdate) {
          queue(new SyncMovie(traktId));
        }
 else {
          ContentValues values=new ContentValues();
          values.put(MovieColumns.NEEDS_SYNC,true);
          getContentResolver().update(Movies.withId(movieId),values,null,null);
        }
      }
    }
  }
  if (updated.size() >= LIMIT) {
    queue(new SyncUpdatedMovies(updatedSince,page + 1));
  }
}
Program: 56438
Project: 56438
Buggy source:
@Override public void handleResponse(List<UpdatedItem> updated){
  List<Long> showSummaries=new ArrayList<>();
  for (  UpdatedItem item : updated) {
    final String updatedAt=item.getUpdatedAt();
    Show show=item.getShow();
    final long traktId=show.getIds().getTrakt();
    final long id=showHelper.getId(traktId);
    if (id != -1L) {
      final boolean shouldUpdate=showHelper.shouldUpdate(traktId,updatedAt);
      if (shouldUpdate) {
        queue(new SyncShow(traktId));
      }
 else {
        ContentValues values=new ContentValues();
        values.put(ShowColumns.NEEDS_SYNC,true);
        getContentResolver().update(Shows.withId(id),values,null,null);
      }
    }
  }
  if (updated.size() >= LIMIT) {
    queue(new SyncUpdatedShows(updatedSince,page + 1));
  }
}

Fixed version (ground truth):
@Override public void handleResponse(List<UpdatedItem> updated){
  for (  UpdatedItem item : updated) {
    final String updatedAt=item.getUpdatedAt();
    Show show=item.getShow();
    final long traktId=show.getIds().getTrakt();
    final long id=showHelper.getId(traktId);
    if (id != -1L) {
      if (showHelper.isUpdated(traktId,updatedAt)) {
        final boolean shouldUpdate=showHelper.shouldUpdate(traktId);
        if (shouldUpdate) {
          queue(new SyncShow(traktId));
        }
 else {
          ContentValues values=new ContentValues();
          values.put(ShowColumns.NEEDS_SYNC,true);
          getContentResolver().update(Shows.withId(id),values,null,null);
        }
      }
    }
  }
  if (updated.size() >= LIMIT) {
    queue(new SyncUpdatedShows(updatedSince,page + 1));
  }
}
Program: 56440
Project: 56440
Buggy source:
public void onViewCreated(View view,Bundle inState){
  super.onViewCreated(view,inState);
  recyclerView.setLayoutManager(getLayoutManager());
  RecyclerView.ItemAnimator itemAnimator=getItemAnimator();
  if (itemAnimator != null) {
    recyclerView.setItemAnimator(itemAnimator);
  }
  addItemDecorations(recyclerView);
  if (empty != null) {
    if (emptyText != null) {
      empty.setText(emptyText);
    }
    if (adapter != null && adapter.getItemCount() > 0) {
      empty.setVisibility(View.GONE);
      recyclerView.setVisibility(View.VISIBLE);
    }
 else {
      empty.setVisibility(View.VISIBLE);
      recyclerView.setVisibility(View.GONE);
    }
  }
  if (adapter != null) {
    recyclerView.setAdapter(adapter);
  }
  view.addOnLayoutChangeListener(new View.OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      v.removeOnLayoutChangeListener(this);
      if (adapter == null) {
        listContainer.setVisibility(View.GONE);
        progressContainer.setVisibility(View.VISIBLE);
        currentState=STATE_PROGRESS_VISIBLE;
      }
 else {
        currentState=STATE_CONTENT_VISIBLE;
        listContainer.setVisibility(View.VISIBLE);
        progressContainer.setVisibility(View.GONE);
      }
    }
  }
);
}

Fixed version (ground truth):
public void onViewCreated(View view,Bundle inState){
  super.onViewCreated(view,inState);
  recyclerView.setLayoutManager(getLayoutManager());
  RecyclerView.ItemAnimator itemAnimator=getItemAnimator();
  if (itemAnimator != null) {
    recyclerView.setItemAnimator(itemAnimator);
  }
  addItemDecorations(recyclerView);
  if (empty != null) {
    if (emptyText != null) {
      empty.setText(emptyText);
    }
    if (adapter != null && adapter.getItemCount() > 0) {
      empty.setVisibility(View.GONE);
      recyclerView.setVisibility(View.VISIBLE);
    }
 else {
      empty.setVisibility(View.VISIBLE);
      recyclerView.setVisibility(View.GONE);
    }
  }
  if (adapter != null) {
    recyclerView.setAdapter(adapter);
  }
  if (adapter == null) {
    listContainer.setVisibility(View.GONE);
    progressContainer.setVisibility(View.VISIBLE);
    currentState=STATE_PROGRESS_VISIBLE;
  }
 else {
    currentState=STATE_CONTENT_VISIBLE;
    listContainer.setVisibility(View.VISIBLE);
    progressContainer.setVisibility(View.GONE);
  }
}
Program: 56441
Project: 56441
Buggy source:
@Override protected Result doInBackground(String... params){
  String code=params[0];
  try {
    final AccessToken token=authorizationService.getToken(new TokenRequest(code,BuildConfig.TRAKT_CLIENT_ID,BuildConfig.TRAKT_SECRET,BuildConfig.TRAKT_REDIRECT_URL,GrantType.AUTHORIZATION_CODE));
    final String accessToken=token.getAccessToken();
    final SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(context);
    settings.edit().putString(Settings.TRAKT_TOKEN,accessToken).apply();
    userToken.setToken(accessToken);
    final UserSettings userSettings=usersService.getUserSettings();
    Settings.clearProfile(context);
    Settings.updateProfile(context,userSettings);
    return new Result(accessToken);
  }
 catch (  RetrofitError e) {
switch (e.getKind()) {
case NETWORK:
      return new Result(R.string.error_network);
case HTTP:
    Response response=e.getResponse();
  if (response != null) {
    int status=response.getStatus();
    if (status >= 500 && status < 600) {
      return new Result(R.string.login_error_5xx);
    }
  }
case CONVERSION:
case UNEXPECTED:
}
Timber.e(e,"String_Node_Str");
return new Result(R.string.login_error_unknown);
}
}

Fixed version (ground truth):
@Override protected Result doInBackground(String... params){
  String code=params[0];
  try {
    final AccessToken token=authorizationService.getToken(new TokenRequest(code,BuildConfig.TRAKT_CLIENT_ID,BuildConfig.TRAKT_SECRET,BuildConfig.TRAKT_REDIRECT_URL,GrantType.AUTHORIZATION_CODE));
    final String accessToken=token.getAccessToken();
    final SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(context);
    settings.edit().putString(Settings.TRAKT_TOKEN,accessToken).apply();
    userToken.setToken(accessToken);
    final UserSettings userSettings=usersService.getUserSettings();
    Settings.clearProfile(context);
    Settings.updateProfile(context,userSettings);
    return new Result(accessToken);
  }
 catch (  RetrofitError e) {
switch (e.getKind()) {
case NETWORK:
      return new Result(R.string.login_error_network);
case HTTP:
    Response response=e.getResponse();
  if (response != null) {
    int status=response.getStatus();
    if (status >= 500 && status < 600) {
      return new Result(R.string.login_error_5xx);
    }
  }
case CONVERSION:
case UNEXPECTED:
}
Timber.e(e,"String_Node_Str");
return new Result(R.string.login_error_unknown);
}
}
Program: 56443
Project: 56443
Buggy source:
@Override public void onChanged(){
  dataChanged=true;
  oldItemCount=itemCount;
  itemCount=adapter.getCount();
  recycler.clearTransientViews();
  if (!hasStableIds) {
    layoutRecords.clear();
    recycleAllViews();
    final int colCount=StaggeredGridView.this.colCount;
    for (int i=0; i < colCount; i++) {
      itemBottoms[i]=itemTops[i];
    }
  }
  if (firstPosition >= itemCount) {
    firstPosition=Math.max(Math.min(firstPosition,itemCount - 1),0);
  }
  for (int i=getChildCount() - 1; i >= 1; i--) {
    final View child=getChildAt(i);
    LayoutParams lp=(LayoutParams)child.getLayoutParams();
    removeViewAt(i);
    layoutRecords.removeAt(lp.position);
    recycler.addScrap(child);
  }
  requestLayout();
  updateEmptyState();
}

Fixed version (ground truth):
@Override public void onChanged(){
  dataChanged=true;
  oldItemCount=itemCount;
  itemCount=adapter.getCount();
  recycler.clearTransientViews();
  if (!hasStableIds) {
    layoutRecords.clear();
    recycleAllViews();
    final int colCount=StaggeredGridView.this.colCount;
    for (int i=0; i < colCount; i++) {
      itemBottoms[i]=itemTops[i];
    }
  }
  if (firstPosition >= itemCount) {
    firstPosition=Math.max(Math.min(firstPosition,itemCount - 1),0);
  }
  for (int i=getChildCount() - 1; i >= 1; i--) {
    final View child=getChildAt(i);
    LayoutParams lp=(LayoutParams)child.getLayoutParams();
    removeViewAt(i);
    layoutRecords.remove(lp.position);
    recycler.addScrap(child);
  }
  requestLayout();
  updateEmptyState();
}
Program: 56444
Project: 56444
Buggy source:
private void bindCollection(Context context,ViewHolder vh,Cursor cursor){
  final int airdateCount=cursor.getInt(cursor.getColumnIndexOrThrow(CathodeContract.Seasons.AIRDATE_COUNT));
  final int unairedCount=cursor.getInt(cursor.getColumnIndexOrThrow(CathodeContract.Seasons.UNAIRED_COUNT));
  final int collectedCount=cursor.getInt(cursor.getColumnIndexOrThrow(CathodeContract.Seasons.IN_COLLECTION_COUNT));
  final int toCollect=airdateCount - unairedCount - collectedCount;
  vh.progress.setMax(airdateCount);
  vh.progress.setProgress(collectedCount);
  final String unwatched=resources.getQuantityString(R.plurals.x_uncollected,toCollect,toCollect);
  vh.summary.setText(unwatched);
}

Fixed version (ground truth):
private void bindCollection(Context context,ViewHolder vh,Cursor cursor){
  final int airdateCount=cursor.getInt(cursor.getColumnIndexOrThrow(CathodeContract.Seasons.AIRDATE_COUNT));
  final int unairedCount=cursor.getInt(cursor.getColumnIndexOrThrow(CathodeContract.Seasons.UNAIRED_COUNT));
  final int collectedCount=cursor.getInt(cursor.getColumnIndexOrThrow(CathodeContract.Seasons.IN_COLLECTION_COUNT));
  int toCollect=airdateCount - unairedCount - collectedCount;
  toCollect=Math.max(toCollect,0);
  vh.progress.setMax(airdateCount);
  vh.progress.setProgress(collectedCount);
  String uncollected;
  if (toCollect == 0) {
    uncollected=resources.getString(R.string.all_collected);
  }
 else {
    uncollected=resources.getString(R.string.x_uncollected,toCollect);
  }
  vh.summary.setText(uncollected);
}
Program: 56447
Project: 56447
Buggy source:
@Override protected void onCreate(Bundle inState){
  super.onCreate(inState);
  setContentView(R.layout.ui_content_view);
  messageBar=new MessageBar(this);
  if (!CathodeApp.accountExists(this) || isLoginAction(getIntent())) {
    Bundle loginState=inState != null ? inState.getBundle(STATE_LOGIN_CONTROLLER) : null;
    loginController=LoginController.newInstance(this);
    loginController.onCreate(loginState);
    activeController=loginController;
  }
 else {
    queue.add(new SyncUserActivityTask());
    Bundle uiState=inState != null ? inState.getBundle(STATE_UICONTROLLER) : null;
    uiController=PhoneController.newInstance(this);
    uiController.onCreate(uiState);
    activeController=uiController;
  }
  activeController.onAttach();
  syncHandler=new Handler();
  if (inState != null) {
    lastSync=inState.getLong(STATE_LAST_SYNC);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle inState){
  super.onCreate(inState);
  setContentView(R.layout.ui_content_view);
  messageBar=new MessageBar(this);
  if (!CathodeApp.accountExists(this) || isLoginAction(getIntent())) {
    Bundle loginState=inState != null ? inState.getBundle(STATE_LOGIN_CONTROLLER) : null;
    loginController=LoginController.newInstance(this);
    loginController.onCreate(loginState);
    activeController=loginController;
  }
 else {
    Bundle uiState=inState != null ? inState.getBundle(STATE_UICONTROLLER) : null;
    uiController=PhoneController.newInstance(this);
    uiController.onCreate(uiState);
    activeController=uiController;
  }
  activeController.onAttach();
  syncHandler=new Handler();
  if (inState != null) {
    lastSync=inState.getLong(STATE_LAST_SYNC);
  }
}
Program: 56448
Project: 56448
Buggy source:
@Override protected void onResume(){
  super.onResume();
  bus.register(this);
  if (uiController != null) {
    if (lastSync + SYNC_DELAY < System.currentTimeMillis()) {
      queue.add(new SyncUserActivityTask());
    }
    syncHandler.postDelayed(syncRunnable,SYNC_DELAY);
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  bus.register(this);
  if (uiController != null) {
    if (lastSync + SYNC_DELAY < System.currentTimeMillis()) {
      syncRunnable.run();
    }
 else {
      syncHandler.postDelayed(syncRunnable,SYNC_DELAY);
    }
  }
}
Program: 56449
Project: 56449
Buggy source:
private void readConfig(){
  try {
    LookupOperationContext lookupContext=new LookupOperationContext(directory.getAdminSession(),directory.getDnFactory().create("String_Node_Str"),SchemaConstants.ALL_USER_ATTRIBUTES,SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES);
    Entry config=directory.getPartitionNexus().lookup(lookupContext);
    if (config.get("String_Node_Str") != null) {
      accessKey=config.get("String_Node_Str").getString();
    }
    if (config.get("String_Node_Str") != null) {
      secretKey=config.get("String_Node_Str").getString();
    }
    if (config.get("String_Node_Str") != null) {
      rootDN=config.get("String_Node_Str").getString();
    }
    groupsDN="String_Node_Str" + rootDN;
    usersDN="String_Node_Str" + rootDN;
    rolesDN="String_Node_Str" + rootDN;
    GROUP_FMT="String_Node_Str" + groupsDN;
    USER_FMT="String_Node_Str" + usersDN;
    ROLE_FMT="String_Node_Str" + rootDN;
    ensureRootDN();
    if (config.get("String_Node_Str") != null) {
      pollPeriod=Integer.parseInt(config.get("String_Node_Str").getString());
    }
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void readConfig(){
  try {
    LookupOperationContext lookupContext=new LookupOperationContext(directory.getAdminSession(),directory.getDnFactory().create("String_Node_Str"),SchemaConstants.ALL_USER_ATTRIBUTES,SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES);
    Entry config=directory.getPartitionNexus().lookup(lookupContext);
    if (config.get("String_Node_Str") != null) {
      accessKey=config.get("String_Node_Str").getString();
    }
    if (config.get("String_Node_Str") != null) {
      secretKey=config.get("String_Node_Str").getString();
    }
    if (config.get("String_Node_Str") != null) {
      rootDN=config.get("String_Node_Str").getString();
    }
    groupsDN="String_Node_Str" + rootDN;
    usersDN="String_Node_Str" + rootDN;
    rolesDN="String_Node_Str" + rootDN;
    GROUP_FMT="String_Node_Str" + groupsDN;
    USER_FMT="String_Node_Str" + usersDN;
    ROLE_FMT="String_Node_Str" + rootDN;
    ensureDNs();
    if (config.get("String_Node_Str") != null) {
      pollPeriod=Integer.parseInt(config.get("String_Node_Str").getString());
    }
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
}
Program: 56450
Project: 56450
Buggy source:
private void pollIAM(){
  LOG.info("String_Node_Str");
  try {
    populateGroupsFromIAM();
    populateUsersFromIAM();
    populateRolesFromIAM();
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
private void pollIAM(){
  LOG.info("String_Node_Str");
  try {
    clearDNs();
    populateGroupsFromIAM();
    populateUsersFromIAM();
    populateRolesFromIAM();
  }
 catch (  Throwable e) {
    LOG.error("String_Node_Str",e);
  }
  LOG.info("String_Node_Str");
}
Program: 56451
Project: 56451
Buggy source:
private String getNextID(AmazonDynamoDBClient client){
  Map<String,AttributeValue> item=new HashMap<String,AttributeValue>();
  item.put("String_Node_Str",new AttributeValue().withS("String_Node_Str"));
  item.put("String_Node_Str",new AttributeValue().withN("String_Node_Str"));
  try {
    client.putItem(new PutItemRequest().withTableName(table).withItem(item).withExpected(Collections.singletonMap("String_Node_Str",new ExpectedAttributeValue(false))));
    return "String_Node_Str";
  }
 catch (  ConditionalCheckFailedException e) {
    UpdateItemResult updated=client.updateItem(new UpdateItemRequest().withTableName(table).withKey(new Key(new AttributeValue("String_Node_Str"))).withAttributeUpdates(Collections.singletonMap("String_Node_Str",new AttributeValueUpdate(new AttributeValue().withN("String_Node_Str"),AttributeAction.ADD))).withReturnValues(ReturnValue.UPDATED_NEW));
    return updated.getAttributes().get("String_Node_Str").getN();
  }
}

Fixed version (ground truth):
private String getNextID(AmazonDynamoDBClient client){
  UpdateItemResult updated=client.updateItem(new UpdateItemRequest().withTableName("String_Node_Str").withKey(new Key(new AttributeValue("String_Node_Str"))).withAttributeUpdates(Collections.singletonMap("String_Node_Str",new AttributeValueUpdate(new AttributeValue().withN("String_Node_Str"),AttributeAction.ADD))).withReturnValues(ReturnValue.UPDATED_NEW));
  return String.valueOf(1000 + Integer.parseInt(updated.getAttributes().get("String_Node_Str").getN()));
}
Program: 56452
Project: 56452
Buggy source:
@After public void tearDown() throws Exception {
  Setup.popZssLocale();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  ExecutionsCtrl.setCurrent(null);
  Setup.popZssLocale();
}
Program: 56453
Project: 56453
Buggy source:
@Before public void startUp() throws Exception {
  Setup.pushZssLocale(Locale.TAIWAN);
}

Fixed version (ground truth):
@Before public void startUp() throws Exception {
  Setup.pushZssLocale(Locale.TAIWAN);
  final TemporaryExecution de=new TemporaryExecution();
  ExecutionsCtrl.setCurrent(de);
}
Program: 56455
Project: 56455
Buggy source:
@Test public void testZSS696CopyValidation(){
  Object[] books=_loadBooks(null,"String_Node_Str");
  Book book=(Book)books[0];
  Sheet sheet=book.getSheet("String_Node_Str");
  SSheet ssheet=sheet.getInternalSheet();
  SDataValidation d1dv=ssheet.getDataValidation(0,3);
  Set<CellRegion> d1regions=d1dv.getRegions();
  Assert.assertEquals("String_Node_Str",1,d1regions.size());
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Range e1=Ranges.range(sheet,"String_Node_Str");
  e1.paste(Ranges.range(sheet,"String_Node_Str"));
  d1regions=d1dv.getRegions();
  Assert.assertEquals("String_Node_Str",1,d1regions.size());
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertTrue("String_Node_Str",Ranges.range(sheet,"String_Node_Str").isMergedCell());
  e1.paste(Ranges.range(sheet,"String_Node_Str"),true);
  d1regions=d1dv.getRegions();
  Assert.assertEquals("String_Node_Str",3,d1regions.size());
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertFalse("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertTrue("String_Node_Str",!Ranges.range(sheet,"String_Node_Str").isMergedCell());
}

Fixed version (ground truth):
@Test public void testZSS696CopyValidation(){
  Object[] books=_loadBooks(this,"String_Node_Str");
  Book book=(Book)books[0];
  Sheet sheet=book.getSheet("String_Node_Str");
  SSheet ssheet=sheet.getInternalSheet();
  SDataValidation d1dv=ssheet.getDataValidation(0,3);
  Set<CellRegion> d1regions=d1dv.getRegions();
  Assert.assertEquals("String_Node_Str",1,d1regions.size());
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Range e1=Ranges.range(sheet,"String_Node_Str");
  e1.paste(Ranges.range(sheet,"String_Node_Str"));
  d1regions=d1dv.getRegions();
  Assert.assertEquals("String_Node_Str",1,d1regions.size());
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertTrue("String_Node_Str",Ranges.range(sheet,"String_Node_Str").isMergedCell());
  e1.paste(Ranges.range(sheet,"String_Node_Str"),true);
  d1regions=d1dv.getRegions();
  Assert.assertEquals("String_Node_Str",3,d1regions.size());
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertFalse("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertTrue("String_Node_Str",d1regions.contains(new CellRegion("String_Node_Str")));
  Assert.assertTrue("String_Node_Str",!Ranges.range(sheet,"String_Node_Str").isMergedCell());
}
Program: 56456
Project: 56456
Buggy source:
@Test public void testZSS693SortFormulaCells(){
  Object[] books=_loadBooks(null,"String_Node_Str");
  Book book=(Book)books[0];
  Sheet sheet=book.getSheet("String_Node_Str");
  Range c1_10=Ranges.range(sheet,"String_Node_Str");
  c1_10.sort(false);
  for (int r=0; r < 10; ++r) {
    Object cv=Ranges.range(sheet,r,2).getCellValue();
    Object ev=Ranges.range(sheet,r,4).getCellValue();
    Assert.assertEquals("String_Node_Str" + (r + 1) + "String_Node_Str"+ (r + 1),ev,cv);
  }
}

Fixed version (ground truth):
@Test public void testZSS693SortFormulaCells(){
  Object[] books=_loadBooks(this,"String_Node_Str");
  Book book=(Book)books[0];
  Sheet sheet=book.getSheet("String_Node_Str");
  Range c1_10=Ranges.range(sheet,"String_Node_Str");
  c1_10.sort(false);
  for (int r=0; r < 10; ++r) {
    Object cv=Ranges.range(sheet,r,2).getCellValue();
    Object ev=Ranges.range(sheet,r,4).getCellValue();
    Assert.assertEquals("String_Node_Str" + (r + 1) + "String_Node_Str"+ (r + 1),ev,cv);
  }
}
Program: 56458
Project: 56458
Buggy source:
public SName getNameByName(String namename,String sheetName){
  if (_names == null)   return null;
  for (  SName name : _names) {
    if ((sheetName == null || sheetName.equalsIgnoreCase(name.getApplyToSheetName())) && name.getName().equalsIgnoreCase(namename)) {
      return name;
    }
  }
  return null;
}

Fixed version (ground truth):
public SName getNameByName(String namename,String sheetName){
  if (_names == null)   return null;
  for (  SName name : _names) {
    final String scopeSheetName=name.getApplyToSheetName();
    if ((sheetName == scopeSheetName || (sheetName != null && sheetName.equalsIgnoreCase(scopeSheetName))) && name.getName().equalsIgnoreCase(namename)) {
      return name;
    }
  }
  return null;
}
Program: 56459
Project: 56459
Buggy source:
@Override public void setFormula2(String formula2){
  checkOrphan();
  _evaluated=false;
  clearFormulaDependency(false);
  clearFormulaResultCache();
  FormulaEngine fe=EngineFactory.getInstance().createFormulaEngine();
  Ref ref=getRef();
  if (formula2 != null) {
    _formula1Expr=fe.parse(formula2,new FormulaParseContext(_sheet,ref));
  }
 else {
    _formula1Expr=null;
  }
}

Fixed version (ground truth):
@Override public void setFormula2(String formula2){
  checkOrphan();
  _evaluated=false;
  clearFormulaDependency(false);
  clearFormulaResultCache();
  FormulaEngine fe=EngineFactory.getInstance().createFormulaEngine();
  Ref ref=getRef();
  if (formula2 != null) {
    _formula2Expr=fe.parse(formula2,new FormulaParseContext(_sheet,ref));
  }
 else {
    _formula2Expr=null;
  }
}
Program: 56460
Project: 56460
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public void clearCache(FormulaClearContext context){
  try {
    SBook book=context.getBook();
    SSheet sheet=context.getSheet();
    SCell cell=context.getCell();
    AbstractBookSeriesAdv bookSeries=(AbstractBookSeriesAdv)book.getBookSeries();
    Map<String,EvalContext> map=(Map<String,EvalContext>)bookSeries.getAttribute(KEY_EVALUATORS);
    if (map == null) {
      return;
    }
    if (cell != null && !cell.isNull()) {
      EvalContext ctx=map.get(book.getBookName());
      if (ctx == null) {
        _logger.warning("String_Node_Str" + book.getBookName());
        return;
      }
      String sheetName=sheet.getSheetName();
      EvalBook evalBook=ctx.getBook();
      EvaluationSheet evalSheet=evalBook.getSheet(evalBook.getSheetIndex(sheetName));
      EvaluationCell evalCell=evalSheet.getCell(cell.getRowIndex(),cell.getColumnIndex());
      WorkbookEvaluator evaluator=ctx.getEvaluator();
      evaluator.notifyUpdateCell(evalCell);
    }
 else {
      bookSeries.setAttribute(KEY_EVALUATORS,null);
      map.clear();
    }
  }
 catch (  Exception e) {
    _logger.error(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public void clearCache(FormulaClearContext context){
  try {
    SBook book=context.getBook();
    SSheet sheet=context.getSheet();
    SCell cell=context.getCell();
    AbstractBookSeriesAdv bookSeries=(AbstractBookSeriesAdv)book.getBookSeries();
    NonSerializableHolder<Map<String,EvalContext>> holder=(NonSerializableHolder<Map<String,EvalContext>>)bookSeries.getAttribute(KEY_EVALUATORS);
    Map<String,EvalContext> map=holder == null ? null : holder.getObject();
    if (map == null) {
      return;
    }
    if (cell != null && !cell.isNull()) {
      EvalContext ctx=map.get(book.getBookName());
      if (ctx == null) {
        _logger.warning("String_Node_Str" + book.getBookName());
        return;
      }
      String sheetName=sheet.getSheetName();
      EvalBook evalBook=ctx.getBook();
      EvaluationSheet evalSheet=evalBook.getSheet(evalBook.getSheetIndex(sheetName));
      EvaluationCell evalCell=evalSheet.getCell(cell.getRowIndex(),cell.getColumnIndex());
      WorkbookEvaluator evaluator=ctx.getEvaluator();
      evaluator.notifyUpdateCell(evalCell);
    }
 else {
      bookSeries.setAttribute(KEY_EVALUATORS,null);
      map.clear();
    }
  }
 catch (  Exception e) {
    _logger.error(e.getMessage(),e);
  }
}
Program: 56465
Project: 56465
Buggy source:
public void setCategoriesFormula(String expr){
  checkOrphan();
  evaluated=false;
  clearFormulaDependency();
  FormulaEngine fe=EngineFactory.getInstance().createFormulaEngine();
  catFormula=fe.parse(expr,new FormulaParseContext(chart.getSheet(),getRef()));
}

Fixed version (ground truth):
public void setCategoriesFormula(String expr){
  checkOrphan();
  evaluated=false;
  clearFormulaDependency();
  if (expr != null) {
    FormulaEngine fe=EngineFactory.getInstance().createFormulaEngine();
    catFormula=fe.parse(expr,new FormulaParseContext(chart.getSheet(),getRef()));
  }
 else {
    catFormula=null;
  }
}
Program: 56466
Project: 56466
Buggy source:
/** 
 * reference ChartHelper.prepareValues()
 * @param dataSource
 * @return
 */
private String getValueFormula(ChartDataSource<?> dataSource){
  if (dataSource.isReference()) {
    return dataSource.getFormulaString();
  }
 else {
    StringBuilder expression=new StringBuilder("String_Node_Str");
    int count=dataSource.getPointCount();
    for (int i=0; i < count; ++i) {
      Object value=dataSource.getPointAt(i);
      if (value == null) {
        if (dataSource.isNumeric()) {
          expression.append("String_Node_Str");
        }
 else {
          expression.append("String_Node_Str");
        }
      }
 else {
        if (dataSource.isNumeric()) {
          expression.append(value.toString());
        }
 else {
          expression.append("String_Node_Str").append(value).append("String_Node_Str");
        }
      }
      if (i != count - 1) {
        expression.append("String_Node_Str");
      }
    }
    expression.append("String_Node_Str");
    return expression.toString();
  }
}

Fixed version (ground truth):
/** 
 * reference ChartHelper.prepareValues()
 * @param dataSource
 * @return
 */
private String getValueFormula(ChartDataSource<?> dataSource){
  if (dataSource.isReference()) {
    return dataSource.getFormulaString();
  }
 else {
    int count=dataSource.getPointCount();
    if (count <= 0) {
      return null;
    }
    StringBuilder expression=new StringBuilder("String_Node_Str");
    for (int i=0; i < count; ++i) {
      Object value=dataSource.getPointAt(i);
      if (value == null) {
        if (dataSource.isNumeric()) {
          expression.append("String_Node_Str");
        }
 else {
          expression.append("String_Node_Str");
        }
      }
 else {
        if (dataSource.isNumeric()) {
          expression.append(value.toString());
        }
 else {
          expression.append("String_Node_Str").append(value).append("String_Node_Str");
        }
      }
      if (i != count - 1) {
        expression.append("String_Node_Str");
      }
    }
    expression.append("String_Node_Str");
    return expression.toString();
  }
}
Program: 56467
Project: 56467
Buggy source:
@Override public void setFormulaValue(String formula){
  checkOrphan();
  Validations.argNotNull(formula);
  FormulaEngine fe=EngineFactory.getInstance().createFormulaEngine();
  FormulaExpression expr=fe.parse(formula,new FormulaParseContext(this,null));
  if (expr.hasError()) {
    String msg=expr.getErrorMessage();
    throw new InvalidateFormulaException(msg == null ? "String_Node_Str" : msg);
  }
  if (getType() == CellType.FORMULA) {
    clearValueForSet(true);
  }
  expr=fe.parse(formula,new FormulaParseContext(this,getRef()));
  setValue(expr);
}

Fixed version (ground truth):
@Override public void setFormulaValue(String formula){
  checkOrphan();
  Validations.argNotNull(formula);
  FormulaEngine fe=EngineFactory.getInstance().createFormulaEngine();
  FormulaExpression expr=fe.parse(formula,new FormulaParseContext(this,null));
  if (expr.hasError()) {
    String msg=expr.getErrorMessage();
    throw new InvalidateFormulaException(msg == null ? "String_Node_Str" + formula + "String_Node_Str" : msg);
  }
  if (getType() == CellType.FORMULA) {
    clearValueForSet(true);
  }
  expr=fe.parse(formula,new FormulaParseContext(this,getRef()));
  setValue(expr);
}
Program: 56468
Project: 56468
Buggy source:
/** 
 * reference ChartHelper.prepareValues()
 * @param dataSource
 * @return
 */
private String getValueFormula(ChartDataSource<?> dataSource){
  if (dataSource.isReference()) {
    return dataSource.getFormulaString();
  }
 else {
    StringBuilder expression=new StringBuilder("String_Node_Str");
    int count=dataSource.getPointCount();
    for (int i=0; i < count; ++i) {
      Object value=dataSource.getPointAt(i);
      if (value == null) {
        if (dataSource.isNumeric()) {
          expression.append("String_Node_Str");
        }
 else {
          expression.append("String_Node_Str");
        }
      }
 else {
        expression.append(value.toString());
      }
      if (i != count - 1) {
        expression.append("String_Node_Str");
      }
    }
    expression.append("String_Node_Str");
    return expression.toString();
  }
}

Fixed version (ground truth):
/** 
 * reference ChartHelper.prepareValues()
 * @param dataSource
 * @return
 */
private String getValueFormula(ChartDataSource<?> dataSource){
  if (dataSource.isReference()) {
    return dataSource.getFormulaString();
  }
 else {
    StringBuilder expression=new StringBuilder("String_Node_Str");
    int count=dataSource.getPointCount();
    for (int i=0; i < count; ++i) {
      Object value=dataSource.getPointAt(i);
      if (value == null) {
        if (dataSource.isNumeric()) {
          expression.append("String_Node_Str");
        }
 else {
          expression.append("String_Node_Str");
        }
      }
 else {
        if (dataSource.isNumeric()) {
          expression.append(value.toString());
        }
 else {
          expression.append("String_Node_Str").append(value).append("String_Node_Str");
        }
      }
      if (i != count - 1) {
        expression.append("String_Node_Str");
      }
    }
    expression.append("String_Node_Str");
    return expression.toString();
  }
}
Program: 56469
Project: 56469
Buggy source:
public static Book loadBook(Object base,String respath){
  if (base == null) {
    base=Util.class;
  }
  if (!(base instanceof Class)) {
    base=base.getClass();
  }
  final InputStream is=((Class)base).getResourceAsStream(respath);
  try {
    return Importers.getImporter().imports(is,respath);
  }
 catch (  IOException e) {
    throw new RuntimeException(e.getMessage(),e);
  }
 finally {
    if (is != null) {
      try {
        is.close();
      }
 catch (      IOException e) {
      }
    }
  }
}

Fixed version (ground truth):
public static Book loadBook(Object base,String respath){
  if (base == null) {
    base=Util.class;
  }
  if (!(base instanceof Class)) {
    base=base.getClass();
  }
  final InputStream is=((Class)base).getResourceAsStream(respath);
  try {
    int index=respath.lastIndexOf("String_Node_Str");
    String bookName=index == -1 ? respath : respath.substring(index + 1);
    return Importers.getImporter().imports(is,bookName);
  }
 catch (  IOException e) {
    throw new RuntimeException(e.getMessage(),e);
  }
 finally {
    if (is != null) {
      try {
        is.close();
      }
 catch (      IOException e) {
      }
    }
  }
}
Program: 56470
Project: 56470
Buggy source:
protected void checkFormulaResultType(CellType... types){
  if (!getType().equals(CellType.FORMULA)) {
    throw new IllegalStateException("String_Node_Str" + getType() + "String_Node_Str"+ types);
  }
  Set<CellType> set=new LinkedHashSet<CellType>();
  for (  CellType t : types) {
    set.add(t);
  }
  if (!set.contains(getFormulaResultType())) {
    throw new IllegalStateException("String_Node_Str" + getFormulaResultType() + "String_Node_Str"+ types);
  }
}

Fixed version (ground truth):
protected void checkFormulaResultType(CellType... types){
  if (!getType().equals(CellType.FORMULA)) {
    throw new IllegalStateException("String_Node_Str" + getType() + "String_Node_Str"+ types);
  }
  Set<CellType> set=new LinkedHashSet<CellType>();
  for (  CellType t : types) {
    set.add(t);
  }
  if (!set.contains(getFormulaResultType())) {
    throw new IllegalStateException("String_Node_Str" + getFormulaResultType() + "String_Node_Str"+ Arrays.asList(types));
  }
}
Program: 56471
Project: 56471
Buggy source:
@Override public void deleteChart(final NChart chart){
  new ReadWriteTask(){
    @Override public Object invoke(){
      getSheet().deleteChart(chart);
      new NotifyChangeHelper().notifySheetChartAdd(getSheet(),chart.getId());
      return null;
    }
  }
.doInWriteLock(getLock());
}

Fixed version (ground truth):
@Override public void deleteChart(final NChart chart){
  new ReadWriteTask(){
    @Override public Object invoke(){
      getSheet().deleteChart(chart);
      new NotifyChangeHelper().notifySheetChartDelete(getSheet(),chart.getId());
      return null;
    }
  }
.doInWriteLock(getLock());
}