nus-yam/ex-repair huggingface dataset:
Program: 94271
Project: 94271
Buggy source:
public static void getParcelable(Bundle savedInstanceState,Anthology anthology){
  if (savedInstanceState != null) {
    anthology=savedInstanceState.getParcelable(PARCELABLE_KEY);
  }
 else {
    throw new IllegalArgumentException(TAG + "String_Node_Str");
  }
}

Fixed version (ground truth):
public static Anthology getParcelable(Bundle savedInstanceState){
  if (savedInstanceState != null) {
    return savedInstanceState.getParcelable(PARCELABLE_KEY);
  }
 else {
    throw new IllegalArgumentException(TAG + "String_Node_Str");
  }
}
Program: 94272
Project: 94272
Buggy source:
public static void putParcelable(Bundle savedInstanceState,Anthology anthology){
  if (savedInstanceState != null && anthology != null) {
    savedInstanceState.putParcelable(PARCELABLE_KEY,anthology);
  }
 else {
    throw new IllegalArgumentException(TAG + "String_Node_Str");
  }
}

Fixed version (ground truth):
public static void putParcelable(Bundle savedInstanceState,Anthology anthology){
  if (savedInstanceState != null && anthology != null) {
    savedInstanceState.putParcelable(PARCELABLE_KEY,anthology);
  }
}
Program: 94273
Project: 94273
Buggy source:
public static void getParcelable(Bundle savedInstanceState,Story story){
  if (savedInstanceState != null) {
    story=savedInstanceState.getParcelable(PARCELABLE_KEY);
  }
 else {
    throw new IllegalArgumentException(TAG + "String_Node_Str");
  }
}

Fixed version (ground truth):
public static Story getParcelable(Bundle savedInstanceState){
  if (savedInstanceState != null) {
    return savedInstanceState.getParcelable(PARCELABLE_KEY);
  }
 else {
    throw new IllegalArgumentException(TAG + "String_Node_Str");
  }
}
Program: 94274
Project: 94274
Buggy source:
public static void putParcelable(Bundle savedInstanceState,Story story){
  if (savedInstanceState != null && story != null) {
    savedInstanceState.putParcelable(PARCELABLE_KEY,story);
  }
 else {
    throw new IllegalArgumentException(TAG + "String_Node_Str");
  }
}

Fixed version (ground truth):
public static void putParcelable(Bundle savedInstanceState,Story story){
  if (savedInstanceState != null && story != null) {
    savedInstanceState.putParcelable(PARCELABLE_KEY,story);
  }
}
Program: 94275
Project: 94275
Buggy source:
private void restoreInstanceState(Bundle savedInstanceState){
  Anthology.getParcelable(savedInstanceState,mHotAnthology);
  mHotAdapter=new HotAdapter(mHotView.getContext(),mHotAnthology.getStories());
  mHotView.setAdapterForRecyclerView(mHotAdapter);
}

Fixed version (ground truth):
private void restoreInstanceState(Bundle savedInstanceState){
  mHotAnthology=Anthology.getParcelable(savedInstanceState);
  mHotAdapter=new HotAdapter(mHotView.getContext(),mHotAnthology.getStories());
  mHotView.setAdapterForRecyclerView(mHotAdapter);
}
Program: 94276
Project: 94276
Buggy source:
private void pullHotAnthologyFromNetwork(){
  if (mGetHotAnthologySubscription != null) {
    mGetHotAnthologySubscription.unsubscribe();
    mGetHotAnthologySubscription=null;
  }
  mIsLoading=true;
  mGetHotAnthologyObservable=mGMHService.getHotAnthology(mHotAnthology.getNextPageUrl()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).doOnTerminate(new Action0(){
    @Override public void call(){
      mGetHotAnthologyObservable=null;
    }
  }
).cache();
  mGetHotAnthologySubscription=mGetHotAnthologyObservable.subscribe(mGetHotAnthologyObserver);
}

Fixed version (ground truth):
private void pullHotAnthologyFromNetwork(){
  if (mGetHotAnthologySubscription != null) {
    mGetHotAnthologySubscription.unsubscribe();
    mGetHotAnthologySubscription=null;
  }
  mIsLoading=true;
  mGetHotAnthologyObservable=mGMHService.getHotAnthology(mHotAnthology.getNextPageUrl()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).cache();
  mGetHotAnthologySubscription=mGetHotAnthologyObservable.subscribe(mGetHotAnthologyObserver);
}
Program: 94277
Project: 94277
Buggy source:
@Override public void onError(Throwable e){
  if (BuildConfig.DEBUG) {
    e.printStackTrace();
  }
  mIsLoading=false;
  mHotView.hideHotProgressBar();
  mHotView.hideHotSwipeRefreshLayout();
  if (mHotAdapter.getItemCount() == 0) {
    mHotView.showNetworkingErrorImageView();
  }
}

Fixed version (ground truth):
@Override public void onError(Throwable e){
  mGetHotAnthologyObservable=null;
  if (BuildConfig.DEBUG) {
    e.printStackTrace();
  }
  mIsLoading=false;
  mHotView.hideHotProgressBar();
  mHotView.hideHotSwipeRefreshLayout();
  if (mHotAdapter.getItemCount() == 0) {
    mHotView.showNetworkingErrorImageView();
  }
}
Program: 94278
Project: 94278
Buggy source:
@Override public void onCompleted(){
  if (mHotAdapter != null) {
    mHotAdapter.addStories(mHotAnthology.getStories());
  }
  mIsLoading=false;
  mHotView.hideHotProgressBar();
  mHotView.hideHotSwipeRefreshLayout();
  mHotView.hideNetworkingErrorImageView();
}

Fixed version (ground truth):
@Override public void onCompleted(){
  mGetHotAnthologyObservable=null;
  if (mHotAdapter != null) {
    mHotAdapter.addStories(mHotAnthology.getStories());
  }
  mIsLoading=false;
  mHotView.hideHotProgressBar();
  mHotView.hideHotSwipeRefreshLayout();
  mHotView.hideNetworkingErrorImageView();
}
Program: 94279
Project: 94279
Buggy source:
@Override public void onNext(Anthology anthology){
  mHotAnthology=anthology;
}

