nus-yam/ex-repair huggingface dataset:
Program: 80260
Project: 80260
Buggy source:
/** 
 * @param explicit true if the user has clicked the OK button to explicitly ask for a password check (this should never happen)
 */
private void doComparePassword(boolean explicit){
  final String currentPassword=mLockPasswordView.getPassword();
  if (currentPassword.equals(options.password)) {
    exitSuccessCompare();
    mAnalytics.increment(LockerAnalytics.PASSWORD_SUCCESS);
  }
 else   if (explicit) {
    mAnalytics.increment(LockerAnalytics.PASSWORD_FAILED);
    mLockPasswordView.clearPassword();
    updatePassword();
    Toast.makeText(this,R.string.locker_invalid_password,Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
/** 
 * @param explicit true if the user has clicked the OK button to explicitly ask for a password check (this should never happen)
 */
private void doComparePassword(boolean explicit){
  final String currentPassword=mLockPasswordView.getPassword();
  if (currentPassword.equals(options.password)) {
    mFingerDistance=mLockPasswordView.getFingerDistance();
    exitSuccessCompare();
  }
 else   if (explicit) {
    mAnalytics.increment(LockerAnalytics.UNLOCK_ERROR);
    mLockPasswordView.clearPassword();
    updatePassword();
    Toast.makeText(this,R.string.locker_invalid_password,Toast.LENGTH_SHORT).show();
  }
}
Program: 80261
Project: 80261
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent == null) {
    return START_NOT_STICKY;
  }
  Log.d(TAG,"String_Node_Str" + intent.getAction());
  if (ACTION_HIDE.equals(intent.getAction())) {
    finish(true);
    return START_NOT_STICKY;
  }
  if (ACTION_NOTIFY_PACKAGE_CHANGED.equals(intent.getAction())) {
    String newPackageName=intent.getStringExtra(EXTRA_PACKAGENAME);
    if (newPackageName == null || !getPackageName().equals(newPackageName)) {
      finish(true);
      return START_NOT_STICKY;
    }
  }
 else {
    mIntent=intent;
    mAnalytics=new Analytics(this);
    showView();
  }
  return START_NOT_STICKY;
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent == null) {
    return START_NOT_STICKY;
  }
  Log.d(TAG,"String_Node_Str" + intent.getAction());
  if (ACTION_HIDE.equals(intent.getAction())) {
    finish(true);
    return START_NOT_STICKY;
  }
  if (ACTION_NOTIFY_PACKAGE_CHANGED.equals(intent.getAction())) {
    String newPackageName=intent.getStringExtra(EXTRA_PACKAGENAME);
    if (newPackageName == null || !getPackageName().equals(newPackageName)) {
      finish(true);
      return START_NOT_STICKY;
    }
  }
 else {
    mIntent=intent;
    showView();
  }
  return START_NOT_STICKY;
}
Program: 80262
Project: 80262
Buggy source:
private void onViewShown(){
  if (DEBUG_VIEW)   Log.v(TAG,"String_Node_Str" + "String_Node_Str" + mViewState + "String_Node_Str");
  mViewState=ViewState.SHOWN;
  mAnimShow=null;
}

Fixed version (ground truth):
private void onViewShown(){
  mTimeViewShown=System.nanoTime();
  if (DEBUG_VIEW)   Log.v(TAG,"String_Node_Str" + "String_Node_Str" + mViewState + "String_Node_Str");
  mViewState=ViewState.SHOWN;
  mAnimShow=null;
}
Program: 80263
Project: 80263
Buggy source:
@Override public void onPatternStart(){
  mLockPatternView.cancelClearDelay();
  mLockPatternView.setDisplayMode(DisplayMode.Correct);
  if (ACTION_CREATE.equals(mAction)) {
    if (mRightButtonAction == RightButtonAction.CONTINUE) {
      mViewMessage.setText(R.string.pattern_change_head);
    }
 else {
      mViewMessage.setText(R.string.pattern_change_confirm);
    }
  }
}

