nus-yam/ex-repair huggingface dataset:
Program: 40697
Project: 40697
Buggy source:
@Override public void onSuccess(){
  Log.v(TAG,"String_Node_Str");
  if (mAttacher != null) {
    Log.v(TAG,"String_Node_Str");
    mAttacher.update();
  }
 else {
    Log.v(TAG,"String_Node_Str");
    mAttacher=new PhotoViewAttacher(mImgDisplay);
    mAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener(){
      @Override public void onViewTap(      View view,      float x,      float y){
        Log.v(TAG,"String_Node_Str");
        if (galleryImage.getVisibility() == View.INVISIBLE) {
          galleryImage.setVisibility(View.VISIBLE);
        }
 else {
          galleryImage.setVisibility(View.INVISIBLE);
        }
      }
    }
);
    Log.v(TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onSuccess(){
  Log.v(TAG,"String_Node_Str");
  mAttacher=new PhotoViewAttacher(mImgDisplay);
  mAttacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener(){
    @Override public void onViewTap(    View view,    float x,    float y){
      Log.v(TAG,"String_Node_Str");
      if (galleryCaption.getVisibility() == View.INVISIBLE) {
        galleryCaption.setVisibility(View.VISIBLE);
      }
 else {
        galleryCaption.setVisibility(View.INVISIBLE);
      }
    }
  }
);
  Log.v(TAG,"String_Node_Str");
}
Program: 40698
Project: 40698
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.switch_accounts:
    handleUserAccount();
  return true;
case R.id.pick_categories:
Intent pickCategoriesIntent=new Intent(MainActivity.this,CategoryListActivity.class);
startActivity(pickCategoriesIntent);
return true;
case R.id.about_theapp:
Intent aboutAppIntent=new Intent(MainActivity.this,AboutActivity.class);
startActivity(aboutAppIntent);
return true;
case R.id.remove_accounts:
if (mCurrentUser.isTempUser()) {
mSharedPref.ClearAllSharedPreferences();
Intent startIntent=new Intent(MainActivity.this,StartActivity.class);
startActivity(startIntent);
}
 else {
mCurrentUser.removeAccounts(new ListUser.AuthCallback(){
@Override public void onSuccess(String authtoken){
Intent startIntent=new Intent(MainActivity.this,StartActivity.class);
startActivity(startIntent);
}
}
);
}
return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.switch_accounts:
    handleUserAccount();
  return true;
case R.id.pick_categories:
Intent pickCategoriesIntent=new Intent(MainActivity.this,CategoryListActivity.class);
startActivity(pickCategoriesIntent);
return true;
case R.id.about_theapp:
Intent aboutAppIntent=new Intent(MainActivity.this,AboutActivity.class);
startActivity(aboutAppIntent);
return true;
case R.id.remove_accounts:
if (mCurrentUser.isTempUser()) {
mSharedPref.ClearAllSharedPreferences();
Intent startIntent=new Intent(MainActivity.this,StartActivity.class);
startActivity(startIntent);
}
 else {
mCurrentUser.removeAccounts(new ListUser.AuthCallback(){
@Override public void onSuccess(String authtoken){
mSharedPref.ClearAllSharedPreferences();
Intent startIntent=new Intent(MainActivity.this,StartActivity.class);
startActivity(startIntent);
}
}
);
}
return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 40699
Project: 40699
Buggy source:
@Override public void onSuccess(String authtoken){
  Intent startIntent=new Intent(MainActivity.this,StartActivity.class);
  startActivity(startIntent);
}

Fixed version (ground truth):
@Override public void onSuccess(String authtoken){
  mSharedPref.ClearAllSharedPreferences();
  Intent startIntent=new Intent(MainActivity.this,StartActivity.class);
  startActivity(startIntent);
}
Program: 40700
Project: 40700
Buggy source:
@Override public void onFail(){
  Log.d(TAG,"String_Node_Str");
  displayUserListItems();
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      mUploadProgressBar.setVisibility(View.GONE);
    }
  }
,500);
}

Fixed version (ground truth):
@Override public void onFail(){
  mItemToBeUploaded.setError(true);
  Log.d(TAG,"String_Node_Str");
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      mUploadProgressBar.setVisibility(View.GONE);
      displayUserListItems();
    }
  }
,500);
}
Program: 40701
Project: 40701
Buggy source:
@Override public void run(){
  mUploadProgressBar.setVisibility(View.GONE);
}

Fixed version (ground truth):
@Override public void run(){
  mUploadProgressBar.setVisibility(View.GONE);
  displayUserListItems();
}
Program: 40702
Project: 40702
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case PhotoConstants.PICK_PHOTO_REQUEST:
case PhotoConstants.TAKE_PHOTO_REQUEST:
    if (resultCode == RESULT_OK) {
      if (data == null) {
        Toast.makeText(this,getString(R.string.general_error),Toast.LENGTH_LONG).show();
      }
 else {
        mMediaUri=data.getData();
      }
      Log.i(TAG,"String_Node_Str" + mMediaUri);
      Intent mediaScanIntent=new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
      mediaScanIntent.setData(mMediaUri);
      sendBroadcast(mediaScanIntent);
      startPhotoUpload();
    }
 else     if (resultCode != RESULT_CANCELED) {
      Toast.makeText(this,R.string.general_error,Toast.LENGTH_SHORT).show();
    }
  break;
}
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case PhotoConstants.PICK_PHOTO_REQUEST:
case PhotoConstants.TAKE_PHOTO_REQUEST:
    if (resultCode == RESULT_OK) {
      mItemToBeUploaded=mCurrentItem;
      uploadItemPosition=activeItemPosition;
      mItemToBeUploaded.setProgress(true);
      mFeedAdapter.notifyDataSetChanged();
      if (data == null) {
        Toast.makeText(this,getString(R.string.general_error),Toast.LENGTH_LONG).show();
      }
 else {
        mMediaUri=data.getData();
      }
      Log.i(TAG,"String_Node_Str" + mMediaUri);
      Intent mediaScanIntent=new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
      mediaScanIntent.setData(mMediaUri);
      sendBroadcast(mediaScanIntent);
      startPhotoUpload();
    }
 else     if (resultCode != RESULT_CANCELED) {
      Toast.makeText(this,R.string.general_error,Toast.LENGTH_SHORT).show();
    }
  break;
}
}
Program: 40703
Project: 40703
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.switch_accounts:
    handleUserAccount();
  return true;