Fixed version (ground truth):
@Override public void onNext(Anthology anthology){
  mHotAnthology.setNextPageUrl(anthology.getNextPageUrl());
  mHotAnthology.getStories().addAll(anthology.getStories());
}
Program: 94280
Project: 94280
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  mHotView.initializeHotSwipeRefreshLayout();
  mHotView.initializeHotNetworkingErrorImageView();
  mHotView.initializeHotRecyclerView();
  mHotView.hideHotSwipeRefreshLayout();
  mHotView.showHotProgressBar();
  mHotView.hideNetworkingErrorImageView();
  if (savedInstanceState == null) {
    initializeInstanceState();
    pullHotAnthologyFromNetwork();
  }
 else {
    restoreInstanceState(savedInstanceState);
    pullHotAnthologyFromCache();
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  mHotView.initializeHotSwipeRefreshLayout();
  mHotView.initializeHotNetworkingErrorImageView();
  mHotView.initializeHotRecyclerView();
  mHotView.hideHotSwipeRefreshLayout();
  mHotView.hideNetworkingErrorImageView();
  if (savedInstanceState == null) {
    mHotView.showHotProgressBar();
    initializeInstanceState();
    pullHotAnthologyFromNetwork();
  }
 else {
    restoreInstanceState(savedInstanceState);
    pullHotAnthologyFromCache();
  }
}
Program: 94281
Project: 94281
Buggy source:
private void restoreInstanceState(Bundle savedInstanceState){
  Anthology.getParcelable(savedInstanceState,mTrendingAnthology);
  mTrendingAdapter=new TrendingAdapter(mTrendingAnthology.getStories());
  mTrendingView.setAdapterForRecyclerView(mTrendingAdapter);
}

Fixed version (ground truth):
private void restoreInstanceState(Bundle savedInstanceState){
  mTrendingAnthology=Anthology.getParcelable(savedInstanceState);
  mTrendingAdapter=new TrendingAdapter(mTrendingAnthology.getStories());
  mTrendingView.setAdapterForRecyclerView(mTrendingAdapter);
}
Program: 94282
Project: 94282
Buggy source:
private void pullTrendingAnthologyFromNetwork(){
  if (mGetTrendingAnthologySubscription != null) {
    mGetTrendingAnthologySubscription.unsubscribe();
    mGetTrendingAnthologySubscription=null;
  }
  mIsLoading=true;
  mGetTrendingAnthologyObservable=mGMHService.getTrendingAnthology(mTrendingAnthology.getNextPageUrl()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).doOnTerminate(new Action0(){
    @Override public void call(){
      mGetTrendingAnthologyObservable=null;
    }
  }
).cache();
  mGetTrendingAnthologySubscription=mGetTrendingAnthologyObservable.subscribe(mGetTrendingAnthologyObserver);
}

Fixed version (ground truth):
private void pullTrendingAnthologyFromNetwork(){
  if (mGetTrendingAnthologySubscription != null) {
    mGetTrendingAnthologySubscription.unsubscribe();
    mGetTrendingAnthologySubscription=null;
  }
  mIsLoading=true;
  mGetTrendingAnthologyObservable=mGMHService.getTrendingAnthology(mTrendingAnthology.getNextPageUrl()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).cache();
  mGetTrendingAnthologySubscription=mGetTrendingAnthologyObservable.subscribe(mGetTrendingAnthologyObserver);
}
Program: 94283
Project: 94283
Buggy source:
@Override public void onError(Throwable e){
  if (BuildConfig.DEBUG) {
    e.printStackTrace();
  }
  mIsLoading=false;
  mTrendingView.hideTrendingProgressBar();
  mTrendingView.hideTrendingSwipeRefreshLayout();
  if (mTrendingAdapter.getItemCount() == 0) {
    mTrendingView.showNetworkingErrorImageView();
  }
}

Fixed version (ground truth):
@Override public void onError(Throwable e){
  mGetTrendingAnthologyObservable=null;
  if (BuildConfig.DEBUG) {
    e.printStackTrace();
  }
  mIsLoading=false;
  mTrendingView.hideTrendingProgressBar();
  mTrendingView.hideTrendingSwipeRefreshLayout();
  if (mTrendingAdapter.getItemCount() == 0) {
    mTrendingView.showNetworkingErrorImageView();
  }
}
Program: 94284
Project: 94284
Buggy source:
@Override public void onCompleted(){
  if (mTrendingAdapter != null) {
    mTrendingAdapter.addStories(mTrendingAnthology.getStories());
  }
  mIsLoading=false;
  mTrendingView.hideTrendingProgressBar();
  mTrendingView.hideTrendingSwipeRefreshLayout();
  mTrendingView.hideNetworkingErrorImageView();
}

Fixed version (ground truth):
@Override public void onCompleted(){
  mGetTrendingAnthologyObservable=null;
  if (mTrendingAdapter != null) {
    mTrendingAdapter.addStories(mTrendingAnthology.getStories());
  }
  mIsLoading=false;
  mTrendingView.hideTrendingProgressBar();
  mTrendingView.hideTrendingSwipeRefreshLayout();
  mTrendingView.hideNetworkingErrorImageView();
}
Program: 94285
Project: 94285
Buggy source:
@Override public void onNext(Anthology anthology){
  mTrendingAnthology=anthology;
}

Fixed version (ground truth):
@Override public void onNext(Anthology anthology){
  mTrendingAnthology.setNextPageUrl(anthology.getNextPageUrl());
  mTrendingAnthology.getStories().addAll(anthology.getStories());
}
Program: 94286
Project: 94286
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  mTrendingView.initializeTrendingSwipeRefreshLayout();
  mTrendingView.initializeTrendingNetworkingErrorImageView();
  mTrendingView.initializeTrendingRecyclerView();
  mTrendingView.hideTrendingSwipeRefreshLayout();
  mTrendingView.showTrendingProgressBar();
  mTrendingView.hideNetworkingErrorImageView();
  if (savedInstanceState == null) {
    initializeInstanceState();
    pullTrendingAnthologyFromNetwork();
  }
 else {
    restoreInstanceState(savedInstanceState);
    pullTrendingAnthologyFromCache();
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  mTrendingView.initializeTrendingSwipeRefreshLayout();
  mTrendingView.initializeTrendingNetworkingErrorImageView();
  mTrendingView.initializeTrendingRecyclerView();
  mTrendingView.hideTrendingSwipeRefreshLayout();
  mTrendingView.hideNetworkingErrorImageView();
  if (savedInstanceState == null) {
    mTrendingView.showTrendingProgressBar();
    initializeInstanceState();
    pullTrendingAnthologyFromNetwork();
  }
 else {
    restoreInstanceState(savedInstanceState);
    pullTrendingAnthologyFromCache();
  }
}
Program: 94287
Project: 94287
Buggy source:
private void pullVoteStoryFromNetwork(){
  if (mGetVoteStorySubscription != null) {
    mGetVoteStorySubscription.unsubscribe();
    mGetVoteStorySubscription=null;
  }
  mGetVoteStoryObservable=mGMHService.getVoteStory(ApiModule.VOTE_URL).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).doOnTerminate(new Action0(){
    @Override public void call(){
      mGetVoteStoryObservable=null;
    }
  }
).cache();
  mGetVoteStorySubscription=mGetVoteStoryObservable.subscribe(mGetVoteStoryObserver);
}