Fixed version (ground truth):
@Override public void onPatternStart(){
  mTimeFirstFingerDown=System.nanoTime();
  mLockPatternView.cancelClearDelay();
  mLockPatternView.setDisplayMode(DisplayMode.Correct);
  if (ACTION_CREATE.equals(mAction)) {
    if (mRightButtonAction == RightButtonAction.CONTINUE) {
      mViewMessage.setText(R.string.pattern_change_head);
    }
 else {
      mViewMessage.setText(R.string.pattern_change_confirm);
    }
  }
}
Program: 80264
Project: 80264
Buggy source:
@Override public void onClick(View v){
  if (v.getId() == mOkButton.getId()) {
    onOkButtonImpl();
  }
 else   if (v.getId() == mBackButton.getId()) {
    onBackButtonImpl();
  }
 else {
    onNumberButtonImpl(v);
  }
  if (mEnableHapticFeedback) {
    performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING | HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  if (!mStarted) {
    mListener.onStart();
    mStarted=true;
  }
  if (v.getId() == mOkButton.getId()) {
    onOkButtonImpl();
  }
 else   if (v.getId() == mBackButton.getId()) {
    onBackButtonImpl();
  }
 else {
    onNumberButtonImpl(v);
  }
  if (mEnableHapticFeedback) {
    performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING | HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
  }
}
Program: 80265
Project: 80265
Buggy source:
@Override public boolean onLongClick(View v){
  if (v.getId() == mOkButton.getId()) {
    onOkButtonLongImpl();
  }
 else   if (v.getId() == mBackButton.getId()) {
    onBackButtonLongImpl();
  }
  if (mEnableHapticFeedback) {
    performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING | HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  if (!mStarted) {
    mListener.onStart();
    mStarted=true;
  }
  if (v.getId() == mOkButton.getId()) {
    onOkButtonLongImpl();
  }
 else   if (v.getId() == mBackButton.getId()) {
    onBackButtonLongImpl();
  }
  if (mEnableHapticFeedback) {
    performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING | HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
  }
  return true;
}
Program: 80266
Project: 80266
Buggy source:
/** 
 * Handle this Intent for searching...
 */
private void handleIntent(){
  if (getIntent().getAction().equals(Intent.ACTION_SEARCH)) {
    Log.d("String_Node_Str","String_Node_Str");
    if (mCurrentFragmentType == NavigationElement.TYPE_APPS) {
      final String query=getIntent().getStringExtra(SearchManager.QUERY);
      if (query != null) {
        ((AppsFragment)mCurrentFragment).onSearch(query);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Handle this Intent for searching...
 */
private void handleIntent(){
  if (getIntent() != null && getIntent().getAction() != null) {
    if (getIntent().getAction().equals(Intent.ACTION_SEARCH)) {
      Log.d("String_Node_Str","String_Node_Str");
      if (mCurrentFragmentType == NavigationElement.TYPE_APPS) {
        final String query=getIntent().getStringExtra(SearchManager.QUERY);
        if (query != null) {
          ((AppsFragment)mCurrentFragment).onSearch(query);
        }
      }
    }
  }
}
Program: 80267
Project: 80267
Buggy source:
private void doTest(){
}

Fixed version (ground truth):
private void doTest(){
  Log.d("String_Node_Str","String_Node_Str");
  Analytics analytics=new Analytics(this);
  ProUtils proUtils=new ProUtils(this);
  Map<String,String> data=new HashMap<String,String>();
  data.put(LockerAnalytics.PRO_TYPE,proUtils.getProTypeString());
  data.put(LockerAnalytics.LOCKED_APPS_COUNT,String.valueOf(PrefUtils.getLockedApps(this).size()));
  analytics.setDefaultUrl(LockerAnalytics.URL).query(data);
}
Program: 80268
Project: 80268
Buggy source:
private void onAlarmReceived(final Context c){
  Log.d("String_Node_Str","String_Node_Str");
  Analytics analytics=new Analytics(c);
  ProUtils proUtils=new ProUtils(c);
  Map<String,String> data=new HashMap<String,String>();
  data.put(LockerAnalytics.PRO_TYPE,proUtils.getProTypeString());
  data.put(LockerAnalytics.LOCKED_APPS_COUNT,String.valueOf(PrefUtils.getLockedApps(c).size()));
  analytics.queryServer(data);
}

Fixed version (ground truth):
private void onAlarmReceived(final Context c){
  Log.d("String_Node_Str","String_Node_Str");
  Analytics analytics=new Analytics(c);
  ProUtils proUtils=new ProUtils(c);
  Map<String,String> data=new HashMap<String,String>();
  data.put(LockerAnalytics.PRO_TYPE,proUtils.getProTypeString());
  data.put(LockerAnalytics.LOCKED_APPS_COUNT,String.valueOf(PrefUtils.getLockedApps(c).size()));
  Log.d("String_Node_Str","String_Node_Str");
  analytics.setDefaultUrl(LockerAnalytics.URL).query(data);
}
Program: 80269
Project: 80269
Buggy source:
private void showRootView(boolean animate,boolean forceReload){
  if (mRootView == null || forceReload) {
    hideView();
    mRootView=inflateRootView();
    mWindowManager.addView(mRootView,mLayoutParams);
  }
 else {
    if (mViewDisplayed) {
      mWindowManager.updateViewLayout(mRootView,mLayoutParams);
    }
 else {
      mWindowManager.addView(mRootView,mLayoutParams);
    }
  }
  if (animate)   showAnimation();
  mViewDisplayed=true;
}

Fixed version (ground truth):
private void showRootView(boolean animate){
  hideView();
  mRootView=inflateRootView();
  mWindowManager.addView(mRootView,mLayoutParams);
  if (animate)   showAnimation();
  mViewDisplayed=true;
}
Program: 80270
Project: 80270
Buggy source:
@Override public void onConfigurationChanged(Configuration newConfig){
  Log.d(TAG,"String_Node_Str");
  super.onConfigurationChanged(newConfig);
  if (mViewDisplayed) {
    showRootView(false,true);
    onAfterInflate();
  }
}

Fixed version (ground truth):
@Override public void onConfigurationChanged(Configuration newConfig){
  Log.d(TAG,"String_Node_Str");
  super.onConfigurationChanged(newConfig);
  if (mViewDisplayed) {
    showRootView(false);
    onAfterInflate();
  }
}
Program: 80271
Project: 80271
Buggy source:
private void hideView(){
  if (mViewDisplayed) {
    mWindowManager.removeView(mRootView);
    mViewDisplayed=false;
  }
}

Fixed version (ground truth):
private void hideView(){
  if (mViewDisplayed && mRootView != null) {
    mWindowManager.removeView(mRootView);
    mViewDisplayed=false;
  }
}
Program: 80272
Project: 80272
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent == null) {
    return START_NOT_STICKY;
  }
  if (ACTION_NOTIFY_PACKAGE_CHANGED.equals(intent.getAction())) {
    String newPackageName=intent.getStringExtra(EXTRA_PACKAGENAME);
    if (newPackageName == null) {
      finish(true);
      return START_NOT_STICKY;
    }
 else     if (!newPackageName.equals(mPackageName) && (!getPackageName().equals(newPackageName))) {
      finish(true);
      return START_NOT_STICKY;
    }
    if (newPackageName.equals(mPackageName)) {
      if (!getPackageName().equals(newPackageName)) {
        finish(true);
      }
      return START_NOT_STICKY;
    }
  }
 else {
    mIntent=intent;
    mAnalytics=new Analytics(this);
    onBeforeInflate();
    showRootView(true,false);
    onAfterInflate();
  }
  return super.onStartCommand(intent,flags,startId);
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent == null) {
    return START_NOT_STICKY;
  }
  if (ACTION_NOTIFY_PACKAGE_CHANGED.equals(intent.getAction())) {
    String newPackageName=intent.getStringExtra(EXTRA_PACKAGENAME);
    if (newPackageName == null) {
      finish(true);
      return START_NOT_STICKY;
    }
 else     if (!newPackageName.equals(mPackageName) && (!getPackageName().equals(newPackageName))) {
      finish(true);
      return START_NOT_STICKY;
    }
    if (newPackageName.equals(mPackageName)) {
      if (!getPackageName().equals(newPackageName)) {
        finish(true);
      }
      return START_NOT_STICKY;
    }
  }
 else {
    mIntent=intent;
    mAnalytics=new Analytics(this);
    onBeforeInflate();
    showRootView(true);
    onAfterInflate();
  }
  return super.onStartCommand(intent,flags,startId);
}
Program: 80273
Project: 80273
Buggy source:
private void showRootView(boolean animate,boolean forceReload){
  if (mViewDisplayed) {
    mWindowManager.removeView(mRootView);
  }
  System.gc();
  if (mRootView == null || forceReload)   mRootView=inflateRootView();
  mWindowManager.addView(mRootView,mLayoutParams);
  if (animate)   showAnimation();
  mViewDisplayed=true;
}

Fixed version (ground truth):
private void showRootView(boolean animate,boolean forceReload){
  if (mRootView == null || forceReload) {
    if (mViewDisplayed) {
      mWindowManager.removeView(mRootView);
    }
    mRootView=inflateRootView();
    mWindowManager.addView(mRootView,mLayoutParams);
  }
 else {
    if (mViewDisplayed) {
      mWindowManager.updateViewLayout(mRootView,mLayoutParams);
    }
 else {
      mWindowManager.addView(mRootView,mLayoutParams);
    }
  }
  if (animate)   showAnimation();
  mViewDisplayed=true;
}
Program: 80274
Project: 80274
Buggy source:
@Override public void onAnimationStart(Animation animation){
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void onAnimationStart(Animation animation){
}
Program: 80275
Project: 80275
Buggy source:
private void hideAnimation(){
  if (!mViewDisplayed) {
    return;
  }
  Log.d(TAG,"String_Node_Str" + mContainer.hashCode());
  Animation anim=AnimationUtils.loadAnimation(this,R.anim.fade_out);
  anim.setDuration(mHideAnimationDuration);
  anim.setFillEnabled(true);
  anim.setDetachWallpaper(false);
  anim.setAnimationListener(new AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
      Log.d(TAG,"String_Node_Str");
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
    @Override public void onAnimationEnd(    Animation animation){
      hideView();
    }
  }
);
  mContainer.startAnimation(anim);
}

Fixed version (ground truth):
private void hideAnimation(){
  if (!mViewDisplayed) {
    return;
  }
  Log.d(TAG,"String_Node_Str" + mContainer.hashCode());
  Log.d(TAG,"String_Node_Str" + mContainer.isFocused());
  Animation anim=AnimationUtils.loadAnimation(this,R.anim.fade_out);
  anim.setDuration(mHideAnimationDuration);
  anim.setFillEnabled(true);
  anim.setDetachWallpaper(false);
  anim.setAnimationListener(new AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
    @Override public void onAnimationEnd(    Animation animation){
      hideView();
    }
  }
);
  mContainer.startAnimation(anim);
}
Program: 80276
Project: 80276
Buggy source:
private void showAnimation(){
  Log.d(TAG,"String_Node_Str");
  Animation anim=AnimationUtils.loadAnimation(this,R.anim.fade_in);
  anim.setDuration(mShowAnimationDuration);
  anim.setFillEnabled(true);
  mContainer.startAnimation(anim);
  Log.d(TAG,"String_Node_Str");
}

Fixed version (ground truth):
private void showAnimation(){
  Animation anim=AnimationUtils.loadAnimation(this,R.anim.fade_in);
  anim.setDuration(mShowAnimationDuration);
  anim.setFillEnabled(true);
  mContainer.startAnimation(anim);
}
Program: 80277
Project: 80277
Buggy source:
/** 
 * Should be only called from   {@link #showRootView(boolean)}
 * @return
 */
private View inflateRootView(){
  mWindowManager=(WindowManager)getSystemService(WINDOW_SERVICE);
  LayoutInflater li=LayoutInflater.from(this);
  setTheme(R.style.LockActivityTheme);
  View root=(View)li.inflate(R.layout.layout_alias_locker,null);
  mContainer=(RelativeLayout)root.findViewById(R.id.rlContainer);
  mViewBackground=(ImageView)root.findViewById(R.id.ivBackground);
  root.setOnKeyListener(this);
  root.setFocusable(true);
  root.setFocusableInTouchMode(true);
  mViewTitle=(TextView)root.findViewById(R.id.tvHeader);
  mViewMessage=(TextView)root.findViewById(R.id.tvFooter);
  mAppIcon=(ImageView)root.findViewById(R.id.ivAppIcon);
  mLockView=(ViewGroup)root.findViewById(R.id.lockView);
  mFooterButtons=(LinearLayout)root.findViewById(R.id.llBottomButtons);
  mLeftButton=(Button)root.findViewById(R.id.bFooterLeft);
  mRightButton=(Button)root.findViewById(R.id.bFooterRight);
  mRightButton.setOnClickListener(this);
  mLeftButton.setOnClickListener(this);
  mPasswordListener=new MyOnNumberListener();
  mPatternListener=new MyOnPatternListener();
  return root;
}

Fixed version (ground truth):
/** 
 * Should be only called from   {@link #showRootView(boolean)}
 * @return
 */
private View inflateRootView(){
  mWindowManager=(WindowManager)getSystemService(WINDOW_SERVICE);
  LayoutInflater li=LayoutInflater.from(this);
  setTheme(R.style.LockActivityTheme);
  View root=(View)li.inflate(R.layout.layout_alias_locker,null);
  mContainer=(RelativeLayout)root.findViewById(R.id.rlContainer);
  Log.d(TAG,"String_Node_Str" + mContainer.hashCode());
  mViewBackground=(ImageView)root.findViewById(R.id.ivBackground);
  root.setOnKeyListener(this);
  root.setFocusable(true);
  root.setFocusableInTouchMode(true);
  mViewTitle=(TextView)root.findViewById(R.id.tvHeader);
  mViewMessage=(TextView)root.findViewById(R.id.tvFooter);
  mAppIcon=(ImageView)root.findViewById(R.id.ivAppIcon);
  mLockView=(ViewGroup)root.findViewById(R.id.lockView);
  mFooterButtons=(LinearLayout)root.findViewById(R.id.llBottomButtons);
  mLeftButton=(Button)root.findViewById(R.id.bFooterLeft);
  mRightButton=(Button)root.findViewById(R.id.bFooterRight);
  mRightButton.setOnClickListener(this);
  mLeftButton.setOnClickListener(this);
  mPasswordListener=new MyOnNumberListener();
  mPatternListener=new MyOnPatternListener();
  return root;
}
Program: 80278
Project: 80278
Buggy source:
@Override public void onAnimationEnd(Animation animation){
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animation animation){
  hideView();
}
Program: 80279
Project: 80279
Buggy source:
private void hideAnimation(){
  if (!mViewDisplayed) {
    return;
  }
  Animation anim=AnimationUtils.loadAnimation(this,R.anim.fade_out);
  anim.setDuration(mHideAnimationDuration);
  anim.setFillEnabled(true);
  anim.setDetachWallpaper(false);
  anim.setAnimationListener(new AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
      Log.d(TAG,"String_Node_Str");
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
    @Override public void onAnimationEnd(    Animation animation){
    }
  }
);
  hideView();
  mContainer.startAnimation(anim);
}

Fixed version (ground truth):
private void hideAnimation(){
  if (!mViewDisplayed) {
    return;
  }
  Log.d(TAG,"String_Node_Str" + mContainer.hashCode());
  Animation anim=AnimationUtils.loadAnimation(this,R.anim.fade_out);
  anim.setDuration(mHideAnimationDuration);
  anim.setFillEnabled(true);
  anim.setDetachWallpaper(false);
  anim.setAnimationListener(new AnimationListener(){
    @Override public void onAnimationStart(    Animation animation){
      Log.d(TAG,"String_Node_Str");
    }
    @Override public void onAnimationRepeat(    Animation animation){
    }
    @Override public void onAnimationEnd(    Animation animation){
      hideView();
    }
  }
);
  mContainer.startAnimation(anim);
}
Program: 80280
Project: 80280
Buggy source:
@SuppressLint("String_Node_Str") @Override public void onCreate(){
  super.onCreate();
  Log.v(TAG,"String_Node_Str");
  mAM=(ActivityManager)getSystemService(ACTIVITY_SERVICE);
  loadPreferences();
  startScheduler();
  mScreenReceiver=new ScreenReceiver();
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_SCREEN_ON);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  registerReceiver(mScreenReceiver,filter);
  if (mShowNotification) {
    Intent i=new Intent(this,MainActivity.class);
    PendingIntent.getActivity(this,0,i,0);
    PendingIntent pi=PendingIntent.getActivity(this,0,i,0);
    String title=getString(R.string.notification_title);
    String content=getString(R.string.notification_state_locked);
    Notification n=getNotificationCompat(title,content,pi);
    startForeground(NOTIFICATION_ID,n);
  }
 else   if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    @SuppressWarnings("String_Node_Str") Notification n=new Notification(0,null,System.currentTimeMillis());
    n.flags|=Notification.FLAG_NO_CLEAR;
    startForeground(NOTIFICATION_ID,n);
  }
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public void onCreate(){
  super.onCreate();
  Log.v(TAG,"String_Node_Str");
  mAM=(ActivityManager)getSystemService(ACTIVITY_SERVICE);
  loadPreferences();
  startScheduler();
  mScreenReceiver=new ScreenReceiver();
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_SCREEN_ON);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  registerReceiver(mScreenReceiver,filter);
  if (mShowNotification) {
    Intent i=new Intent(this,MainActivity.class);
    PendingIntent.getActivity(this,0,i,0);
    PendingIntent pi=PendingIntent.getActivity(this,0,i,0);
    String title=getString(R.string.notification_title);
    String content=getString(R.string.notification_state_locked);
    NotificationCompat.Builder nb=new NotificationCompat.Builder(this);
    nb.setSmallIcon(R.drawable.ic_launcher);
    nb.setContentTitle(title);
    nb.setContentText(content);
    nb.setWhen(System.currentTimeMillis());
    nb.setContentIntent(pi);
    nb.setOngoing(true);
    startForeground(NOTIFICATION_ID,nb.build());
  }
 else   if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    @SuppressWarnings("String_Node_Str") Notification n=new Notification(0,null,System.currentTimeMillis());
    n.flags|=Notification.FLAG_NO_CLEAR;
    startForeground(NOTIFICATION_ID,n);
  }
}
Program: 80281
Project: 80281
Buggy source:
/** 
 * @param context
 * @return A {@link Set} that is safe to edit and use.
 */