case R.id.pick_categories:
Intent pickCategoriesIntent=new Intent(MainActivity.this,CategoryListActivity.class);
startActivity(pickCategoriesIntent);
return true;
case R.id.about_theapp:
Intent aboutAppIntent=new Intent(MainActivity.this,AboutActivity.class);
startActivity(aboutAppIntent);
return true;
case R.id.remove_accounts:
Intent startIntent=new Intent(Settings.ACTION_SETTINGS);
mSharedPref.ClearAllSharedPreferences();
mCurrentUser.removeAccounts(new ListUser.AuthCallback(){
@Override public void onSuccess(String authtoken){
Intent startIntent=new Intent(MainActivity.this,StartActivity.class);
startActivity(startIntent);
}
}
);
return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.switch_accounts:
    handleUserAccount();
  return true;
case R.id.pick_categories:
Intent pickCategoriesIntent=new Intent(MainActivity.this,CategoryListActivity.class);
startActivity(pickCategoriesIntent);
return true;
case R.id.about_theapp:
Intent aboutAppIntent=new Intent(MainActivity.this,AboutActivity.class);
startActivity(aboutAppIntent);
return true;
case R.id.remove_accounts:
mSharedPref.ClearAllSharedPreferences();
mCurrentUser.removeAccounts(new ListUser.AuthCallback(){
@Override public void onSuccess(String authtoken){
Intent startIntent=new Intent(MainActivity.this,StartActivity.class);
startActivity(startIntent);
}
}
);
return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 40704
Project: 40704
Buggy source:
public void performUpload(){
  mRequestMethods.uploadPhoto(mCurrentItem.getItemID(),mMediaUri,new RequestMethods.RequestCallback(){
    @Override public void onSuccess(){
      Log.d(TAG,"String_Node_Str");
      displayUserListItems();
      new Handler().postDelayed(new Runnable(){
        @Override public void run(){
          mUploadProgressBar.setVisibility(View.GONE);
        }
      }
,500);
    }
    @Override public void onFail(){
      Log.d(TAG,"String_Node_Str");
      displayUserListItems();
      new Handler().postDelayed(new Runnable(){
        @Override public void run(){
          mUploadProgressBar.setVisibility(View.GONE);
        }
      }
,500);
    }
  }
);
}

Fixed version (ground truth):
public void performUpload(){
  mRequestMethods.uploadPhoto(mItemToBeUploaded.getItemID(),mMediaUri,new RequestMethods.RequestCallback(){
    @Override public void onSuccess(){
      Log.d(TAG,"String_Node_Str");
      mItemToBeUploaded=null;
      displayUserListItems();
      new Handler().postDelayed(new Runnable(){
        @Override public void run(){
          mUploadProgressBar.setVisibility(View.GONE);
        }
      }
,500);
    }
    @Override public void onFail(){
      mItemToBeUploaded.setError(true);
      Log.d(TAG,"String_Node_Str");
      new Handler().postDelayed(new Runnable(){
        @Override public void run(){
          mUploadProgressBar.setVisibility(View.GONE);
          displayUserListItems();
        }
      }
,500);
    }
  }
);
}
Program: 40705
Project: 40705
Buggy source:
@Override public void onResume(){
  super.onResume();
  invalidateOptionsMenu();
  if (!mFab.isVisible()) {
    mFab.show();
  }
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      mFab.setEnabled(true);
    }
  }
,500);
  if (!(mCurrentUser.isTempUser())) {
    displayUserListItems();
    Log.v("String_Node_Str","String_Node_Str");
  }
 else {
    Log.v("String_Node_Str","String_Node_Str");
    if (mItemList.size() == 0) {
      Log.v("String_Node_Str","String_Node_Str");
      mRecyclerView.setVisibility(View.INVISIBLE);
      displayUserListItems();
    }
 else {
      Log.v("String_Node_Str","String_Node_Str");
      mFeedAdapter.notifyDataSetChanged();
      mRecyclerView.setVisibility(View.VISIBLE);
    }
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  invalidateOptionsMenu();
  if (mItemToBeUploaded != null) {
    mItemList.remove(uploadItemPosition);
    mFeedAdapter.notifyDataSetChanged();
  }
  if (!mFab.isVisible()) {
    mFab.show();
  }
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      mFab.setEnabled(true);
    }
  }
,500);
  if (!(mCurrentUser.isTempUser())) {
    displayUserListItems();
    Log.v("String_Node_Str","String_Node_Str");
  }
 else {
    Log.v("String_Node_Str","String_Node_Str");
    if (mItemList.size() == 0) {
      Log.v("String_Node_Str","String_Node_Str");
      mRecyclerView.setVisibility(View.INVISIBLE);
      displayUserListItems();
    }
 else {
      Log.v("String_Node_Str","String_Node_Str");
      mFeedAdapter.notifyDataSetChanged();
      mRecyclerView.setVisibility(View.VISIBLE);
    }
  }
}
Program: 40706
Project: 40706
Buggy source:
@Override public void onBindViewHolder(FeedViewholder holder,int position){
  MainListItem l=listItems.get(position);
  holder.itemView.setVisibility(View.VISIBLE);
  holder.nameLabel.setText(l.getItemName());
  holder.makerLabel.setText("String_Node_Str" + l.getMakerName());
switch (getItemViewType(position)) {
case DEFAULT_VIEW:
    holder.iconImageView.setImageResource(R.drawable.ic_camera_alt_grey600_24dp);
  break;
case ERROR_VIEW:
holder.iconImageView.setImageResource(R.drawable.ic_error_red_24dp);
break;
}
holder.itemView.setTag(l);
}

Fixed version (ground truth):
@Override public void onBindViewHolder(FeedViewholder holder,int position){
  MainListItem l=listItems.get(position);
  holder.itemView.setVisibility(View.VISIBLE);
  holder.nameLabel.setText(l.getItemName());
  holder.makerLabel.setText("String_Node_Str" + l.getMakerName());
switch (getItemViewType(position)) {
case ERROR_VIEW:
    holder.iconImageView.setImageResource(R.drawable.ic_error_red_24dp);
  break;
case DEFAULT_VIEW:
holder.iconImageView.setImageResource(R.drawable.ic_camera_alt_grey600_24dp);
break;
}
holder.itemView.setTag(l);
}
Program: 40707
Project: 40707
Buggy source:
public MainListItem(String id,String name,String maker){
  this.itemID=itemID;
  this.itemName=name;
  this.makerName=maker;
  this.error=false;
}