Fixed version (ground truth):
private void pullVoteStoryFromNetwork(){
  if (mGetVoteStorySubscription != null) {
    mGetVoteStorySubscription.unsubscribe();
    mGetVoteStorySubscription=null;
  }
  mGetVoteStoryObservable=mGMHService.getVoteStory(ApiModule.VOTE_URL).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).cache();
  mGetVoteStorySubscription=mGetVoteStoryObservable.subscribe(mGetVoteStoryObserver);
}
Program: 94288
Project: 94288
Buggy source:
private void restoreInstanceState(Bundle savedInstanceState){
  Story.getParcelable(savedInstanceState,mVoteStory);
  if (mVoteStory != null) {
    mVoteView.setVoteImageView(mVoteStory.getImageUrl());
    mVoteView.setVoteFooterTextView(mVoteStory.getFooter());
    mVoteView.showVoteCardView();
  }
}

Fixed version (ground truth):
private void restoreInstanceState(Bundle savedInstanceState){
  mVoteStory=Story.getParcelable(savedInstanceState);
  if (mVoteStory != null) {
    mVoteView.setVoteImageView(mVoteStory.getImageUrl());
    mVoteView.setVoteFooterTextView(mVoteStory.getFooter());
    mVoteView.showVoteCardView();
  }
}
Program: 94289
Project: 94289
Buggy source:
@Override public void call(){
  mGetVoteStoryObservable=null;
}

Fixed version (ground truth):
@Override public void call(){
  mIsVoting=false;
}
Program: 94290
Project: 94290
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  mVoteView.initializeVoteSwipeRefreshLayout();
  mVoteView.initializeVoteNetworkingErrorImageView();
  mVoteView.hideVoteSwipeRefreshLayout();
  mVoteView.hideVoteCardView();
  mVoteView.showVoteProgressBar();
  mVoteView.hideNetworkingErrorImageView();
  if (savedInstanceState == null) {
    pullVoteStoryFromNetwork();
  }
 else {
    restoreInstanceState(savedInstanceState);
    pullVoteStoryFromCache();
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  mVoteView.initializeVoteSwipeRefreshLayout();
  mVoteView.initializeVoteNetworkingErrorImageView();
  mVoteView.hideVoteSwipeRefreshLayout();
  mVoteView.hideVoteCardView();
  mVoteView.hideNetworkingErrorImageView();
  if (savedInstanceState == null) {
    mVoteView.showVoteProgressBar();
    pullVoteStoryFromNetwork();
  }
 else {
    restoreInstanceState(savedInstanceState);
    pullVoteStoryFromCache();
  }
}
Program: 94291
Project: 94291
Buggy source:
public void addStories(List<Story> newStories){
  int currentSize=mStories.size();
  int amountInserted=newStories.size();
  mStories.addAll(newStories);
  notifyItemRangeChanged(currentSize,amountInserted);
}

Fixed version (ground truth):
public void addStories(List<Story> newStories){
  int currentSize=mStories.size();
  int amountInserted=newStories.size();
  mStories.addAll(newStories);
  notifyItemRangeInserted(currentSize,amountInserted);
}
Program: 94292
Project: 94292
Buggy source:
public void addStories(List<Story> newStories){
  int currentSize=mStories.size();
  int amountInserted=newStories.size();
  mStories.addAll(newStories);
  notifyItemRangeChanged(currentSize,amountInserted);
}

Fixed version (ground truth):
public void addStories(List<Story> newStories){
  int currentSize=mStories.size();
  int amountInserted=newStories.size();
  mStories.addAll(newStories);
  notifyItemRangeInserted(currentSize,amountInserted);
}
Program: 94293
Project: 94293
Buggy source:
@Override public void onCompleted(){
  mGetHotAnthologyObservable=null;
  if (mHotAdapter != null) {
    mHotAdapter.addStories(mHotAnthology.getStories());
  }
  mIsLoading=false;
  mHotView.hideHotProgressBar();
  mHotView.hideHotSwipeRefreshLayout();
  mHotView.hideNetworkingErrorImageView();
}

Fixed version (ground truth):
@Override public void onCompleted(){
  mGetHotAnthologyObservable=null;
  mIsLoading=false;
  mHotView.hideHotProgressBar();
  mHotView.hideHotSwipeRefreshLayout();
  mHotView.hideNetworkingErrorImageView();
}
Program: 94294
Project: 94294
Buggy source:
@Override public void onNext(Anthology anthology){
  mHotAnthology.setNextPageUrl(anthology.getNextPageUrl());
  mHotAnthology.getStories().addAll(anthology.getStories());
}

Fixed version (ground truth):
@Override public void onNext(Anthology anthology){
  mHotAnthology.setNextPageUrl(anthology.getNextPageUrl());
  mHotAnthology.getStories().addAll(anthology.getStories());
  if (mHotAdapter != null) {
    mHotAdapter.addStories(anthology.getStories());
  }
}
Program: 94295
Project: 94295
Buggy source:
@Override public void onCompleted(){
  mGetTrendingAnthologyObservable=null;
  if (mTrendingAdapter != null) {
    mTrendingAdapter.addStories(mTrendingAnthology.getStories());
  }
  mIsLoading=false;
  mTrendingView.hideTrendingProgressBar();
  mTrendingView.hideTrendingSwipeRefreshLayout();
  mTrendingView.hideNetworkingErrorImageView();
}

Fixed version (ground truth):
@Override public void onCompleted(){
  mGetTrendingAnthologyObservable=null;
  mIsLoading=false;
  mTrendingView.hideTrendingProgressBar();
  mTrendingView.hideTrendingSwipeRefreshLayout();
  mTrendingView.hideNetworkingErrorImageView();
}
Program: 94296
Project: 94296
Buggy source:
@Override public void onNext(Anthology anthology){
  mTrendingAnthology.setNextPageUrl(anthology.getNextPageUrl());
  mTrendingAnthology.getStories().addAll(anthology.getStories());
}