public static final Set<String> getTrackedApps(Context c){
  Set<String> apps=new HashSet<String>();
  SharedPreferences sp=c.getSharedPreferences(PREF_FILE_APPS,Context.MODE_PRIVATE);
  Set<String> prefApps=sp.getStringSet(PREF_KEY_APPS,new HashSet<String>());
  apps.addAll(prefApps);
  return apps;
}

Fixed version (ground truth):
/** 
 * @param context
 * @return A {@link Set} that is safe to edit and use.
 */
public static final Set<String> getTrackedApps(Context c){
  SharedPreferences sp=c.getSharedPreferences(PREF_FILE_APPS,Context.MODE_PRIVATE);
  Set<String> apps=new HashSet<String>(sp.getAll().keySet());
  return apps;
}
Program: 80282
Project: 80282
Buggy source:
/** 
 * Tracks or untracks an app
 * @param packageName
 * @param shouldTrack True if the new state will be tracking, false if not
 */
public final void setTracking(String packageName,boolean shouldTrack){
  Set<String> apps=getTrackedApps(this);
  SharedPreferences.Editor editor=getSharedPreferences(PREF_FILE_APPS,Context.MODE_PRIVATE).edit();
  boolean done;
  if (shouldTrack) {
    done=apps.add(packageName);
  }
 else {
    done=apps.remove(packageName);
  }
  Log.d(TAG,(shouldTrack ? "String_Node_Str" : "String_Node_Str") + packageName + "String_Node_Str"+ done);
  editor.putStringSet(PREF_KEY_APPS,apps);
  boolean commited=editor.commit();
  if (!commited) {
    Log.w(TAG,"String_Node_Str");
  }
  updateTrackedApps();
}