Fixed version (ground truth):
public MainListItem(String id,String name,String maker){
  this.itemID=itemID;
  this.itemName=name;
  this.makerName=maker;
  this.error=false;
  this.progress=false;
}
Program: 40708
Project: 40708
Buggy source:
public void RemoveUserItemPreference(String itemID){
  SharedPreferences sharedPref=mContext.getSharedPreferences(APP_PREFERENCES_KEY,Context.MODE_PRIVATE);
  String listOfValues=sharedPref.getString(LIST_ITEM_PREFERENCE_KEY,null);
  Log.v("String_Node_Str",itemID);
  JsonParser parser=new JsonParser();
  JsonElement element=parser.parse(listOfValues);
  JsonArray array=element.getAsJsonArray();
  Log.v("String_Node_Str",array.toString());
  for (int i=0; i < array.size(); i++) {
    String singleItem=array.get(i).getAsString();
    if (singleItem.equals(itemID)) {
      Log.v("String_Node_Str",singleItem);
      array.remove(i);
    }
  }
  SharedPreferences.Editor editor=sharedPref.edit();
  editor.putString(LIST_ITEM_PREFERENCE_KEY,array.toString());
  editor.apply();
}

Fixed version (ground truth):
public void RemoveUserItemPreference(String itemID){
  SharedPreferences sharedPref=mContext.getSharedPreferences(APP_PREFERENCES_KEY,Context.MODE_PRIVATE);
  String listOfValues=sharedPref.getString(LIST_ITEM_PREFERENCE_KEY,null);
  if (listOfValues == null) {
    return;
  }
  Log.v("String_Node_Str",itemID);
  JsonParser parser=new JsonParser();
  JsonElement element=parser.parse(listOfValues);
  JsonArray array=element.getAsJsonArray();
  Log.v("String_Node_Str",array.toString());
  for (int i=0; i < array.size(); i++) {
    String singleItem=array.get(i).getAsString();
    if (singleItem.equals(itemID)) {
      Log.v("String_Node_Str",singleItem);
      array.remove(i);
    }
  }
  SharedPreferences.Editor editor=sharedPref.edit();
  editor.putString(LIST_ITEM_PREFERENCE_KEY,array.toString());
  editor.apply();
}
Program: 40709
Project: 40709
Buggy source:
@Override public void onResponse(JSONObject response){
  try {
    mPutResponse=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
    Log.v(TAG,mPutResponse.toString());
    mProgressBar.setVisibility(View.INVISIBLE);
  }
 catch (  JSONException e) {
    Log.e(TAG,e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void onResponse(JSONObject response){
  try {
    mPutResponse=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
    mProgressBar.setVisibility(View.INVISIBLE);
  }
 catch (  JSONException e) {
    Log.e(TAG,e.getMessage());
  }
}
Program: 40710
Project: 40710
Buggy source:
private void storeCategoriesRequest(){
  RequestQueue queue=Volley.newRequestQueue(this);
  String userID=mCurrentUser.getUserID();
  String url=ApiConstants.UPDATE_USER + userID;
  JSONObject UserCategoriesObject=sharedPreferencesMethods.createCategoryListObject(ApiConstants.USER_CATEGORIES,mContext);
  Log.v(TAG,UserCategoriesObject.toString());
  JsonObjectRequest putCategoriesRequest=new JsonObjectRequest(Request.Method.PUT,url,UserCategoriesObject,new Response.Listener<JSONObject>(){
    @Override public void onResponse(    JSONObject response){
      try {
        mPutResponse=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
        Log.v(TAG,mPutResponse.toString());
        mProgressBar.setVisibility(View.INVISIBLE);
      }
 catch (      JSONException e) {
        Log.e(TAG,e.getMessage());
      }
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
      requestMethods.updateDisplayForError();
    }
  }
);
  queue.add(putCategoriesRequest);
}

Fixed version (ground truth):
private void storeCategoriesRequest(){
  RequestQueue queue=Volley.newRequestQueue(this);
  String userID=mCurrentUser.getUserID();
  String url=ApiConstants.UPDATE_USER + userID;
  JSONObject UserCategoriesObject=sharedPreferencesMethods.createCategoryListObject(ApiConstants.USER_CATEGORIES,mContext);
  JsonObjectRequest putCategoriesRequest=new JsonObjectRequest(Request.Method.PUT,url,UserCategoriesObject,new Response.Listener<JSONObject>(){
    @Override public void onResponse(    JSONObject response){
      try {
        mPutResponse=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
        mProgressBar.setVisibility(View.INVISIBLE);
      }
 catch (      JSONException e) {
        Log.e(TAG,e.getMessage());
      }
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
      requestMethods.updateDisplayForError();
    }
  }
);
  queue.add(putCategoriesRequest);
}
Program: 40711
Project: 40711
Buggy source:
@Override public void onResume(){
  super.onResume();
  Bundle b=getArguments();
  STATUS status=(STATUS)b.getSerializable("String_Node_Str");
  mTitle=(TextView)getView().findViewById(R.id.confirm_title);
  mText=(TextView)getView().findViewById(R.id.confirm_text);
switch (status) {
case CANCEL:
    addConfirmText(getString(R.string.upload_cancelled_title),getString(R.string.upload_cancelled_text));
  break;
case SUCCESS:
addConfirmText(getString(R.string.upload_success_title),getString(R.string.upload_success_text));
break;
case FAILURE:
addConfirmText(getString(R.string.upload_failed_title),getString(R.string.upload_failed_text));
break;
}
mCallback.onConfirmFinish();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  Bundle b=getArguments();
  STATUS status=(STATUS)b.getSerializable("String_Node_Str");
  mTitle=(TextView)getView().findViewById(R.id.confirm_title);
  mText=(TextView)getView().findViewById(R.id.confirm_text);
  mIcon=(ImageView)getView().findViewById(R.id.confirm_icon);
switch (status) {
case CANCEL:
    addConfirmText(getString(R.string.upload_cancelled_title),getString(R.string.upload_cancelled_text));
  break;
case SUCCESS:
addConfirmText(getString(R.string.upload_success_title),getString(R.string.upload_success_text));
break;
case FAILURE:
addConfirmText(getString(R.string.upload_failed_title),getString(R.string.upload_failed_text));
break;
}
mCallback.onConfirmFinish();
}
Program: 40712
Project: 40712
Buggy source:
@Override public void onResponse(JSONObject response){
  try {
    mUserData=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
    Log.v("String_Node_Str",mUserData.toString());
    JSONObject data=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
    mCallback.UserCreated(mUserData.toString());
  }
 catch (  JSONException e) {
    Log.e(TAG,e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void onResponse(JSONObject response){
  try {
    mUserData=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
    JSONObject data=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
    mCallback.UserCreated(mUserData.toString());
  }
 catch (  JSONException e) {
    Log.e(TAG,e.getMessage());
  }
}
Program: 40713
Project: 40713
Buggy source:
private void createNewUser(){
  RequestQueue queue=Volley.newRequestQueue(getActivity());
  String url=ApiConstants.CREATE_NEW_USER;
  JSONObject categoryListObject=sharedPreferencesMethods.createCategoryListObject(ApiConstants.USER_CATEGORIES,getActivity());
  JSONObject userItemObject=sharedPreferencesMethods.createUserItemsObject(ApiConstants.USER_ITEMS,getActivity());
  final JSONObject userObject=new JSONObject();
  try {
    userObject.put(ApiConstants.USER_EMAIL,mEmail);
    userObject.put(ApiConstants.USER_PASSWORD,mPassword);
    userObject.put(ApiConstants.USER_NAME,mUsername);
    userObject.put(ApiConstants.USER_CATEGORIES,categoryListObject.getJSONArray(ApiConstants.USER_CATEGORIES));
    userObject.put(ApiConstants.USER_ITEMS,userItemObject.getJSONArray(ApiConstants.USER_ITEMS));
  }
 catch (  JSONException e) {
    Log.v(TAG,e.getMessage());
  }
  Log.v(TAG,userObject.toString());
  JsonObjectRequest newUserRequest=new JsonObjectRequest(Request.Method.POST,url,userObject,new Response.Listener<JSONObject>(){
    @Override public void onResponse(    JSONObject response){
      try {
        mUserData=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
        Log.v("String_Node_Str",mUserData.toString());
        JSONObject data=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
        mCallback.UserCreated(mUserData.toString());
      }
 catch (      JSONException e) {
        Log.e(TAG,e.getMessage());
      }
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
    }
  }
);
  queue.add(newUserRequest);
}

Fixed version (ground truth):
private void createNewUser(){
  RequestQueue queue=Volley.newRequestQueue(getActivity());
  String url=ApiConstants.CREATE_NEW_USER;
  JSONObject categoryListObject=sharedPreferencesMethods.createCategoryListObject(ApiConstants.USER_CATEGORIES,getActivity());
  JSONObject userItemObject=sharedPreferencesMethods.createUserItemsObject(ApiConstants.USER_ITEMS,getActivity());
  final JSONObject userObject=new JSONObject();
  try {
    userObject.put(ApiConstants.USER_EMAIL,mEmail);
    userObject.put(ApiConstants.USER_PASSWORD,mPassword);
    userObject.put(ApiConstants.USER_NAME,mUsername);
    userObject.put(ApiConstants.USER_CATEGORIES,categoryListObject.getJSONArray(ApiConstants.USER_CATEGORIES));
    userObject.put(ApiConstants.USER_ITEMS,userItemObject.getJSONArray(ApiConstants.USER_ITEMS));
  }
 catch (  JSONException e) {
    Log.v(TAG,e.getMessage());
  }
  JsonObjectRequest newUserRequest=new JsonObjectRequest(Request.Method.POST,url,userObject,new Response.Listener<JSONObject>(){
    @Override public void onResponse(    JSONObject response){
      try {
        mUserData=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
        JSONObject data=response.getJSONObject(ApiConstants.RESPONSE_CONTENT);
        mCallback.UserCreated(mUserData.toString());
      }
 catch (      JSONException e) {
        Log.e(TAG,e.getMessage());
      }
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
    }
  }
);
  queue.add(newUserRequest);
}
Program: 40715
Project: 40715
Buggy source:
@Override public void onConfirmFinish(){
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      getSupportFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).remove(confirmFragment).commit();
    }
  }
,20000);
  mFrameLayout.setClickable(false);
  getSupportActionBar().show();
}

Fixed version (ground truth):
@Override public void onConfirmFinish(){
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      getSupportFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).remove(confirmFragment).commit();
    }
  }