Fixed version (ground truth):
@Override public void onNext(Anthology anthology){
  mTrendingAnthology.setNextPageUrl(anthology.getNextPageUrl());
  mTrendingAnthology.getStories().addAll(anthology.getStories());
  if (mTrendingAdapter != null) {
    mTrendingAdapter.addStories(anthology.getStories());
  }
}
Program: 94297
Project: 94297
Buggy source:
private void pullHotAnthologyFromCache(){
  if (mGetHotAnthologySubscription != null) {
    mGetHotAnthologySubscription.unsubscribe();
    mGetHotAnthologySubscription=null;
  }
  if (mGetHotAnthologyObservable != null) {
    mGetHotAnthologySubscription=mGetHotAnthologyObservable.subscribe(mGetHotAnthologyObserver);
  }
}

Fixed version (ground truth):
private void pullHotAnthologyFromCache(){
  if (mGetHotAnthologySubscription != null) {
    mGetHotAnthologySubscription.unsubscribe();
    mGetHotAnthologySubscription=null;
  }
  if (mGetHotAnthologyObservable != null) {
    mIsLoading=true;
    mGetHotAnthologySubscription=mGetHotAnthologyObservable.subscribe(mGetHotAnthologyObserver);
  }
}
Program: 94298
Project: 94298
Buggy source:
@Override public void onNext(Anthology anthology){
  mHotAnthology.setNextPageUrl(anthology.getNextPageUrl());
  mHotAnthology.getStories().addAll(anthology.getStories());
  if (mHotAdapter != null) {
    mHotAdapter.addStories(anthology.getStories());
  }
}

Fixed version (ground truth):
@Override public void onNext(Anthology anthology){
  mHotAnthology.setNextPageUrl(anthology.getNextPageUrl());
  if (mHotAdapter != null) {
    mHotAdapter.addStories(anthology.getStories());
    mHotAnthology.setStories(mHotAdapter.getStories());
  }
}
Program: 94299
Project: 94299
Buggy source:
@Override public void onNext(Anthology anthology){
  mTrendingAnthology.setNextPageUrl(anthology.getNextPageUrl());
  mTrendingAnthology.getStories().addAll(anthology.getStories());
  if (mTrendingAdapter != null) {
    mTrendingAdapter.addStories(anthology.getStories());
  }
}

Fixed version (ground truth):
@Override public void onNext(Anthology anthology){
  mTrendingAnthology.setNextPageUrl(anthology.getNextPageUrl());
  if (mTrendingAdapter != null) {
    mTrendingAdapter.addStories(anthology.getStories());
    mTrendingAnthology.setStories(mTrendingAdapter.getStories());
  }
}
Program: 94300
Project: 94300
Buggy source:
private void pullTrendingAnthologyFromCache(){
  if (mGetTrendingAnthologySubscription != null) {
    mGetTrendingAnthologySubscription.unsubscribe();
    mGetTrendingAnthologySubscription=null;
  }
  if (mGetTrendingAnthologyObservable != null) {
    mGetTrendingAnthologySubscription=mGetTrendingAnthologyObservable.subscribe(mGetTrendingAnthologyObserver);
  }
}

Fixed version (ground truth):
private void pullTrendingAnthologyFromCache(){
  if (mGetTrendingAnthologySubscription != null) {
    mGetTrendingAnthologySubscription.unsubscribe();
    mGetTrendingAnthologySubscription=null;
  }
  if (mGetTrendingAnthologyObservable != null) {
    mIsLoading=true;
    mGetTrendingAnthologySubscription=mGetTrendingAnthologyObservable.subscribe(mGetTrendingAnthologyObserver);
  }
}
Program: 94301
Project: 94301
Buggy source:
private static final String truncate(final Object o,final int w){
  final String value=String.valueOf(o);
  return value.length() > w ? value.substring(0,w - 3) + ELLIPSES : value;
}

Fixed version (ground truth):
private static final String truncate(final Object o,final int w){
  final String value=String.valueOf(o);
  return value.length() - ELLIPSES.length() > w ? value.substring(0,w - ELLIPSES.length()) + ELLIPSES : value;
}
Program: 94302
Project: 94302
Buggy source:
public static BitSet nonnumeric(final DataFrame<?> df){
  final BitSet nonnumeric=numeric(df);
  nonnumeric.flip(0,nonnumeric.length());
  return nonnumeric;
}

Fixed version (ground truth):
public static BitSet nonnumeric(final DataFrame<?> df){
  final BitSet nonnumeric=numeric(df);
  nonnumeric.flip(0,df.size());
  return nonnumeric;
}
Program: 94303
Project: 94303
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str");
  }
  mBinder=new DMBinder();
  if (mManager == null) {
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str");
    }
    mManager=new DownloadManager(this,"String_Node_Str");
  }
  Intent i=new Intent();
  i.setAction(Intent.ACTION_MAIN);
  i.setClass(this,MainActivity.class);
  mNotification=new Notification.Builder(this).setContentIntent(PendingIntent.getActivity(this,0,i,0)).setContentTitle(getString(R.string.msg_running)).setContentText(getString(R.string.msg_running_detail)).setLargeIcon(((BitmapDrawable)getDrawable(R.drawable.gigaget)).getBitmap()).setSmallIcon(android.R.drawable.stat_sys_download).build();
  HandlerThread thread=new HandlerThread("String_Node_Str");
  thread.start();
  mHandler=new Handler(thread.getLooper()){
    @Override public void handleMessage(    Message msg){
      if (msg.what == 0) {
        int runningCount=0;
        for (int i=0; i < mManager.getCount(); i++) {
          if (mManager.getMission(i).running) {
            runningCount++;
          }
        }
        updateState(runningCount);
      }
    }
  }
;
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  if (DEBUG) {
    Log.d(TAG,"String_Node_Str");
  }
  mBinder=new DMBinder();
  if (mManager == null) {
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str");
    }
    mManager=new DownloadManager(this,"String_Node_Str");
  }
  Intent i=new Intent();
  i.setAction(Intent.ACTION_MAIN);
  i.setClass(this,MainActivity.class);
  mNotification=new Notification.Builder(this).setContentIntent(PendingIntent.getActivity(this,0,i,0)).setContentTitle(getString(R.string.msg_running)).setContentText(getString(R.string.msg_running_detail)).setLargeIcon(((BitmapDrawable)getResources().getDrawable(R.drawable.gigaget)).getBitmap()).setSmallIcon(android.R.drawable.stat_sys_download).build();
  HandlerThread thread=new HandlerThread("String_Node_Str");
  thread.start();
  mHandler=new Handler(thread.getLooper()){
    @Override public void handleMessage(    Message msg){
      if (msg.what == 0) {
        int runningCount=0;
        for (int i=0; i < mManager.getCount(); i++) {
          if (mManager.getMission(i).running) {
            runningCount++;
          }
        }
        updateState(runningCount);
      }
    }
  }