Fixed version (ground truth):
/** 
 * Tracks or untracks an app
 * @param packageName
 * @param shouldTrack True if the new state will be tracking, false if not
 */
public final void setTracking(String packageName,boolean shouldTrack){
  SharedPreferences.Editor editor=getSharedPreferences(PREF_FILE_APPS,Context.MODE_PRIVATE).edit();
  if (shouldTrack) {
    editor.putBoolean(packageName,true);
  }
 else {
    editor.remove(packageName);
  }
  boolean commited=editor.commit();
  if (!commited) {
    Log.w(TAG,"String_Node_Str");
  }
  updateTrackedApps();
}
Program: 80283
Project: 80283
Buggy source:
@Override public void onClick(View v){
switch (v.getId()) {
case R.id.bOK:
{
      onOkButton();
      break;
    }
case R.id.bBack:
{
    StringBuilder sb=new StringBuilder(tvPassword.getText());
    if (sb.length() > 0) {
      tvPassword.setText(sb.delete(sb.length() - 1,sb.length()).toString());
    }
    onBackButton();
    break;
  }
default :
{
  onNumberButton(v);
  break;
}
}
}

Fixed version (ground truth):
@Override public void onClick(View v){
switch (v.getId()) {
case R.id.bOK:
{
      onOkButton();
      break;
    }
case R.id.bBack:
{
    onBackButton();
    break;
  }
default :
{
  onNumberButton(v);
  break;
}
}
}
Program: 80284
Project: 80284
Buggy source:
/** 
 * Called every time the back button is pressed. If you override this method call super.  {@link #onBackButton(boolean)} to remove last character from{@link #tvPassword}
 * @param longPress
 */