,3000);
  mFrameLayout.setClickable(false);
  getSupportActionBar().show();
}
Program: 40717
Project: 40717
Buggy source:
private void putRandomItemsRequest(){
  RequestQueue queue=Volley.newRequestQueue(this);
  String userID=mCurrentUser.getUserID();
  String url="String_Node_Str" + userID;
  JSONArray userPreferences=sharedPreferencesMethods.RetrieveSharedPreference(sharedPreferencesMethods.LIST_ITEM_PREFERENCE,sharedPreferencesMethods.LIST_ITEM_PREFERENCE_KEY,this);
  JSONObject jso=new JSONObject();
  try {
    jso.put(ApiConstants.USER_ITEMS,userPreferences);
  }
 catch (  JSONException e) {
    Log.e(TAG,e.getMessage());
  }
  Log.v(TAG,jso.toString());
  JsonObjectRequest putItemsRequest=new JsonObjectRequest(Request.Method.PUT,url,jso,new Response.Listener<JSONObject>(){
    @Override public void onResponse(    JSONObject response){
      mPutResponse=response;
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
      requestMethods.updateDisplayForError();
    }
  }
);
  queue.add(putItemsRequest);
}

Fixed version (ground truth):
private void putRandomItemsRequest(){
  RequestQueue queue=Volley.newRequestQueue(this);
  String userID=mCurrentUser.getUserID();
  String url="String_Node_Str" + userID;
  JSONArray userPreferences=sharedPreferencesMethods.RetrieveSharedPreference(sharedPreferencesMethods.LIST_ITEM_PREFERENCE,sharedPreferencesMethods.LIST_ITEM_PREFERENCE_KEY,this);
  JSONObject jso=new JSONObject();
  try {
    jso.put(ApiConstants.USER_ITEMS,userPreferences);
  }
 catch (  JSONException e) {
    Log.e(TAG,e.getMessage());
  }
  JsonObjectRequest putItemsRequest=new JsonObjectRequest(Request.Method.PUT,url,jso,new Response.Listener<JSONObject>(){
    @Override public void onResponse(    JSONObject response){
      mPutResponse=response;
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
      requestMethods.updateDisplayForError();
    }
  }
);
  queue.add(putItemsRequest);
}
Program: 40718
Project: 40718
Buggy source:
@Override public void onResume(){
  super.onResume();
  mCheckBox=(CheckBox)getView().findViewById(R.id.checkBox);
  mNextButton=(Button)getView().findViewById(R.id.nextButton);
  mCancelButton=(Button)getView().findViewById(R.id.cancelButton);
  mCheckBox.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (mCheckBox.isChecked()) {
        mNextButton.setVisibility(View.VISIBLE);
      }
 else {
        mNextButton.setVisibility(View.INVISIBLE);
      }
    }
  }
);
  mNextButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mCallback.onTermsClicked();
    }
  }
);
  mCancelButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mCallback.onTermsCancelled();
    }
  }
);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  mCheckBox=(CheckBox)getView().findViewById(R.id.checkBox);
  mNextButton=(Button)getView().findViewById(R.id.nextButton);
  mCancelButton=(TextView)getView().findViewById(R.id.cancelButton);
  mLearnMoreButton=(TextView)getView().findViewById(R.id.learnMoreButton);
  mCheckBox.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      if (mCheckBox.isChecked()) {
        mNextButton.setVisibility(View.VISIBLE);
      }
 else {
        mNextButton.setVisibility(View.INVISIBLE);
      }
    }
  }
);
  mNextButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mCallback.onTermsClicked();
    }
  }
);
  mCancelButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mCallback.onTermsCancelled();
    }
  }
);
  if (mLearnMoreButton != null) {
    mLearnMoreButton.setMovementMethod(LinkMovementMethod.getInstance());
  }
}
Program: 40720
Project: 40720
Buggy source:
public static void generateChunk(MinecraftServer server,int x,int z,int dimensionID){
  ChunkProviderServer cps=server.worldServerForDimension(dimensionID).getChunkProvider();
  if (!chunkPrepared(cps,x,z,dimensionID)) {
    cps.loadChunk(x,z);
    cps.loadChunk(x,z + 1);
    cps.loadChunk(x + 1,z);
    cps.loadChunk(x + 1,z + 1);
  }
}