;
}
Program: 94304
Project: 94304
Buggy source:
private int insertMission(DownloadMission mission){
  int i=-1;
  DownloadMission m=null;
  if (mMissions.size() > 0) {
    do {
      m=mMissions.get(++i);
    }
 while (m.timestamp < mission.timestamp && i < mMissions.size() - 1);
    if (i > 0)     i--;
  }
 else {
    i=0;
  }
  mMissions.add(i,mission);
  return i;
}

Fixed version (ground truth):
private int insertMission(DownloadMission mission){
  int i=-1;
  DownloadMission m=null;
  if (mMissions.size() > 0) {
    do {
      m=mMissions.get(++i);
    }
 while (m.timestamp > mission.timestamp && i < mMissions.size() - 1);
  }
 else {
    i=0;
  }
  mMissions.add(i,mission);
  return i;
}
Program: 94305
Project: 94305
Buggy source:
private int insertMission(DownloadMission mission){
  int i=-1;
  DownloadMission m=null;
  if (mMissions.size() > 0) {
    do {
      m=mMissions.get(++i);
    }
 while (m.timestamp < mission.timestamp && i < mMissions.size() - 1);
  }
 else {
    i=0;
  }
  mMissions.add(i,mission);
  return i;
}

Fixed version (ground truth):
private int insertMission(DownloadMission mission){
  int i=-1;
  DownloadMission m=null;
  if (mMissions.size() > 0) {
    do {
      m=mMissions.get(++i);
    }
 while (m.timestamp < mission.timestamp && i < mMissions.size() - 1);
    if (i > 0)     i--;
  }
 else {
    i=0;
  }
  mMissions.add(i,mission);
  return i;
}
Program: 94306
Project: 94306
Buggy source:
private void loadMissions(){
  File f=new File(mLocation);
  if (f.exists() && f.isDirectory()) {
    File[] subs=f.listFiles();
    for (    File sub : subs) {
      if (sub.isDirectory()) {
        continue;
      }
      if (sub.getName().endsWith("String_Node_Str")) {
        String str=Utility.readFromFile(sub.getAbsolutePath());
        if (str != null) {
          if (DEBUG) {
            Log.d(TAG,"String_Node_Str" + sub.getName());
            Log.d(TAG,str);
          }
          DownloadMission mis=new Gson().fromJson(str,DownloadMission.class);
          if (mis.finished) {
            sub.delete();
            continue;
          }
          mis.running=false;
          mis.recovered=true;
          insertMission(mis);
        }
      }
 else       if (!sub.getName().startsWith("String_Node_Str")) {
        DownloadMission mis=new DownloadMission();
        mis.length=sub.length();
        mis.done=mis.length;
        mis.finished=true;
        mis.running=false;
        mis.name=sub.getName();
        mis.location=mLocation;
        mis.timestamp=sub.lastModified();
        insertMission(mis);
      }
    }
  }
}

Fixed version (ground truth):
private void loadMissions(){
  File f=new File(mLocation);
  if (f.exists() && f.isDirectory()) {
    File[] subs=f.listFiles();
    for (    File sub : subs) {
      if (sub.isDirectory()) {
        continue;
      }
      if (sub.getName().endsWith("String_Node_Str")) {
        String str=Utility.readFromFile(sub.getAbsolutePath());
        if (str != null) {
          if (DEBUG) {
            Log.d(TAG,"String_Node_Str" + sub.getName());
            Log.d(TAG,str);
          }
          DownloadMission mis=new Gson().fromJson(str,DownloadMission.class);
          if (mis.finished) {
            sub.delete();
            continue;
          }
          mis.running=false;
          mis.recovered=true;
          insertMission(mis);
        }
      }
 else       if (!sub.getName().startsWith("String_Node_Str") && !new File(sub.getPath() + "String_Node_Str").exists()) {
        DownloadMission mis=new DownloadMission();
        mis.length=sub.length();
        mis.done=mis.length;
        mis.finished=true;
        mis.running=false;
        mis.name=sub.getName();
        mis.location=mLocation;
        mis.timestamp=sub.lastModified();
        insertMission(mis);
      }
    }
  }
}
Program: 94307
Project: 94307
Buggy source:
/** 
 * Test method: byte[] extractUntil(int offset, char delim)
 * @throws Exception
 */
public void testExtractBytesUntil() throws Exception {
  byte[] buf=sFile.extractBytesUntil(0,(byte)'\n');
  for (int i=0; i < buf.length; i++) {
    assertEquals(fileData.get(i),buf[i]);
    assertFalse(buf[i] == '\n');
  }
  assertEquals(fileData.get(buf.length),'\n');
}

Fixed version (ground truth):
/** 
 * Test method: byte[] extractUntil(int offset, char delim)
 * @throws Exception
 */
public void testExtractBytesUntil() throws Exception {
  String buf=sFile.extractUntil(0,'\n');
  for (int i=0; i < buf.length(); i++) {
    assertEquals(fileData.get(i),buf.charAt(i));
    assertFalse(buf.charAt(i) == '\n');
  }
  assertEquals(fileData.get(buf.length()),'\n');
}
Program: 94308
Project: 94308
Buggy source:
/** 
 * Test method: long count(byte[] query)
 * @throws Exception
 */
public void testCount() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    long count=sFile.count(query.toCharArray());
    assertEquals(getQueryStringCount(i),count);
  }
}

Fixed version (ground truth):
/** 
 * Test method: long count(byte[] query)
 * @throws Exception
 */
public void testCount() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    long count=sFile.count(query.toCharArray());
    long expected=stringCount(getData(),query);
    assertEquals(expected,count);
  }
}
Program: 94309
Project: 94309
Buggy source:
/** 
 * Test method: Iterator<Long> searchIterator(byte[] query)
 * @throws Exception
 */
public void testSearchIterator() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    Iterator<Long> positions=sFile.searchIterator(query.toCharArray());
    long count=0;
    while (positions.hasNext()) {
      long pos=positions.next();
      for (int j=0; j < query.length(); j++) {
        assertEquals(query.charAt(j),fileData.get((int)(pos + j)));
      }
      count++;
    }
    assertEquals(getQueryStringCount(i),count);
  }
}

Fixed version (ground truth):
/** 
 * Test method: Iterator<Long> searchIterator(byte[] query)
 * @throws Exception
 */