protected void onBackButton(){
  StringBuilder sb=new StringBuilder(tvPassword.getText());
  if (sb.length() != 0) {
    sb.delete(sb.length() - 1,sb.length());
    tvPassword.setText(sb.toString());
  }
}

Fixed version (ground truth):
/** 
 * Called every time the back button is pressed. If you override this method call super.  {@link #onBackButton(boolean)} to remove last character from{@link #tvPassword}
 * @param longPress
 */
protected void onBackButton(){
  StringBuilder sb=new StringBuilder(tvPassword.getText());
  if (sb.length() != 0) {
    sb.deleteCharAt(sb.length() - 1);
    tvPassword.setText(sb.toString());
  }
}
Program: 80288
Project: 80288
Buggy source:
private void killJob(Configuration conf){
  LOG.info("String_Node_Str");
  try {
    org.apache.hadoop.mapred.JobClient jobClient=new org.apache.hadoop.mapred.JobClient((org.apache.hadoop.mapred.JobConf)conf);
    JobID jobId=JobID.forName(conf.get(GuaguaMapReduceConstants.MAPRED_JOB_ID));
    RunningJob job=jobClient.getJob(jobId);
    job.killJob();
  }
 catch (  IOException ioe) {
    throw new GuaguaRuntimeException(ioe);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void killJob(Configuration conf){
  LOG.info("String_Node_Str");
  try {
    org.apache.hadoop.mapred.JobClient jobClient=new org.apache.hadoop.mapred.JobClient((org.apache.hadoop.mapred.JobConf)conf);
    JobID jobId=JobID.forName(conf.get(GuaguaMapReduceConstants.MAPRED_JOB_ID));
    RunningJob job=jobClient.getJob(jobId);
    job.killJob();
  }
 catch (  IOException ioe) {
    throw new GuaguaRuntimeException(ioe);
  }
}
Program: 80291
Project: 80291
Buggy source:
/** 
 * Start embed zookeeper server in a daemon thread.
 */
public static int startEmbedZooKeeper() throws IOException {
  final String zooKeeperWorkingDir=getZooKeeperWorkingDir();
  createFolder(zooKeeperWorkingDir);
  final String confName=zooKeeperWorkingDir + File.separator + "String_Node_Str";
  int validZkPort=getValidZooKeeperPort();
  prepZooKeeperConf(zooKeeperWorkingDir,confName,validZkPort + "String_Node_Str");
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      QuorumPeerMain.main(new String[]{confName});
    }
  }
,"String_Node_Str");
  thread.setDaemon(true);
  thread.start();
  Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
    @Override public void run(){
      try {
        FileUtils.deleteDirectory(new File(zooKeeperWorkingDir));
      }
 catch (      IOException ignore) {
      }
    }
  }
));
  return validZkPort;
}

Fixed version (ground truth):
/** 
 * Start embed zookeeper server in a daemon thread.
 */
public static int startEmbedZooKeeper() throws IOException {
  String zooKeeperWorkingDir=getZooKeeperWorkingDir();
  boolean isSuccessful=createFolder(zooKeeperWorkingDir);
  if (!isSuccessful) {
    zooKeeperWorkingDir=getZooKeeperWorkingDir("String_Node_Str" + System.currentTimeMillis());
    createFolder(zooKeeperWorkingDir);
  }
  final String confName=zooKeeperWorkingDir + File.separator + "String_Node_Str";
  int validZkPort=getValidZooKeeperPort();
  prepZooKeeperConf(zooKeeperWorkingDir,confName,validZkPort + "String_Node_Str");
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      QuorumPeerMain.main(new String[]{confName});
    }
  }
,"String_Node_Str");
  thread.setDaemon(true);
  thread.start();
  final String cleanZkFolder=zooKeeperWorkingDir;
  Runtime.getRuntime().addShutdownHook(new Thread(new Runnable(){
    @Override public void run(){
      try {
        FileUtils.deleteDirectory(new File(cleanZkFolder));
      }
 catch (      IOException ignore) {
      }
    }
  }
));
  return validZkPort;
}
Program: 80293
Project: 80293
Buggy source:
/** 
 * Retrieve zookeeper working folder.
 */