Fixed version (ground truth):
public static void generateChunk(MinecraftServer server,int x,int z,int dimensionID){
  ChunkProviderServer cps=server.worldServerForDimension(dimensionID).getChunkProvider();
  if (!chunkPrepared(cps,x,z,dimensionID)) {
    cps.provideChunk(x,z).needsSaving(true);
    cps.provideChunk(x,z + 1).needsSaving(true);
    cps.provideChunk(x + 1,z).needsSaving(true);
    cps.provideChunk(x + 1,z + 1).needsSaving(true);
  }
}
Program: 40723
Project: 40723
Buggy source:
public static void main(String[] args) throws IOException, GeneralSecurityException {
  PipelineOptionsFactory.register(TransformNonVariantSegmentData.Options.class);
  TransformNonVariantSegmentData.Options options=PipelineOptionsFactory.fromArgs(args).withValidation().as(TransformNonVariantSegmentData.Options.class);
  Preconditions.checkState(options.getHasNonVariantSegments(),"String_Node_Str" + "String_Node_Str");
  OfflineAuth auth=GenomicsOptions.Methods.getGenomicsAuth(options);
  List<StreamVariantsRequest> requests=options.isAllReferences() ? ShardUtils.getVariantRequests(options.getVariantSetId(),ShardUtils.SexChromosomeFilter.EXCLUDE_XY,options.getBasesPerShard(),auth) : ShardUtils.getVariantRequests(options.getVariantSetId(),options.getReferences(),options.getBasesPerShard());
  Pipeline p=Pipeline.create(options);
  PCollection<Variant> variants=p.begin().apply(Create.of(requests)).apply(new VariantStreamer(auth,ShardBoundary.Requirement.STRICT,null));
  PCollection<Variant> filteredVariants=options.getOmitLowQualityCalls() ? variants.apply(ParDo.of(new FilterCallsFn())) : variants;
  JoinNonVariantSegmentsWithVariants.joinVariantsTransform(filteredVariants).apply(ParDo.of(new FlagVariantsWithAmbiguousCallsFn())).apply(ParDo.of(new FormatVariantsFn())).apply(BigQueryIO.Write.to(options.getOutputTable()).withSchema(getTableSchema()).withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED).withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_TRUNCATE));
  p.run();
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, GeneralSecurityException {
  PipelineOptionsFactory.register(TransformNonVariantSegmentData.Options.class);
  TransformNonVariantSegmentData.Options options=PipelineOptionsFactory.fromArgs(args).withValidation().as(TransformNonVariantSegmentData.Options.class);
  Preconditions.checkState(options.getHasNonVariantSegments(),"String_Node_Str" + "String_Node_Str");
  OfflineAuth auth=GenomicsOptions.Methods.getGenomicsAuth(options);
  List<StreamVariantsRequest> requests=options.isAllReferences() ? ShardUtils.getVariantRequests(options.getVariantSetId(),ShardUtils.SexChromosomeFilter.INCLUDE_XY,options.getBasesPerShard(),auth) : ShardUtils.getVariantRequests(options.getVariantSetId(),options.getReferences(),options.getBasesPerShard());
  Pipeline p=Pipeline.create(options);
  PCollection<Variant> variants=p.begin().apply(Create.of(requests)).apply(new VariantStreamer(auth,ShardBoundary.Requirement.STRICT,null));
  PCollection<Variant> filteredVariants=options.getOmitLowQualityCalls() ? variants.apply(ParDo.of(new FilterCallsFn())) : variants;
  JoinNonVariantSegmentsWithVariants.joinVariantsTransform(filteredVariants).apply(ParDo.of(new FlagVariantsWithAmbiguousCallsFn())).apply(ParDo.of(new FormatVariantsFn())).apply(BigQueryIO.Write.to(options.getOutputTable()).withSchema(getTableSchema()).withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED).withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_TRUNCATE));
  p.run();
}
Program: 40724
Project: 40724
Buggy source:
@Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
  if (!config.modEnabled) {
    return;
  }
  debug(String.valueOf(config.disableProximity));
  if (!config.disableProximity) {
    return;
  }
  int device_type=(int)param.args[0];
  if (device_type == 8) {
    param.setResult(null);
  }
  return;
}