public void testSearchIterator() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    Iterator<Long> positions=sFile.searchIterator(query.toCharArray());
    long count=0;
    while (positions.hasNext()) {
      long pos=positions.next();
      for (int j=0; j < query.length(); j++) {
        assertEquals(query.charAt(j),fileData.get((int)(pos + j)));
      }
      count++;
    }
    assertEquals(stringCount(getData(),query),count);
  }
}
Program: 94310
Project: 94310
Buggy source:
/** 
 * Test method: long[] search(byte[] query)
 * @throws Exception
 */
public void testSearch() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    Long[] positions=sFile.search(query.toCharArray());
    assertEquals(getQueryStringCount(i),positions.length);
    for (    Long pos : positions) {
      for (int j=0; j < query.length(); j++) {
        assertEquals(query.charAt(j),fileData.get((int)(pos + j)));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Test method: long[] search(byte[] query)
 * @throws Exception
 */
public void testSearch() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    Long[] positions=sFile.search(query.toCharArray());
    assertEquals(stringCount(getData(),query),positions.length);
    for (    Long pos : positions) {
      for (int j=0; j < query.length(); j++) {
        assertEquals(query.charAt(j),fileData.get((int)(pos + j)));
      }
    }
  }
}
Program: 94311
Project: 94311
Buggy source:
/** 
 * Test method: Iterator<Integer> recordSearchIdIterator(byte[] query)
 * @throws Exception
 */
public void testRecordSearchIdIterator() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    Iterator<Integer> recordSearchIds=sIFile.recordSearchIdIterator(query.toCharArray());
    int count=0;
    while (recordSearchIds.hasNext()) {
      Integer recordId=recordSearchIds.next();
      String buf=sIFile.getRecord(recordId);
      assertTrue(buf.contains(query));
      count++;
    }
    assertEquals(getQueryStringCount(i),count);
  }
}

Fixed version (ground truth):
/** 
 * Test method: Iterator<Integer> recordSearchIdIterator(byte[] query)
 * @throws Exception
 */
public void testRecordSearchIdIterator() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    Iterator<Integer> recordSearchIds=sIFile.recordSearchIdIterator(query.toCharArray());
    int count=0;
    while (recordSearchIds.hasNext()) {
      Integer recordId=recordSearchIds.next();
      String buf=sIFile.getRecord(recordId);
      assertTrue(buf.contains(query));
      count++;
    }
    assertEquals(stringRecordCount(getData(),offsets,query),count);
  }
}
Program: 94312
Project: 94312
Buggy source:
/** 
 * Test method: Integer[] recordSearchIds(byte[] query)
 * @throws Exception
 */
public void testRecordSearchIds() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    Integer[] recordSearchIds=sIFile.recordSearchIds(query.toCharArray());
    assertEquals(getQueryStringCount(i),recordSearchIds.length);
    for (    Integer recordId : recordSearchIds) {
      String buf=sIFile.getRecord(recordId);
      assertTrue(buf.contains(query));
    }
  }
}

Fixed version (ground truth):
/** 
 * Test method: Integer[] recordSearchIds(byte[] query)
 * @throws Exception
 */
public void testRecordSearchIds() throws Exception {
  for (int i=0; i < numQueryStrings(); i++) {
    String query=getQueryString(i);
    Integer[] recordSearchIds=sIFile.recordSearchIds(query.toCharArray());
    assertEquals(stringRecordCount(getData(),offsets,query),recordSearchIds.length);
    for (    Integer recordId : recordSearchIds) {
      String buf=sIFile.getRecord(recordId);
      assertTrue(buf.contains(query));
    }
  }
}
Program: 94313
Project: 94313
Buggy source:
/** 
 * Set up test.
 * @throws Exception
 */
public void setUp() throws Exception {
  super.setUp();
  File inputFile=new File(testFileRaw);
  byte[] fileData=new byte[(int)inputFile.length()];
  DataInputStream dis=new DataInputStream(new FileInputStream(inputFile));
  dis.readFully(fileData);
  SuccinctBuffer sBuf=new SuccinctBuffer(fileData,3);
  sBuf.writeToFile(testFileSuccinct);
  sCore=new SuccinctStream(new Path(testFileSuccinct));
}

Fixed version (ground truth):
/** 
 * Set up test.
 * @throws Exception
 */
public void setUp() throws Exception {
  super.setUp();
  File inputFile=new File(testFileRaw);
  byte[] fileData=new byte[(int)inputFile.length()];
  DataInputStream dis=new DataInputStream(new FileInputStream(inputFile));
  dis.readFully(fileData);
  SuccinctBuffer sBuf=new SuccinctBuffer(fileData);
  sBuf.writeToFile(testFileSuccinct);
  sCore=new SuccinctStream(new Path(testFileSuccinct));
}
Program: 94314
Project: 94314
Buggy source:
/** 
 * Set up test.
 * @throws Exception
 */
public void setUp() throws Exception {
  super.setUp();
  File inputFile=new File(testFileRaw);
  byte[] fileData=new byte[(int)inputFile.length()];
  DataInputStream dis=new DataInputStream(new FileInputStream(inputFile));
  dis.readFully(fileData);
  sCore=new SuccinctBuffer(fileData,3);
}

Fixed version (ground truth):
/** 
 * Set up test.
 * @throws Exception
 */
public void setUp() throws Exception {
  super.setUp();
  File inputFile=new File(testFileRaw);
  byte[] fileData=new byte[(int)inputFile.length()];
  DataInputStream dis=new DataInputStream(new FileInputStream(inputFile));
  dis.readFully(fileData);
}
Program: 94315
Project: 94315
Buggy source:
/** 
 * Test method: void readObject(ObjectInputStream ois) Test method: void writeObject(ObjectOutputStream oos)
 * @throws Exception
 */
public void testSerializeDeserialize() throws Exception {
  System.out.println("String_Node_Str");
  FileOutputStream fOut=new FileOutputStream(testFileSuccinct);
  ObjectOutputStream oos=new ObjectOutputStream(fOut);
  oos.writeObject(sCore);
  oos.close();
  FileInputStream fIn=new FileInputStream(testFileSuccinct);
  ObjectInputStream ois=new ObjectInputStream(fIn);
  SuccinctBuffer sCoreRead=(SuccinctBuffer)ois.readObject();
  ois.close();
  assertNotNull(sCoreRead);
  assertEquals(sCore.getOriginalSize(),sCoreRead.getOriginalSize());
  assertEquals(sCore.getCompressedSize(),sCoreRead.getCompressedSize());
  for (int i=0; i < sCore.getOriginalSize(); i++) {
    assertEquals(sCore.lookupNPA(i),sCoreRead.lookupNPA(i));
    assertEquals(sCore.lookupSA(i),sCoreRead.lookupSA(i));
    assertEquals(sCore.lookupISA(i),sCoreRead.lookupISA(i));
  }
}