private static String getZooKeeperWorkingDir(){
  return getUserDir() + File.separator + "String_Node_Str"+ System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * Retrieve zookeeper working folder.
 */
private static String getZooKeeperWorkingDir(String subFolder){
  return getUserDir() + File.separator + subFolder;
}
Program: 80294
Project: 80294
Buggy source:
/** 
 * Create a folder with folder name, if exist, delete it firstly.
 */
private static void createFolder(String folder) throws IOException {
  File file=new File(folder);
  try {
    FileUtils.deleteDirectory(file);
  }
 catch (  IOException ignore) {
  }
  if (!file.mkdir()) {
    throw new IllegalStateException("String_Node_Str" + folder + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Create a folder with folder name, if exist, delete it firstly.
 */
private static boolean createFolder(String folder) throws IOException {
  File file=new File(folder);
  try {
    FileUtils.deleteDirectory(file);
  }
 catch (  IOException ignore) {
    return false;
  }
  return file.mkdir();
}
Program: 80296
Project: 80296
Buggy source:
@Override public WORKER_RESULT compute(WorkerContext<MASTER_RESULT,WORKER_RESULT> context) throws IOException {
  if (this.isLoaded.compareAndSet(false,true)) {
    init(context);
    long start=System.nanoTime();
    preLoad(context);
    long count=0;
    for (    GuaguaFileSplit fileSplit : context.getFileSplits()) {
      LOG.info("String_Node_Str",fileSplit);
      try {
        initRecordReader(fileSplit);
        LOG.info("String_Node_Str" + "String_Node_Str" + fileSplit.getExtension() + "String_Node_Str"+ fileSplit);
        context.setAttachment(fileSplit.getExtension());
        while (getRecordReader().nextKeyValue()) {
          load(getRecordReader().getCurrentKey(),getRecordReader().getCurrentValue(),context);
          ++count;
        }
      }
  finally {
        if (getRecordReader() != null) {
          getRecordReader().close();
        }
      }
    }
    postLoad(context);
    LOG.info("String_Node_Str",count);
    LOG.info("String_Node_Str",TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
  }
  long start=System.nanoTime();
  try {
    return doCompute(context);
  }
  finally {
    LOG.info("String_Node_Str",context.getAppId(),context.getContainerId(),context.getCurrentIteration(),TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
  }
}

Fixed version (ground truth):
@Override public WORKER_RESULT compute(WorkerContext<MASTER_RESULT,WORKER_RESULT> context) throws IOException {
  if (this.isLoaded.compareAndSet(false,true)) {
    init(context);
    long start=System.nanoTime();
    preLoad(context);
    long count=0;
    for (    GuaguaFileSplit fileSplit : context.getFileSplits()) {
      LOG.info("String_Node_Str",fileSplit);
      try {
        initRecordReader(fileSplit);
        LOG.info("String_Node_Str",fileSplit.getExtension(),fileSplit);
        context.setAttachment(fileSplit.getExtension());
        while (getRecordReader().nextKeyValue()) {
          load(getRecordReader().getCurrentKey(),getRecordReader().getCurrentValue(),context);
          count+=1L;
        }
      }
  finally {
        if (getRecordReader() != null) {
          getRecordReader().close();
        }
      }
    }
    if (count == 0L) {
      throw new IllegalStateException("String_Node_Str");
    }
    postLoad(context);
    LOG.info("String_Node_Str",count);
    LOG.info("String_Node_Str",TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
  }
  long start=System.nanoTime();
  try {
    return doCompute(context);
  }
  finally {
    LOG.info("String_Node_Str",context.getAppId(),context.getContainerId(),context.getCurrentIteration(),TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
  }
}
Program: 80298
Project: 80298
Buggy source:
/** 
 * Compute the progress of the current job submitted through the JobControl object jc to the JobClient jobClient
 * @param jc The JobControl object that has been submitted
 * @param jobClient The JobClient to which it has been submitted
 * @return The progress as a percentage in double format
 * @throws IOException In case any IOException connecting to JobTracker.
 */
protected double calculateProgress(JobControl jc,JobClient jobClient) throws IOException {
  double prog=0.0;
  prog+=jc.getSuccessfulJobList().size();
  List<ControlledJob> runnJobs=jc.getRunningJobList();
  for (  ControlledJob cjob : runnJobs) {
    prog+=progressOfRunningJob(cjob,jobClient);
  }
  return prog;
}

Fixed version (ground truth):
/** 
 * Compute the progress of the current job submitted through the JobControl object jc to the JobClient jobClient
 * @param jc The JobControl object that has been submitted
 * @param jobClient The JobClient to which it has been submitted
 * @return The progress as a percentage in double format
 * @throws IOException In case any IOException connecting to JobTracker.
 */
protected double calculateProgress(Set<String> successJobs,JobControl jc,JobClient jobClient) throws IOException {
  double prog=0.0;
  prog+=Math.max(jc.getSuccessfulJobList().size(),successJobs.size());
  List<ControlledJob> runnJobs=jc.getRunningJobList();
  for (  ControlledJob cjob : runnJobs) {
    prog+=progressOfRunningJob(cjob,jobClient);
  }
  return prog;
}
Program: 80299
Project: 80299
Buggy source:
@Override protected void setup(Context context) throws java.io.IOException, InterruptedException {
  GuaguaInputSplit inputSplit=(GuaguaInputSplit)context.getInputSplit();
  this.setMaster(inputSplit.isMaster());
  if (this.isMaster()) {
    context.setStatus("String_Node_Str");
    this.setGuaguaService(new GuaguaMasterService<MASTER_RESULT,WORKER_RESULT>());
  }
 else {
    context.setStatus("String_Node_Str");
    this.setGuaguaService(new GuaguaWorkerService<MASTER_RESULT,WORKER_RESULT>());
    List<GuaguaFileSplit> splits=new LinkedList<GuaguaFileSplit>();
    for (int i=0; i < inputSplit.getFileSplits().length; i++) {
      FileSplit fs=inputSplit.getFileSplits()[i];
      GuaguaFileSplit gfs=new GuaguaFileSplit(fs.getPath().toString(),fs.getStart(),fs.getLength());
      if (inputSplit.getExtensions() != null && i < inputSplit.getExtensions().length) {
        LOG.info("String_Node_Str" + inputSplit + "String_Node_Str"+ i+ "String_Node_Str"+ inputSplit.getExtensions()[i]);
        gfs.setExtension(inputSplit.getExtensions()[i]);
      }
      splits.add(gfs);
    }
    this.getGuaguaService().setSplits(splits);
  }
  Properties props=replaceConfToProps(context.getConfiguration());
  this.getGuaguaService().setAppId(context.getConfiguration().get(GuaguaMapReduceConstants.MAPRED_JOB_ID));
  this.getGuaguaService().setContainerId(context.getConfiguration().get(GuaguaMapReduceConstants.MAPRED_TASK_PARTITION));
  this.getGuaguaService().init(props);
  this.getGuaguaService().start();
}

Fixed version (ground truth):
@Override protected void setup(Context context) throws java.io.IOException, InterruptedException {
  GuaguaInputSplit inputSplit=(GuaguaInputSplit)context.getInputSplit();
  this.setMaster(inputSplit.isMaster());
  if (this.isMaster()) {
    context.setStatus("String_Node_Str");
    this.setGuaguaService(new GuaguaMasterService<MASTER_RESULT,WORKER_RESULT>());
  }
 else {
    context.setStatus("String_Node_Str");
    this.setGuaguaService(new GuaguaWorkerService<MASTER_RESULT,WORKER_RESULT>());
    List<GuaguaFileSplit> splits=new LinkedList<GuaguaFileSplit>();
    for (int i=0; i < inputSplit.getFileSplits().length; i++) {
      FileSplit fs=inputSplit.getFileSplits()[i];
      GuaguaFileSplit gfs=new GuaguaFileSplit(fs.getPath().toString(),fs.getStart(),fs.getLength());
      if (inputSplit.getExtensions() != null && i < inputSplit.getExtensions().length) {
        gfs.setExtension(inputSplit.getExtensions()[i]);
      }
      splits.add(gfs);
    }
    this.getGuaguaService().setSplits(splits);
  }
  Properties props=replaceConfToProps(context.getConfiguration());
  this.getGuaguaService().setAppId(context.getConfiguration().get(GuaguaMapReduceConstants.MAPRED_JOB_ID));
  this.getGuaguaService().setContainerId(context.getConfiguration().get(GuaguaMapReduceConstants.MAPRED_TASK_PARTITION));
  this.getGuaguaService().init(props);
  this.getGuaguaService().start();
}
Program: 80304
Project: 80304
Buggy source:
private int getLatestMasterIteration(final WorkerContext<MASTER_RESULT,WORKER_RESULT> context){
  try {
    String masterBaseNode=getMasterBaseNode(context.getAppId()).toString();
    List<String> masterIterations=null;
    try {
      masterIterations=getZooKeeper().getChildrenExt(masterBaseNode,false,false,false,new Filter(){
        @Override public boolean filter(        String path){
          try {
            Integer.parseInt(path);
            return false;
          }
 catch (          Exception e) {
            return true;
          }
        }
      }
);
    }
 catch (    KeeperException.NoNodeException e) {
      LOG.warn("String_Node_Str",masterBaseNode);
    }
    if (masterIterations != null && masterIterations.size() > 0) {
      Collections.sort(masterIterations,new Comparator<String>(){
        @Override public int compare(        String o1,        String o2){
          return Integer.valueOf(o1).compareTo(Integer.valueOf(o2));
        }
      }
);
      LOG.info("String_Node_Str",masterIterations);
      try {
        return Integer.valueOf(masterIterations.get(masterIterations.size() - 1));
      }
 catch (      NumberFormatException e) {
        throw new GuaguaRuntimeException(e);
      }
    }
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
  }
catch (  Exception e) {
    throw new GuaguaRuntimeException(e);
  }
  throw new GuaguaRuntimeException("String_Node_Str");
}

Fixed version (ground truth):
private int getLatestMasterIteration(final WorkerContext<MASTER_RESULT,WORKER_RESULT> context){
  try {
    String masterBaseNode=getMasterBaseNode(context.getAppId()).toString();
    List<String> masterIterations=null;
    try {
      masterIterations=getZooKeeper().getChildrenExt(masterBaseNode,false,false,false,new Filter(){
        @Override public boolean filter(        String path){
          try {
            Integer.parseInt(path);
            return false;
          }
 catch (          Exception e) {
            return true;
          }
        }
      }
);
    }
 catch (    KeeperException.NoNodeException e) {
      LOG.warn("String_Node_Str",masterBaseNode);
    }
    if (masterIterations != null && masterIterations.size() > 0) {
      Collections.sort(masterIterations,new Comparator<String>(){
        @Override public int compare(        String o1,        String o2){
          return Integer.valueOf(o1).compareTo(Integer.valueOf(o2));
        }
      }
);
      LOG.debug("String_Node_Str",masterIterations);
      try {
        return Integer.valueOf(masterIterations.get(masterIterations.size() - 1));
      }
 catch (      NumberFormatException e) {
        throw new GuaguaRuntimeException(e);
      }
    }
  }
 catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
  }
catch (  Exception e) {
    throw new GuaguaRuntimeException(e);
  }
  throw new GuaguaRuntimeException("String_Node_Str");
}
Program: 80306
Project: 80306
Buggy source:
/** 
 * A ugly method to retrieve hdp version like 2.2.4.6633 from hadoop-hdfs jar name. The jar name is like 'hadoop-hdfs-2.6.0.2.2.4.6633.jar'.
 */
public static String getHdpVersionForHDP224(){
  String hdfsJarWithVersion=findContainingJar(DistributedFileSystem.class);
  String hdpVersion="String_Node_Str";
  if (hdfsJarWithVersion != null) {
    if (hdfsJarWithVersion.contains(File.separator)) {
      hdfsJarWithVersion=hdfsJarWithVersion.substring(hdfsJarWithVersion.lastIndexOf(File.separator) + 1);
    }
    hdfsJarWithVersion=hdfsJarWithVersion.replace("String_Node_Str","String_Node_Str");
    hdfsJarWithVersion=hdfsJarWithVersion.replace("String_Node_Str","String_Node_Str");
    String[] splits=hdfsJarWithVersion.split("String_Node_Str");
    if (splits.length > 2) {
      for (int i=3; i < splits.length; i++) {
        if (i == splits.length - 1) {
          hdpVersion+=splits[i];
        }
 else {
          hdpVersion+=splits[i] + "String_Node_Str";
        }
      }
    }
  }
  return hdpVersion;
}

Fixed version (ground truth):
/** 
 * A ugly method to retrieve hdp version like 2.2.4.6633 from hadoop-hdfs jar name. The jar name is like 'hadoop-hdfs-2.6.0.2.2.4.6633.jar'.
 */
public static String getHdpVersionForHDP224(){
  String hdfsJarWithVersion=findContainingJar(DistributedFileSystem.class);
  StringBuilder hdpVersion=new StringBuilder(20);
  if (hdfsJarWithVersion != null) {
    if (hdfsJarWithVersion.contains(File.separator)) {
      hdfsJarWithVersion=hdfsJarWithVersion.substring(hdfsJarWithVersion.lastIndexOf(File.separator) + 1);
    }
    hdfsJarWithVersion=hdfsJarWithVersion.replace("String_Node_Str","String_Node_Str");
    hdfsJarWithVersion=hdfsJarWithVersion.replace("String_Node_Str","String_Node_Str");
    String[] splits=hdfsJarWithVersion.split("String_Node_Str");
    if (splits.length > 2) {
      for (int i=3; i < splits.length; i++) {
        if (i == splits.length - 1) {
          hdpVersion.append(splits[i]);
        }
 else {
          hdpVersion.append(splits[i]).append("String_Node_Str");
        }
      }
    }
  }
  return hdpVersion.toString();
}
Program: 80309
Project: 80309
Buggy source:
@Override public synchronized boolean add(WorkerResultWrapper e){
  this.rawSize+=1;
  if (e.isWorkerCombinable()) {
    if (this.currIndex == this.threshold - 1) {
      while (this.currIndex > 0) {
        e.combine(this.removeLast());
        this.currIndex-=1;
      }
      return super.add(e);
    }
 else {
      this.currIndex+=1;
      return super.add(e);
    }
  }
 else {
    return super.add(e);
  }
}

Fixed version (ground truth):
@Override public synchronized boolean add(WorkerResultWrapper e){
  this.rawSize+=1;
  if (e.isWorkerCombinable()) {
    this.currIndex+=1;
    if (this.currIndex == this.threshold - 1) {
      while (this.currIndex > 1) {
        e.combine(this.removeLast());
        this.currIndex-=1;
      }
      if (currIndex != 1) {
        throw new IllegalStateException();
      }
      return super.add(e);
    }
 else {
      return super.add(e);
    }
  }
 else {
    return super.add(e);
  }
}
Program: 80310
Project: 80310
Buggy source:
private void initIterResults(Properties props){
synchronized (LOCK) {
    boolean nonSpill="String_Node_Str".equalsIgnoreCase(props.getProperty(GuaguaConstants.GUAGUA_MASTER_RESULT_NONSPILL,"String_Node_Str"));
    if (nonSpill) {
      int mergeThreshold=NumberFormatUtils.getInt(props.getProperty(GuaguaConstants.GUAGUA_MASTER_RESULT_MERGE_THRESHOLD,"String_Node_Str"),10);
      this.iterResults=new MergeWorkerResultList(mergeThreshold);
    }
 else {
      BytableDiskList<WorkerResultWrapper> bytableDiskList=new BytableDiskList<WorkerResultWrapper>(System.currentTimeMillis() + "String_Node_Str",WorkerResultWrapper.class.getName());
      double memoryFraction=Double.valueOf(props.getProperty(GuaguaConstants.GUAGUA_MASTER_WORKERESULTS_MEMORY_FRACTION,GuaguaConstants.GUAGUA_MASTER_WORKERESULTS_DEFAULT_MEMORY_FRACTION));
      long memoryStoreSize=(long)(Runtime.getRuntime().maxMemory() * memoryFraction);
      LOG.info("String_Node_Str",memoryStoreSize);
      this.iterResults=new BytableMemoryDiskList<WorkerResultWrapper>(memoryStoreSize,bytableDiskList);
    }
  }
}

Fixed version (ground truth):
private void initIterResults(Properties props){
synchronized (LOCK) {
    boolean nonSpill="String_Node_Str".equalsIgnoreCase(props.getProperty(GuaguaConstants.GUAGUA_MASTER_RESULT_NONSPILL,"String_Node_Str"));
    if (nonSpill && isWorkerCombinable(props.getProperty(GuaguaConstants.GUAGUA_WORKER_RESULT_CLASS))) {
      int mergeThreshold=NumberFormatUtils.getInt(props.getProperty(GuaguaConstants.GUAGUA_MASTER_RESULT_MERGE_THRESHOLD,"String_Node_Str"),10);
      this.iterResults=new MergeWorkerResultList(mergeThreshold);
    }
 else {
      BytableDiskList<WorkerResultWrapper> bytableDiskList=new BytableDiskList<WorkerResultWrapper>(System.currentTimeMillis() + "String_Node_Str",WorkerResultWrapper.class.getName());
      double memoryFraction=Double.valueOf(props.getProperty(GuaguaConstants.GUAGUA_MASTER_WORKERESULTS_MEMORY_FRACTION,GuaguaConstants.GUAGUA_MASTER_WORKERESULTS_DEFAULT_MEMORY_FRACTION));
      long memoryStoreSize=(long)(Runtime.getRuntime().maxMemory() * memoryFraction);
      LOG.info("String_Node_Str",memoryStoreSize);
      this.iterResults=new BytableMemoryDiskList<WorkerResultWrapper>(memoryStoreSize,bytableDiskList);
    }
  }
}
Program: 80311
Project: 80311
Buggy source:
public MergeWorkerResultList(int threshold){
  this.threshold=threshold;
}

Fixed version (ground truth):
public MergeWorkerResultList(int threshold){
  if (threshold <= 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.threshold=threshold;
}
Program: 80313
Project: 80313
Buggy source:
@Override public boolean retryExecution() throws KeeperException, InterruptedException {
  int doneWorkers;
synchronized (LOCK) {
    doneWorkers=(int)NettyMasterCoordinator.this.iterResults.size();
  }
  if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start) > 120 * 1000L) {
    LOG.info("String_Node_Str",doneWorkers,(context.getWorkers() - doneWorkers));
    return true;
  }
  if (System.nanoTime() % 30 == 0) {
    LOG.info("String_Node_Str",doneWorkers,(context.getWorkers() - doneWorkers));
  }
  return isTerminated(doneWorkers,context.getWorkers(),GuaguaConstants.GUAGUA_DEFAULT_MIN_WORKERS_RATIO,GuaguaConstants.GUAGUA_DEFAULT_MIN_WORKERS_TIMEOUT);
}

Fixed version (ground truth):
@Override public boolean retryExecution() throws KeeperException, InterruptedException {
  int doneWorkers;
synchronized (LOCK) {
    doneWorkers=(int)NettyMasterCoordinator.this.iterResults.size();
  }
  if (TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start) > 120 * 1000L) {
    LOG.info("String_Node_Str" + "String_Node_Str",doneWorkers,(context.getWorkers() - doneWorkers));
    return true;
  }
  if (System.nanoTime() % 30 == 0) {
    LOG.info("String_Node_Str" + "String_Node_Str",doneWorkers,(context.getWorkers() - doneWorkers));
  }
  return isTerminated(doneWorkers,context.getWorkers(),GuaguaConstants.GUAGUA_DEFAULT_MIN_WORKERS_RATIO,GuaguaConstants.GUAGUA_DEFAULT_MIN_WORKERS_TIMEOUT);
}
Program: 80314
Project: 80314
Buggy source:
/** 
 * Re-open stream for iterators.
 */
public void reOpen(){
  close();
  try {
    this.inputStream=new FileInputStream(file);
  }
 catch (  FileNotFoundException e) {
    throw new GuaguaRuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Re-open stream for iterators.
 */
public void reOpen(){
  close();
  try {
    this.inputStream=new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
  }
 catch (  FileNotFoundException e) {
    throw new GuaguaRuntimeException(e);
  }
}
Program: 80315
Project: 80315
Buggy source:
@Override public T next(){
  try {
    int length=DiskList.this.inputStream.read();
    byte[] bytes=new byte[length];
    int size=DiskList.this.inputStream.read(bytes);
    if (size < 0) {
      throw new GuaguaRuntimeException("String_Node_Str");
    }
    return DiskList.this.getSerializer().deserialize(bytes,null);
  }
 catch (  IOException e) {
    throw new GuaguaRuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public T next(){
  try {
    int length=DiskList.this.inputStream.readInt();
    byte[] bytes=new byte[length];
    for (int i=0; i < bytes.length; i++) {
      bytes[i]=DiskList.this.inputStream.readByte();
    }
    return DiskList.this.getSerializer().deserialize(bytes,null);
  }
 catch (  IOException e) {
    throw new GuaguaRuntimeException(e);
  }
}