Fixed version (ground truth):
@Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
  if (!config.modEnabled) {
    return;
  }
  debug(String.valueOf(config.disableProximity));
  if (!config.disableProximity) {
    return;
  }
  int sensorType=(int)param.args[0];
  if (sensorType == Sensor.TYPE_PROXIMITY) {
    param.setResult(null);
  }
  return;
}
Program: 40725
Project: 40725
Buggy source:
@Override public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpp) throws Throwable {
  if (lpp.packageName.equals(BuildConfig.APPLICATION_ID)) {
    findAndHookMethod(XApp.class,"String_Node_Str",XC_MethodReplacement.returnConstant(true));
  }
  if (!lpp.packageName.equals(HANGOUTS_PKG_NAME)) {
    return;
  }
  Object activityThread=callStaticMethod(ACTIVITY_THREAD,ACTIVITY_THREAD_CURRENTACTHREAD);
  Context systemCtx=(Context)callMethod(activityThread,ACTIVITY_THREAD_GETSYSCTX);
  config.reload(systemCtx);
  if (!config.modEnabled) {
    return;
  }
  debug("String_Node_Str",false);
  debug(String.format("String_Node_Str",BuildConfig.VERSION_NAME,BuildConfig.VERSION_CODE),false);
  final PackageInfo pi=systemCtx.getPackageManager().getPackageInfo(HANGOUTS_PKG_NAME,0);
  debug(String.format("String_Node_Str",pi.versionName,pi.versionCode),false);
  if (pi.versionCode > TESTED_VERSION_INT + VERSION_TOLERANCE || pi.versionCode < TESTED_VERSION_INT - VERSION_TOLERANCE) {
    log(String.format("String_Node_Str",TESTED_VERSION_STR,TESTED_VERSION_INT),false);
  }
  for (  Module mod : modules) {
    try {
      mod.hook(lpp.classLoader);
    }
 catch (    ClassNotFoundError|InvocationTargetError|NoSuchMethodError ex) {
      log("String_Node_Str" + ex.getClass().getSimpleName() + "String_Node_Str"+ mod.getClass().getSimpleName()+ "String_Node_Str",false);
      debug(ex);
    }
  }
  debug("String_Node_Str",false);
}

Fixed version (ground truth):
@Override public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpp) throws Throwable {
  if (lpp.packageName.equals(BuildConfig.APPLICATION_ID)) {
    findAndHookMethod(XApp.class.getName(),lpp.classLoader,"String_Node_Str",XC_MethodReplacement.returnConstant(true));
    return;
  }
  if (!lpp.packageName.equals(HANGOUTS_PKG_NAME)) {
    return;
  }
  Object activityThread=callStaticMethod(ACTIVITY_THREAD,ACTIVITY_THREAD_CURRENTACTHREAD);
  Context systemCtx=(Context)callMethod(activityThread,ACTIVITY_THREAD_GETSYSCTX);
  config.reload(systemCtx);
  if (!config.modEnabled) {
    return;
  }
  debug("String_Node_Str",false);
  debug(String.format("String_Node_Str",BuildConfig.VERSION_NAME,BuildConfig.VERSION_CODE),false);
  final PackageInfo pi=systemCtx.getPackageManager().getPackageInfo(HANGOUTS_PKG_NAME,0);
  debug(String.format("String_Node_Str",pi.versionName,pi.versionCode),false);
  if (pi.versionCode > TESTED_VERSION_INT + VERSION_TOLERANCE || pi.versionCode < TESTED_VERSION_INT - VERSION_TOLERANCE) {
    log(String.format("String_Node_Str",TESTED_VERSION_STR,TESTED_VERSION_INT),false);
  }
  for (  Module mod : modules) {
    try {
      mod.hook(lpp.classLoader);
    }
 catch (    ClassNotFoundError|InvocationTargetError|NoSuchMethodError ex) {
      log("String_Node_Str" + ex.getClass().getSimpleName() + "String_Node_Str"+ mod.getClass().getSimpleName()+ "String_Node_Str",false);
      debug(ex);
    }
  }
  debug("String_Node_Str",false);
}
Program: 40728
Project: 40728
Buggy source:
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  Config.reload((Context)param.args[0]);
  if (Config.modEnabled) {
    Setting.UiEnterKey enterKey=Setting.UiEnterKey.fromInt(Config.enterKey);
    debug(String.format("String_Node_Str",enterKey.name()));
    if (enterKey != Setting.UiEnterKey.EMOJI_SELECTOR) {
      EditText et=(EditText)XposedHelpers.getObjectField(param.thisObject,HANGOUTS_VIEWS_COMPOSEMSGVIEW_EDITTEXT);
      et.setInputType(et.getInputType() ^ InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE);
    }
  }
}

Fixed version (ground truth):
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable {
  Config.reload((Context)param.args[0]);
  if (Config.modEnabled) {
    Setting.UiEnterKey enterKey=Setting.UiEnterKey.fromInt(Config.enterKey);
    debug(String.format("String_Node_Str",enterKey.name()));
    if (enterKey != Setting.UiEnterKey.EMOJI_SELECTOR) {
      EditText et=(EditText)XposedHelpers.getObjectField(param.thisObject,HANGOUTS_VIEWS_COMPOSEMSGVIEW_EDITTEXT);
      int inputType=et.getInputType() ^ InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
      if (enterKey == Setting.UiEnterKey.SEND) {
        inputType^=InputType.TYPE_TEXT_FLAG_MULTI_LINE;
      }
      et.setInputType(inputType);
    }
  }
}
Program: 40729
Project: 40729
Buggy source:
private String errorMessage(Object request,List<Object> recordedRequests){
  StringBuilder msg=new StringBuilder();
  msg.append("String_Node_Str").append(request).append("String_Node_Str").append("String_Node_Str");
  for (  Object r : recordedRequests) {
    msg.append("String_Node_Str").append(r.toString()).append("String_Node_Str").append("String_Node_Str");
  }
  msg.append("String_Node_Str").append(request).append("String_Node_Str");
  return msg.toString();
}