Fixed version (ground truth):
/** 
 * Test method: void readObject(ObjectInputStream ois) Test method: void writeObject(ObjectOutputStream oos)
 * @throws Exception
 */
public void testSerializeDeserialize() throws Exception {
  System.out.println("String_Node_Str");
  FileOutputStream fOut=new FileOutputStream(testFileSuccinct);
  ObjectOutputStream oos=new ObjectOutputStream(fOut);
  oos.writeObject(sCore);
  oos.close();
  FileInputStream fIn=new FileInputStream(testFileSuccinct);
  ObjectInputStream ois=new ObjectInputStream(fIn);
  SuccinctBuffer sCoreRead=(SuccinctBuffer)ois.readObject();
  ois.close();
  assertNotNull(sCoreRead);
  assertEquals(sCore.getOriginalSize(),sCoreRead.getOriginalSize());
  for (int i=0; i < sCore.getOriginalSize(); i++) {
    assertEquals(sCore.lookupNPA(i),sCoreRead.lookupNPA(i));
    assertEquals(sCore.lookupSA(i),sCoreRead.lookupSA(i));
    assertEquals(sCore.lookupISA(i),sCoreRead.lookupISA(i));
  }
}
Program: 94316
Project: 94316
Buggy source:
/** 
 * Performs regular expression search for an input expression using Succinct data-structures.
 * @param query Regular expression pattern to be matched. (UTF-8 encoded)
 * @return All locations and lengths of matching patterns in original input.
 * @throws RegExParsingException
 */