Fixed version (ground truth):
private String errorMessage(Object request,List<Object> recordedRequests){
  StringBuilder msg=new StringBuilder();
  msg.append("String_Node_Str").append(request).append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str").append("String_Node_Str");
  for (  Object r : recordedRequests) {
    msg.append("String_Node_Str").append(r.toString()).append("String_Node_Str").append("String_Node_Str");
  }
  msg.append("String_Node_Str").append(request).append("String_Node_Str");
  return msg.toString();
}
Program: 40730
Project: 40730
Buggy source:
@Override public Object create(Object request,SpecimenContext context){
  if (!(request instanceof SpecimenType)) {
    return new NoSpecimen();
  }
  SpecimenType type=(SpecimenType)request;
  if (!BaseDateTime.class.isAssignableFrom(type.getRawType())) {
    return new NoSpecimen();
  }
  try {
    Date date=(Date)context.resolve(Date.class);
    long instant=date.getTime();
    return type.getRawType().getDeclaredConstructor(long.class).newInstance(instant);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return new NoSpecimen();
  }
}

Fixed version (ground truth):
@Override public Object create(Object request,SpecimenContext context){
  if (!(request instanceof SpecimenType)) {
    return new NoSpecimen();
  }
  SpecimenType type=(SpecimenType)request;
  if (!BaseDateTime.class.isAssignableFrom(type.getRawType())) {
    return new NoSpecimen();
  }
  try {
    Date date=(Date)context.resolve(Date.class);
    long instant=date.getTime();
    DateTimeZone timeZone=(DateTimeZone)context.resolve(DateTimeZone.class);
    return type.getRawType().getDeclaredConstructor(long.class,DateTimeZone.class).newInstance(instant,timeZone);
  }
 catch (  Exception e) {
    e.printStackTrace();
    return new NoSpecimen();
  }
}
Program: 40731
Project: 40731
Buggy source:
@Override public Object create(Object request,SpecimenContext context){
  if (!(request.equals(ReadablePeriod.class) || request.equals(ReadWritablePeriod.class)))   return new NoSpecimen();
  Duration duration=(Duration)context.resolve(Duration.class);
  return new MutablePeriod(duration);
}

Fixed version (ground truth):
@Override public Object create(Object request,SpecimenContext context){
  if (!(request.equals(ReadablePeriod.class) || request.equals(ReadWritablePeriod.class)))   return new NoSpecimen();
  DateTime dateA=(DateTime)context.resolve(DateTime.class);
  DateTime dateB=(DateTime)context.resolve(DateTime.class);
  if (dateA.isBefore(dateB))   return new MutablePeriod(dateA,dateB);
 else   return new MutablePeriod(dateB,dateA);
}
Program: 40732
Project: 40732
Buggy source:
@Test @Ignore("String_Node_Str") public void creates_instance_of_ReadablePeriod() throws ParseException {
  ReadablePeriod period=fixture.create(ReadablePeriod.class);
  assertThat(period,notNullValue());
  assertThat(period,Matchers.<ReadablePeriod>is(new MutablePeriod(8760,0,0,0)));
}

Fixed version (ground truth):
@Test public void creates_instance_of_ReadablePeriod() throws ParseException {
  ReadablePeriod period=fixture.create(ReadablePeriod.class);
  assertThat(period,notNullValue());
  assertThat(period,Matchers.<ReadablePeriod>is(new MutablePeriod(1,0,0,0,0,0,0,0)));
}
Program: 40733
Project: 40733
Buggy source:
@Test @Ignore("String_Node_Str") public void creates_instance_of_ReadWritablePeriod() throws ParseException {
  ReadWritablePeriod period=fixture.create(ReadWritablePeriod.class);
  assertThat(period,notNullValue());
  assertThat(period,Matchers.<ReadablePeriod>is(Period.hours(8760)));
}

Fixed version (ground truth):
@Test public void creates_instance_of_ReadWritablePeriod() throws ParseException {
  ReadWritablePeriod period=fixture.create(ReadWritablePeriod.class);
  assertThat(period,notNullValue());
  assertThat(period,Matchers.<ReadablePeriod>is(new MutablePeriod(1,0,0,0,0,0,0,0)));
}
Program: 40734
Project: 40734
Buggy source:
protected void reduce(NullWritable key,Iterable<AdmmReducerContextWritable> values,Context context) throws IOException, InterruptedException {
  for (  AdmmReducerContextWritable reducerContextWritable : values) {
    AdmmReducerContext reducerContext=reducerContextWritable.get();
    if (null == this.zUpdated) {
      this.zUpdated=reducerContext.getZUpdated();
      this.rho=reducerContext.getRho();
      this.lambda=reducerContext.getLambdaValue();
      this.count=reducerContext.getCount();
    }
 else {
      double[] zUpdated=reducerContext.getZUpdated();
      for (int i=0; i < zUpdated.length; i++) {
        this.zUpdated[i]+=zUpdated[i];
      }
      this.count+=reducerContext.getCount();
    }
  }
}

Fixed version (ground truth):
protected void reduce(NullWritable key,Iterable<AdmmReducerContextWritable> values,Context context) throws IOException, InterruptedException {
  for (  AdmmReducerContextWritable reducerContextWritable : values) {
    AdmmReducerContext reducerContext=reducerContextWritable.get();
    if (null == this.xUpdated) {
      this.xUpdated=reducerContext.getXUpdated();
      this.uInital=reducerContext.getUInitial();
      this.rho=reducerContext.getRho();
      this.lambda=reducerContext.getLambdaValue();
      this.count=reducerContext.getCount();
    }
 else {
      double[] xUpdated=reducerContext.getXUpdated();
      LOG.info(xUpdated.toString());
      for (int i=0; i < xUpdated.length; i++) {
        this.xUpdated[i]+=xUpdated[i];
      }
      double[] uInital=reducerContext.getUInitial();
      LOG.info(uInital.toString());
      for (int i=0; i < uInital.length; i++) {
        this.uInital[i]+=uInital[i];
      }
      this.count+=reducerContext.getCount();
    }
  }
}
Program: 40735
Project: 40735
Buggy source:
protected void cleanup(Context context) throws IOException, InterruptedException {
  this.zMultiplier=this.rho * this.count / (this.rho * this.count + 2 * this.lambda);
  for (int i=0; i < zUpdated.length; i++) {
    this.zUpdated[i]/=this.count;
    if (i == 0 && !regularizeIntercept) {
    }
 else {
      this.zUpdated[i]*=this.zMultiplier;
    }
  }
  Configuration conf=context.getConfiguration();
  Path outputPath=FileOutputFormat.getOutputPath(context);
  Path previousOutput=new Path(conf.get("String_Node_Str"));
  FileSystem fs=previousOutput.getFileSystem(conf);
  double sNorm=calculateSNorm(previousOutput,zUpdated,fs,conf);
  double rNorm=calculateRNorm(outputPath,zUpdated,fs,conf);
  if (rNorm > THRESHOLD || sNorm > THRESHOLD) {
    context.getCounter(IterationCounter.ITERATION).increment(1);
  }
  double rhoMultiplier=0;
  if (rNorm > RHO_UPDATE_THRESHOLD * sNorm) {
    rhoMultiplier=RHO_INCREMENT_MULTIPLIER;
  }
 else   if (sNorm > RHO_UPDATE_THRESHOLD * rNorm) {
    rhoMultiplier=1.0 / RHO_DECREMENT_MULTIPLIER;
  }
 else {
    rhoMultiplier=1.0;
  }
  AdmmReducerContext reducerContext=new AdmmReducerContext(null,null,null,zUpdated,0.0,rho * rhoMultiplier,lambda,(long)0);
  context.write(NullWritable.get(),new AdmmReducerContextWritable(reducerContext));
}

Fixed version (ground truth):
protected void cleanup(Context context) throws IOException, InterruptedException {
  for (int i=0; i < xUpdated.length; i++) {
    xUpdated[i]/=count;
  }
  for (int i=0; i < uInital.length; i++) {
    uInital[i]/=count;
  }
  this.zMultiplier=this.rho * this.count / (this.rho * this.count + 2 * this.lambda);
  double[] zUpdated=new double[xUpdated.length];
  for (int i=0; i < zUpdated.length; i++) {
    zUpdated[i]/=this.count;
    if (i == 0 && !regularizeIntercept) {
      zUpdated[i]=xUpdated[i] + uInital[i];
    }
 else {
      zUpdated[i]=(xUpdated[i] + uInital[i]) * this.zMultiplier;
    }
  }
  Configuration conf=context.getConfiguration();
  Path outputPath=FileOutputFormat.getOutputPath(context);
  FileSystem fs=outputPath.getFileSystem(conf);
  LOG.info("String_Node_Str");
  double sNorm=calculateSNorm(uInital,xUpdated);
  double rNorm=calculateRNorm(outputPath,xUpdated,fs,conf);
  LOG.info("String_Node_Str",rNorm,sNorm);
  if (rNorm > THRESHOLD || sNorm > THRESHOLD) {
    context.getCounter(IterationCounter.ITERATION).increment(1);
    LOG.info("String_Node_Str",context.getCounter(IterationCounter.ITERATION).getValue());
  }
  double rhoMultiplier=0;
  if (rNorm > RHO_UPDATE_THRESHOLD * sNorm) {
    rhoMultiplier=RHO_INCREMENT_MULTIPLIER;
  }
 else   if (sNorm > RHO_UPDATE_THRESHOLD * rNorm) {
    rhoMultiplier=1.0 / RHO_DECREMENT_MULTIPLIER;
  }
 else {
    rhoMultiplier=1.0;
  }
  AdmmReducerContext reducerContext=new AdmmReducerContext(null,null,null,zUpdated,0.0,rho * rhoMultiplier,lambda,(long)0);
  context.write(NullWritable.get(),new AdmmReducerContextWritable(reducerContext));
}
Program: 40736
Project: 40736
Buggy source:
private double calculateSNorm(Path previousOutput,double[] xUpdated,FileSystem fs,Configuration conf) throws IOException {
  LOG.info("String_Node_Str");
  double result=calculateS(previousOutput,fs,conf,xUpdated);
  result*=Math.pow(rho,2);
  result*=this.count;
  result=Math.pow(result,SQUARE_ROOT_POWER);
  LOG.info("String_Node_Str",result);
  return result;
}

Fixed version (ground truth):
private double calculateSNorm(double[] xInitial,double[] xUpdated){
  double result=0.0;
  for (int i=0; i < xUpdated.length; i++) {
    result+=Math.pow(xUpdated[i] - xInitial[i],2);
  }
  result*=Math.pow(rho,2);
  result*=this.count;
  result=Math.pow(result,SQUARE_ROOT_POWER);
  return result;
}
Program: 40737
Project: 40737
Buggy source:
@Override protected void setup(Context context) throws IOException, InterruptedException {
  Configuration conf=context.getConfiguration();
  regularizeIntercept=conf.getBoolean("String_Node_Str",false);
  zUpdated=null;
  count=0;
}

Fixed version (ground truth):
@Override protected void setup(Context context) throws IOException, InterruptedException {
  Configuration conf=context.getConfiguration();
  regularizeIntercept=conf.getBoolean("String_Node_Str",false);
  xUpdated=null;
  uInital=null;
  count=0;
}
Program: 40738
Project: 40738
Buggy source:
private double calculateRNorm(Path outputPath,double[] xUpdated,FileSystem fs,Configuration conf){
  LOG.info("String_Node_Str");
  double result=0.0;
  try {
    result=calculateR(outputPath,fs,conf,xUpdated);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  result=Math.pow(result,SQUARE_ROOT_POWER);
  LOG.info("String_Node_Str",result);
  return result;
}

Fixed version (ground truth):
private double calculateRNorm(Path outputPath,double[] xUpdated,FileSystem fs,Configuration conf){
  double result=0.0;
  try {
    result=calculateR(outputPath,fs,conf,xUpdated);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  result=Math.pow(result,SQUARE_ROOT_POWER);
  return result;
}