@Override public Map<Long,Integer> regexSearch(String query) throws RegExParsingException {
  RegExParser parser=new RegExParser(new String(query));
  RegEx regEx;
  regEx=parser.parse();
  RegExPlanner planner=new NaiveRegExPlanner(this,regEx);
  RegEx optRegEx=planner.plan();
  RegExExecutor regExExecutor=new RegExExecutor(this,optRegEx);
  regExExecutor.execute();
  Map<Long,Integer> chunkResults=regExExecutor.getFinalResults();
  Map<Long,Integer> results=new TreeMap<Long,Integer>();
  for (  Map.Entry<Long,Integer> result : chunkResults.entrySet()) {
    results.put(result.getKey() + fileOffset,result.getValue());
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Performs regular expression search for an input expression using Succinct data-structures.
 * @param query Regular expression pattern to be matched. (UTF-8 encoded)
 * @return All locations and lengths of matching patterns in original input.
 * @throws RegExParsingException
 */
@Override public Map<Long,Integer> regexSearch(String query) throws RegExParsingException {
  RegExParser parser=new RegExParser(new String(query));
  RegEx regEx;
  regEx=parser.parse();
  RegExPlanner planner=new NaiveRegExPlanner(this,regEx);
  RegEx optRegEx=planner.plan();
  RegExExecutor regExExecutor=new RegExExecutor(this,optRegEx);
  regExExecutor.execute();
  Set<RegexMatch> chunkResults=regExExecutor.getFinalResults();
  Map<Long,Integer> results=new TreeMap<Long,Integer>();
  for (  RegexMatch result : chunkResults) {
    results.put(result.getOffset() + fileOffset,result.getLength());
  }
  return results;
}
Program: 94317
Project: 94317
Buggy source:
/** 
 * Expands character range, i.e., converts abbreviated ranges into full ranges.
 * @param charRange Character range to be expanded.
 * @return The expanded character range.
 */
private String expandCharRange(String charRange){
  String expandedCharRange="String_Node_Str";
  for (int i=0; i < charRange.length(); i++) {
    if (charRange.charAt(i) == '-') {
      for (char c=(char)(charRange.charAt(i - 1) + 1); c < charRange.charAt(i + 1); i++) {
        expandedCharRange+=c;
      }
      i++;
    }
    if (charRange.charAt(i) == '\\') {
      i++;
    }
    expandedCharRange+=charRange.charAt(i);
  }
  return expandedCharRange;
}

Fixed version (ground truth):
/** 
 * Expands character range, i.e., converts abbreviated ranges into full ranges.
 * @param charRange Character range to be expanded.
 * @return The expanded character range.
 */
private String expandCharRange(String charRange){
  String expandedCharRange="String_Node_Str";
  System.out.println("String_Node_Str" + charRange);
  for (int i=0; i < charRange.length(); i++) {
    if (charRange.charAt(i) == '-') {
      char begChar=charRange.charAt(i - 1);
      char endChar=charRange.charAt(i + 1);
      System.out.println("String_Node_Str" + begChar + "String_Node_Str"+ endChar);
      for (char c=(char)(begChar + 1); c < endChar; c++) {
        expandedCharRange+=c;
      }
      i++;
    }
    if (charRange.charAt(i) == '\\') {
      i++;
    }
    expandedCharRange+=charRange.charAt(i);
  }
  return expandedCharRange;
}
Program: 94318
Project: 94318
Buggy source:
/** 
 * Search for all records that contain a particular regular expression.
 * @param query The regular expression (UTF-8 encoded).
 * @return The records that contain the regular search expression.
 * @throws RegExParsingException
 */
public byte[][] recordSearchRegex(String query) throws RegExParsingException {
  Map<Long,Integer> regexOffsetResults=regexSearch(query);
  Set<Long> offsetResults=new HashSet<Long>();
  ArrayList<byte[]> results=new ArrayList<byte[]>();
  for (  Long offset : regexOffsetResults.keySet()) {
    int offsetIdx=searchOffset(offset);
    long recordOffset=offsets[offsetIdx];
    if (!offsetResults.contains(recordOffset)) {
      results.add(extractUntil(offset.intValue(),RECORD_DELIM));
      offsetResults.add(offset);
    }
  }
  return results.toArray(new byte[results.size()][]);
}

Fixed version (ground truth):
/** 
 * Search for all records that contain a particular regular expression.
 * @param query The regular expression (UTF-8 encoded).
 * @return The records that contain the regular search expression.
 * @throws RegExParsingException
 */
public byte[][] recordSearchRegex(String query) throws RegExParsingException {
  Map<Long,Integer> regexOffsetResults=regexSearch(query);
  Set<Long> offsetResults=new HashSet<Long>();
  ArrayList<byte[]> results=new ArrayList<byte[]>();
  for (  Long offset : regexOffsetResults.keySet()) {
    int offsetIdx=searchOffset(offset);
    long recordOffset=offsets[offsetIdx];
    if (!offsetResults.contains(recordOffset)) {
      results.add(extractUntil((int)recordOffset,RECORD_DELIM));
      offsetResults.add(offset);
    }
  }
  return results.toArray(new byte[results.size()][]);
}
Program: 94319
Project: 94319
Buggy source:
/** 
 * Get range of SA positions using Backward search
 * @param buf Input query to be searched.
 * @return Range of indices into the SA.
 */
public Range<Long,Long> getRange(byte[] buf){
  Range<Long,Long> range=new Range<Long,Long>(0L,-1L);
  int m=buf.length;
  long c1, c2;
  if (alphabetMap.containsKey(buf[m - 1])) {
    range.first=alphabetMap.get(buf[m - 1]).first;
    range.second=alphabetMap.get((alphabet.get(alphabetMap.get(buf[m - 1]).second + 1))).first - 1;
  }
 else {
    return range;
  }
  if (range.first > range.second) {
    return range;
  }
  for (int i=m - 2; i >= 0; i--) {
    if (alphabetMap.containsKey(buf[i])) {
      c1=alphabetMap.get(buf[i]).first;
      c2=alphabetMap.get((alphabet.get(alphabetMap.get(buf[i]).second + 1))).first - 1;
    }
 else {
      return range;
    }
    range.first=binSearchNPA(range.first,c1,c2,false);
    range.second=binSearchNPA(range.second,c1,c2,true);
    if (range.first > range.second) {
      return range;
    }
  }
  return range;
}

Fixed version (ground truth):
/** 
 * Get range of SA positions using Backward search
 * @param buf Input query to be searched.
 * @return Range of indices into the SA.
 */
public Range<Long,Long> getRange(byte[] buf){
  Range<Long,Long> range=new Range<Long,Long>(0L,-1L);
  int m=buf.length;
  long c1, c2;
  if (alphabetMap.containsKey(buf[m - 1])) {
    range.first=alphabetMap.get(buf[m - 1]).first;
    range.second=alphabetMap.get((alphabet.get(alphabetMap.get(buf[m - 1]).second + 1))).first - 1;
  }
 else {
    return range;
  }
  for (int i=m - 2; i >= 0; i--) {
    if (alphabetMap.containsKey(buf[i])) {
      c1=alphabetMap.get(buf[i]).first;
      c2=alphabetMap.get((alphabet.get(alphabetMap.get(buf[i]).second + 1))).first - 1;
    }
 else {
      return range;
    }
    range.first=binSearchNPA(range.first,c1,c2,false);
    range.second=binSearchNPA(range.second,c1,c2,true);
  }
  return range;
}
Program: 94320
Project: 94320
Buggy source:
/** 
 * Search for all records that contain a particular regular expression.
 * @param query The regular expression (UTF-8 encoded).
 * @return The records that contain the regular search expression.
 * @throws RegExParsingException
 */
public byte[][] recordSearchRegex(String query) throws RegExParsingException {
  Map<Long,Integer> regexOffsetResults=regexSearch(query);
  Set<Long> offsetResults=new HashSet<Long>();
  ArrayList<byte[]> results=new ArrayList<byte[]>();
  for (  Long offset : regexOffsetResults.keySet()) {
    int offsetIdx=searchOffset(offset);
    long recordOffset=offsets[offsetIdx];
    if (!offsetResults.contains(recordOffset)) {
      results.add(extractUntil((int)recordOffset,RECORD_DELIM));
      offsetResults.add(offset);
    }
  }
  return results.toArray(new byte[results.size()][]);
}

Fixed version (ground truth):
/** 
 * Search for all records that contain a particular regular expression.
 * @param query The regular expression (UTF-8 encoded).
 * @return The records that contain the regular search expression.
 * @throws RegExParsingException
 */
public byte[][] recordSearchRegex(String query) throws RegExParsingException {
  Map<Long,Integer> regexOffsetResults=regexSearch(query);
  Set<Long> offsetResults=new HashSet<Long>();
  ArrayList<byte[]> results=new ArrayList<byte[]>();
  for (  Long offset : regexOffsetResults.keySet()) {
    int offsetIdx=searchOffset(offset);
    long recordOffset=offsets[offsetIdx];
    if (!offsetResults.contains(recordOffset)) {
      results.add(extractUntil((int)recordOffset,RECORD_DELIM));
      offsetResults.add(recordOffset);
    }
  }
  return results.toArray(new byte[results.size()][]);
}
Program: 94325
Project: 94325
Buggy source:
public void onClick(View v){
  if (whitelist.isChecked()) {
    if (white_me.isChecked()) {
      if (wlan.getText().toString() == "String_Node_Str") {
        exe.RunAsRootOutput("String_Node_Str" + getmac(wlan.getText().toString()) + "String_Node_Str");
      }
 else {
        exe.RunAsRootOutput("String_Node_Str");
        exe.RunAsRootOutput("String_Node_Str" + getmac(wlan.getText().toString()) + "String_Node_Str");
      }
    }
 else {
      if (wlan.getText().toString() == "String_Node_Str") {
        exe.RunAsRootOutput("String_Node_Str" + getmac(wlan.getText().toString()) + "String_Node_Str");
      }
 else {
        exe.RunAsRootOutput("String_Node_Str");
        exe.RunAsRootOutput("String_Node_Str" + getmac(wlan.getText().toString()) + "String_Node_Str");
      }
    }
  }
 else {
    white_me.setChecked(false);
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (whitelist.isChecked()) {
    if (white_me.isChecked()) {
      if (wlan.getText().toString() == "String_Node_Str") {
        exe.RunAsRootOutput("String_Node_Str" + getmac(wlan.getText().toString()) + "String_Node_Str");
      }
 else {
        exe.RunAsRootOutput("String_Node_Str" + getmac("String_Node_Str") + "String_Node_Str");
        exe.RunAsRootOutput("String_Node_Str" + getmac(wlan.getText().toString()) + "String_Node_Str");
      }
    }
 else {
      if (wlan.getText().toString() == "String_Node_Str") {
        exe.RunAsRootOutput("String_Node_Str" + getmac(wlan.getText().toString()) + "String_Node_Str");
      }
 else {
        exe.RunAsRootOutput("String_Node_Str");
        exe.RunAsRootOutput("String_Node_Str" + getmac(wlan.getText().toString()) + "String_Node_Str");
      }
    }
  }
 else {
    white_me.setChecked(false);
  }
}