nus-yam/ex-repair huggingface dataset:
Program: 174174
Project: 174174
Buggy source:
public <T>T getService(Class<T> interfaze,int timeout){
  return proxy.create(interfaze,(proxy,method,args) -> {
    String url="String_Node_Str" + host + "String_Node_Str"+ port+ "String_Node_Str"+ interfaze.getName();
    AutumnRPCRequest request=AutumnRPCRequest.builder().methodName(method.getName()).paramTypes(method.getParameterTypes()).params(args).build();
    byte[] payload=serialization.serializeRequest(request);
    byte[] response=httpClient.post(url,payload,serialization.contentType(),timeout);
    AutumnRPCResponse rpcResponse=serialization.deserializeResponse(response,method.getReturnType());
    if (rpcResponse.getStatus() == STATUS_OK) {
      return rpcResponse.getResult();
    }
 else {
      throw (Throwable)rpcResponse.getResult();
    }
  }
);
}

Fixed version (ground truth):
public <T>T getService(Class<T> interfaze,int timeout){
  return proxy.create(interfaze,(proxy,method,args) -> {
    String url="String_Node_Str" + host + "String_Node_Str"+ port+ "String_Node_Str"+ interfaze.getName();
    AutumnRPCRequest request=AutumnRPCRequest.builder().methodName(method.getName()).paramTypes(method.getParameterTypes()).params(args).build();
    byte[] payload=serialization.serializeRequest(request);
    byte[] response=httpClient.post(url,payload,serialization.contentType(),timeout);
    AutumnRPCResponse rpcResponse=serialization.deserializeResponse(response,method.getReturnType());
    if (rpcResponse.getStatus() == STATUS_OK) {
      return serialization.convertTypes(new Object[]{rpcResponse.getResult()},new Type[]{method.getGenericReturnType()})[0];
    }
 else {
      throw (Throwable)rpcResponse.getResult();
    }
  }
);
}
Program: 174175
Project: 174175
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public AutumnRPCResponse deserializeResponse(byte[] buf,Class defaultReturnType) throws AutumnSerializationException {
  try {
    JsonNode root=mapper.readTree(buf);
    if (root.isArray() && root.size() >= 2) {
      Class returnType=defaultReturnType;
      if (root.size() >= 3) {
        try {
          returnType=getClass(root.get(2).textValue());
        }
 catch (        ClassNotFoundException ignored) {
        }
      }
      return AutumnRPCResponse.builder().status(root.get(0).intValue()).result(mapper.treeToValue(root.get(1),returnType)).resultType(returnType).build();
    }
  }
 catch (  IOException e) {
    throw new AutumnSerializationException(e);
  }
  throw new AutumnSerializationException("String_Node_Str");
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public AutumnRPCResponse deserializeResponse(byte[] buf,Class defaultReturnType) throws AutumnSerializationException {
  try {
    JsonNode root=mapper.readTree(buf);
    if (root.isArray() && root.size() >= 2) {
      Class returnType=defaultReturnType;
      Object result=root.get(1);
      if (root.size() >= 3) {
        try {
          returnType=getClass(root.get(2).textValue());
          result=mapper.treeToValue(((JsonNode)result),returnType);
        }
 catch (        ClassNotFoundException ignored) {
        }
      }
      return AutumnRPCResponse.builder().status(root.get(0).intValue()).result(result).resultType(returnType).build();
    }
  }
 catch (  IOException e) {
    throw new AutumnSerializationException(e);
  }
  throw new AutumnSerializationException("String_Node_Str");
}
Program: 174176
Project: 174176
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public AutumnRPCRequest deserializeRequest(byte[] buf) throws AutumnSerializationException {
  try {
    JsonNode root=mapper.readTree(buf);
    if (root.isArray() && root.size() >= 3) {
      Class[] paramTypes=null;
      if (root.get(1).isArray()) {
        paramTypes=new Class[root.get(1).size()];
      }
      Object[] params=new Object[root.get(2).size()];
      for (int i=0; i < root.get(2).size(); i++) {
        if (paramTypes != null && paramTypes.length > i) {
          paramTypes[i]=getClass(root.get(1).get(i).textValue());
        }
        params[i]=root.get(2).get(i);
      }
      return AutumnRPCRequest.builder().methodName(root.get(0).textValue()).paramTypes(paramTypes).params(params).build();
    }
  }
 catch (  IOException|ClassNotFoundException e) {
    throw new AutumnSerializationException(e);
  }
  throw new AutumnSerializationException("String_Node_Str");
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public AutumnRPCRequest deserializeRequest(byte[] buf) throws AutumnSerializationException {
  try {
    JsonNode root=mapper.readTree(buf);
    if (root.isArray() && root.size() >= 3) {
      Class[] paramTypes=null;
      if (root.get(1).isArray()) {
        paramTypes=new Class[root.get(1).size()];
      }
      JsonNode[] params=new JsonNode[root.get(2).size()];
      for (int i=0; i < root.get(2).size(); i++) {
        if (paramTypes != null && paramTypes.length > i) {
          paramTypes[i]=getClass(root.get(1).get(i).textValue());
        }
        params[i]=root.get(2).get(i);
      }
      return AutumnRPCRequest.builder().methodName(root.get(0).textValue()).paramTypes(paramTypes).params(params).build();
    }
  }
 catch (  IOException|ClassNotFoundException e) {
    throw new AutumnSerializationException(e);
  }
  throw new AutumnSerializationException("String_Node_Str");
}
Program: 174177
Project: 174177
Buggy source:
public static void main(String[] args) throws RemoteException {
  AutumnRPCServer.start("String_Node_Str");
  AutumnRPCClient client=new AutumnRPCClient("String_Node_Str",8801,"String_Node_Str",true);
  TestService testService=client.getService(TestService.class);
  System.out.println(testService.echo("String_Node_Str"));
  System.out.println(testService.testEnum(1));
  System.out.println(testService.testObject("String_Node_Str",new MyObject(MyEnum.D)));
  System.out.println(testService.testArray(new Object[]{null,null,null}));
  System.out.println(testService.testList(Arrays.asList(new MyObject(MyEnum.A),new MyObject(MyEnum.B),new MyObject(MyEnum.C),new MyObject(MyEnum.D))));
  try {
    testService.testThrowException("String_Node_Str");
  }
 catch (  Exception e) {
    System.out.println(e);
  }
  System.out.println(testService.testReturnException("String_Node_Str"));
}

Fixed version (ground truth):
public static void main(String[] args) throws RemoteException {
  AutumnRPCServer.start("String_Node_Str");
  AutumnRPCClient client=new AutumnRPCClient("String_Node_Str",8801,"String_Node_Str",true);
  TestService testService=client.getService(TestService.class);
  System.out.println(testService.echo("String_Node_Str"));
  System.out.println(testService.testEnum(1));
  System.out.println(testService.testObject("String_Node_Str",new MyObject(MyEnum.D)));
  System.out.println(testService.testArray(new Object[]{null,null,null}));
  System.out.println(testService.testList(Arrays.asList(new MyObject(MyEnum.A),new MyObject(MyEnum.B),new MyObject(MyEnum.C),new MyObject(MyEnum.D))).get(0).getMyEnum());
  try {
    testService.testThrowException("String_Node_Str");
  }
 catch (  Exception e) {
    System.out.println(e);
  }
  System.out.println(testService.testReturnException("String_Node_Str"));
}
Program: 174178
Project: 174178
Buggy source:
String testList(List<MyObject> list) throws RemoteException ;

Fixed version (ground truth):
List<MyObject> testList(List<MyObject> list) throws RemoteException ;
Program: 174179
Project: 174179
Buggy source:
@Override public String testList(List<MyObject> list) throws RemoteException {
  StringBuilder sb=new StringBuilder("String_Node_Str");
  list.forEach(o -> sb.append(o.getMyEnum()));
  return sb.toString();
}

Fixed version (ground truth):
@Override public List<MyObject> testList(List<MyObject> list) throws RemoteException {
  return list;
}
Program: 174180
Project: 174180
Buggy source:
/** 
 * Returns a java.util.Map of the parameters of this request. <p> <p>Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
 * @return an immutable java.util.Map containing parameter names askeys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.
 */
@Override public Map<String,String[]> getParameterMap(){
  if (this.params == null) {
    Map<String,List<String>> paramsMap=new HashMap<>();
    this.parseParamString(this.getQueryString(),paramsMap);
    if (this.getMethod().toLowerCase().equals("String_Node_Str")) {
switch (this.getContentType()) {
case "String_Node_Str":
        this.parseParamString(new String(httpRequest.getBody()),paramsMap);
      break;
case "String_Node_Str":
    try {
      for (      Part part : this.getParts()) {
        if (part.getContentType().equals("String_Node_Str")) {
          byte[] buf=new byte[(int)part.getSize()];
          part.getInputStream().read(buf);
          paramsMap.computeIfAbsent(part.getName(),x -> new ArrayList<>()).add(new String(buf));
        }
      }
    }
 catch (    IOException|ServletException ignored) {
    }
  break;
}
}
this.params=new HashMap<>();
paramsMap.forEach((key,value) -> this.params.put(key,(String[])value.toArray()));
}
return Collections.unmodifiableMap(this.params);
}

Fixed version (ground truth):
/** 
 * Returns a java.util.Map of the parameters of this request. <p> <p>Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
 * @return an immutable java.util.Map containing parameter names askeys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.
 */
@Override public Map<String,String[]> getParameterMap(){
  if (this.params == null) {
    Map<String,List<String>> paramsMap=new HashMap<>();
    this.parseParamString(this.getQueryString(),paramsMap);
    if (this.getMethod().toLowerCase().equals("String_Node_Str")) {
switch (this.getContentType()) {
case "String_Node_Str":
        this.parseParamString(new String(httpRequest.getBody()),paramsMap);
      break;
case "String_Node_Str":
    try {
      for (      Part part : this.getParts()) {
        if (part.getContentType().equals("String_Node_Str")) {
          byte[] buf=new byte[(int)part.getSize()];
          part.getInputStream().read(buf);
          paramsMap.computeIfAbsent(part.getName(),x -> new ArrayList<>()).add(new String(buf));
        }
      }
    }
 catch (    IOException|ServletException ignored) {
    }
  break;
}
}
this.params=new HashMap<>();
paramsMap.forEach((key,value) -> this.params.put(key,value.toArray(new String[0])));
}
return Collections.unmodifiableMap(this.params);
}
Program: 174181
Project: 174181
Buggy source:
private void parseParamString(String paramStr,Map<String,List<String>> map){
  String[] queries=paramStr.split("String_Node_Str");
  for (  String query : queries) {
    String[] nameAndValue=query.split("String_Node_Str",2);
    if (nameAndValue.length == 2) {
      List<String> values=map.computeIfAbsent(nameAndValue[0],x -> new ArrayList<>());
      try {
        values.add(URLDecoder.decode(nameAndValue[1],this.getCharacterEncoding()));
      }
 catch (      UnsupportedEncodingException e) {
        values.add(nameAndValue[1]);
      }
    }
  }
}

Fixed version (ground truth):
private void parseParamString(String paramStr,Map<String,List<String>> map){
  if (paramStr == null) {
    return;
  }
  String[] queries=paramStr.split("String_Node_Str");
  for (  String query : queries) {
    String[] nameAndValue=query.split("String_Node_Str",2);
    if (nameAndValue.length == 2) {
      List<String> values=map.computeIfAbsent(nameAndValue[0],x -> new ArrayList<>());
      try {
        values.add(URLDecoder.decode(nameAndValue[1],this.getCharacterEncoding()));
      }
 catch (      UnsupportedEncodingException e) {
        values.add(nameAndValue[1]);
      }
    }
  }
}
Program: 174183
Project: 174183
Buggy source:
public static synchronized void requestPermission(int requestCode,@NonNull Activity target,@NonNull PermissionListener listener,@NonNull String... permissions){
  if (target == null || permissions == null)   return;
  mPermissionListener=listener;
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
    if (mPermissionListener != null)     mPermissionListener.onAllowed(requestCode,permissions);
    mPendingRequest=false;
    return;
  }
  if (mPendingRequest) {
    final HashMap<String,Integer> permissionsMap=getPermissionMap(target,permissions,null);
    int[] grantResults=new int[permissionsMap.size()];
    for (int i=0; i < grantResults.length; i++)     grantResults[i]=permissionsMap.get(permissions[i]);
    mPermissionListener.onDenied(mCommonRuntimePermissionRequest,target,requestCode,permissions,grantResults,DENIED_REASON.PENDING);
    return;
  }
  if (RuntimePermissionUtils.hasSelfPermissions(target,permissions)) {
    if (mPermissionListener != null)     mPermissionListener.onAllowed(requestCode,permissions);
    mPendingRequest=false;
  }
 else {
    if (RuntimePermissionUtils.shouldShowRequestPermissionRationale(target,permissions)) {
      if (mPermissionListener != null)       mPermissionListener.onRationale(mCommonRuntimePermissionRequest,target,requestCode,permissions);
      mPendingRequest=false;
    }
 else {
      ActivityCompat.requestPermissions(target,permissions,requestCode);
      mPendingRequest=true;
    }
  }
}

Fixed version (ground truth):
public static synchronized void requestPermission(int requestCode,@NonNull Activity target,PermissionListener listener,@NonNull String... permissions){
  if (target == null || permissions == null)   return;
  mPermissionListener=listener;
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
    if (mPermissionListener != null)     mPermissionListener.onAllowed(requestCode,permissions);
    mPendingRequest=false;
    return;
  }
  if (mPendingRequest) {
    final HashMap<String,Integer> permissionsMap=getPermissionMap(target,permissions,null);
    int[] grantResults=new int[permissionsMap.size()];
    for (int i=0; i < grantResults.length; i++)     grantResults[i]=permissionsMap.get(permissions[i]);
    mPermissionListener.onDenied(mInvokeCommonPermissionPermissionRequest,target,requestCode,permissions,grantResults,DENIED_REASON.PENDING);
    return;
  }
  if (RuntimePermissionUtils.hasSelfPermissions(target,permissions)) {
    if (mPermissionListener != null)     mPermissionListener.onAllowed(requestCode,permissions);
    mPendingRequest=false;
  }
 else {
    if (RuntimePermissionUtils.shouldShowRequestPermissionRationale(target,permissions)) {
      if (mPermissionListener != null)       mPermissionListener.onRationale(mInvokeCommonPermissionPermissionRequest,target,requestCode,permissions);
      mPendingRequest=false;
    }
 else {
      ActivityCompat.requestPermissions(target,permissions,requestCode);
      mPendingRequest=true;
    }
  }
}
Program: 174184
Project: 174184
Buggy source:
public static void onRequestPermissionsResult(Activity target,int requestCode,@NonNull String[] permissions,@NonNull int[] grantResults){
  if (RuntimePermissionUtils.verifyPermissions(grantResults)) {
    mPendingRequest=false;
    if (mPermissionListener != null)     mPermissionListener.onAllowed(requestCode,permissions);
  }
 else {
    if (!RuntimePermissionUtils.shouldShowRequestPermissionRationale(target,permissions)) {
      mPendingRequest=false;
      if (mPermissionListener != null)       mPermissionListener.onNeverAsk(requestCode,permissions,grantResults);
    }
 else {
      mPendingRequest=false;
      if (mPermissionListener != null)       mPermissionListener.onDenied(mCommonRuntimePermissionRequest,target,requestCode,permissions,grantResults,DENIED_REASON.USER);
    }
  }
}

Fixed version (ground truth):
public static void onRequestPermissionsResult(Activity target,int requestCode,@NonNull String[] permissions,@NonNull int[] grantResults){
  if (permissions.length < 1 || grantResults.length < 1)   return;
  if (mPermissionListener == null)   return;
  mPendingRequest=false;
  if (RuntimePermissionUtils.verifyPermissions(grantResults) || RuntimePermissionUtils.hasSelfPermissions(target,permissions)) {
    mPermissionListener.onAllowed(requestCode,permissions);
  }
 else   if (!RuntimePermissionUtils.shouldShowRequestPermissionRationale(target,permissions)) {
    mPermissionListener.onNeverAsk(requestCode,permissions,grantResults);
  }
 else {
    mPermissionListener.onDenied(mInvokeCommonPermissionPermissionRequest,target,requestCode,permissions,grantResults,DENIED_REASON.USER);
  }
}
Program: 174185
Project: 174185
Buggy source:
/** 
 * Returns true if the Activity or Fragment has access to all given permissions.
 * @param context     context
 * @param permissions permission list
 * @return returns true if the Activity or Fragment has access to all given permissions.
 */
public static boolean hasSelfPermissions(Context context,String... permissions){
  for (  String permission : permissions) {
    if (permissionExists(permission) && !hasSelfPermission(context,permission)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Returns true if the Activity or Fragment has access to all given permissions.
 * @param context     context
 * @param permissions permission list
 * @return returns true if the Activity or Fragment has access to all given permissions.
 */
public static boolean hasSelfPermissions(Context context,String... permissions){
  if (permissions == null || permissions.length < 1)   return false;
  for (  String permission : permissions) {
    if (permissionExists(permission) && !hasSelfPermission(context,permission)) {
      return false;
    }
  }
  return true;
}
Program: 174186
Project: 174186
Buggy source:
private void setInfo(){
  mTitleEt.setText(myGift.title);
  mPriceEt.setText(myGift.price);
  mDescriptionEt.setText(myGift.description);
  setRadioBtn();
  category=new Category();
  category.categoryId=myGift.categoryId;
  category.title=myGift.category;
  changeUIAfterCategorySelect();
  if (myGift.locationId != null) {
    city=new Place();
    city.id=myGift.locationId;
    city.name=getPlaceNameById(myGift.locationId);
    mChooseCityBtnTxt.setText(getPlaceNameById(myGift.locationId));
  }
  if (myGift.regionId != null) {
    region=new Place();
    region.id=myGift.regionId;
    region.name=getPlaceNameById(myGift.regionId);
    mChooseRegionBtnTxt.setText(getPlaceNameById(myGift.regionId));
  }
  findCityRegion();
  giftGalleryAdapter=new GiftGalleryAdapter(this,myGift.giftImages);
  mRecyclerView.setAdapter(giftGalleryAdapter);
  mRecyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,true));
  giftGalleryAdapter.notifyDataSetChanged();
  onUpdateGallery();
}

Fixed version (ground truth):
private void setInfo(){
  mTitleEt.setText(myGift.title);
  mPriceEt.setText(myGift.price);
  mDescriptionEt.setText(myGift.description);
  setRadioBtn();
  category=new Category();
  category.categoryId=myGift.categoryId;
  category.title=myGift.category;
  changeUIAfterCategorySelect();
  if (myGift.locationId != null && !myGift.locationId.equals("String_Node_Str")) {
    city=new Place();
    city.id=myGift.locationId;
    city.name=getPlaceNameById(myGift.locationId);
    mChooseCityBtnTxt.setText(getPlaceNameById(myGift.locationId));
    if (myGift.regionId != null && !myGift.regionId.equals("String_Node_Str")) {
      region=new Place();
      region.id=myGift.regionId;
      region.name=getPlaceNameById(myGift.regionId);
      mChooseRegionBtnTxt.setText(getPlaceNameById(myGift.regionId));
    }
    findCityRegion();
  }
  giftGalleryAdapter=new GiftGalleryAdapter(this,myGift.giftImages);
  mRecyclerView.setAdapter(giftGalleryAdapter);
  mRecyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,true));
  giftGalleryAdapter.notifyDataSetChanged();
  onUpdateGallery();
}
Program: 174187
Project: 174187
Buggy source:
@Override public void onResponse(Call call,Response response){
  progressView.setVisibility(View.INVISIBLE);
  login_get_verification_tv.setVisibility(View.VISIBLE);
  if (response.body() instanceof TokenOutput) {
    TokenOutput tokenOutput=(TokenOutput)response.body();
    AppController.storeString(Constants.Authorization,Constants.BEARER + "String_Node_Str" + tokenOutput.access_token);
    AppController.storeString(Constants.USERNAME,tokenOutput.userName);
    AppController.storeString(Constants.USER_ID,tokenOutput.userId);
    showS("String_Node_Str" + NumberTranslator.toPersian(AppController.getStoredString(Constants.TELEPHONE)) + "String_Node_Str");
    finish();
  }
 else   if (response.body() instanceof RegisterOutput) {
    String remainingSeconds=((RegisterOutput)response.body()).remainingSeconds;
    if (remainingSeconds != null && !remainingSeconds.equals("String_Node_Str")) {
      closeKeyboard();
      Snackbari.showS(mToolbarTitleTextView,"String_Node_Str" + remainingSeconds + "String_Node_Str");
    }
 else {
      enterVerificationCode();
    }
  }
 else   if (response.body() instanceof ResponseBody) {
    AppController.storeBoolean(Constants.CALLED_SETDEVICE_BEFORE,true);
  }
}

Fixed version (ground truth):
@Override public void onResponse(Call call,Response response){
  progressView.setVisibility(View.INVISIBLE);
  login_get_verification_tv.setVisibility(View.VISIBLE);
  if (response.body() instanceof TokenOutput) {
    TokenOutput tokenOutput=(TokenOutput)response.body();
    AppController.storeString(Constants.Authorization,Constants.BEARER + "String_Node_Str" + tokenOutput.access_token);
    AppController.storeString(Constants.USERNAME,tokenOutput.userName);
    AppController.storeString(Constants.USER_ID,tokenOutput.userId);
    showS("String_Node_Str" + NumberTranslator.toPersian(AppController.getStoredString(Constants.TELEPHONE)) + "String_Node_Str");
    Intent intent=new Intent(getApplicationContext(),BottomBarActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
  }
 else   if (response.body() instanceof RegisterOutput) {
    String remainingSeconds=((RegisterOutput)response.body()).remainingSeconds;
    if (remainingSeconds != null && !remainingSeconds.equals("String_Node_Str")) {
      closeKeyboard();
      Snackbari.showS(mToolbarTitleTextView,"String_Node_Str" + remainingSeconds + "String_Node_Str");
    }
 else {
      enterVerificationCode();
    }
  }
 else   if (response.body() instanceof ResponseBody) {
    AppController.storeBoolean(Constants.CALLED_SETDEVICE_BEFORE,true);
  }
}
Program: 174188
Project: 174188
Buggy source:
@Override public void onBindViewHolder(final ChatListHolder holder,final int position){
}

Fixed version (ground truth):
@Override public void onBindViewHolder(final ChatListHolder holder,final int position){
  holder.itemView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      ((ChatActivity)mContext).hideFab();
      ((ChatActivity)mContext).replaceFragment(ChatConversationFragment.newInstance("String_Node_Str","String_Node_Str","String_Node_Str"),ChatConversationFragment.class.getName());
    }
  }
);
}
Program: 174189
Project: 174189
Buggy source:
void init(){
  extractDataFromBundle();
  seen=false;
  mContext=this.getActivity();
  apiRequest=new ApiRequest(mContext,this);
  ViewGroup.MarginLayoutParams marginLayoutParams=(ViewGroup.MarginLayoutParams)mRecyclerView.getLayoutParams();
  marginLayoutParams.setMargins(0,0,0,0);
  mRecyclerView.setLayoutParams(marginLayoutParams);
  LinearLayoutManager layoutManager=new LinearLayoutManager(AppController.getAppContext());
  layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  layoutManager.setStackFromEnd(true);
  layoutManager.setReverseLayout(true);
  mRecyclerView.setLayoutManager(layoutManager);
  mRecyclerView.addOnScrollListener(new EndlessRecyclerViewScrollListener(layoutManager){
    @Override public void onLoadMore(    int page,    int totalItemsCount){
      count++;
      callApiGetChatConversation(count);
    }
  }
);
  callApiGetChatConversation(count);
  emptyTextView.setVisibility(View.GONE);
  chatConversationAdapter=new ChatConversationAdapter(this,mContext,chatConversationArrayList,"String_Node_Str",countUnseen);
  mRecyclerView.setAdapter(chatConversationAdapter);
  blockMode();
}

Fixed version (ground truth):
protected void init(){
  extractDataFromBundle();
  seen=false;
  mContext=this.getActivity();
  apiRequest=new ApiRequest(mContext,this);
  ViewGroup.MarginLayoutParams marginLayoutParams=(ViewGroup.MarginLayoutParams)mRecyclerView.getLayoutParams();
  marginLayoutParams.setMargins(0,0,0,0);
  mRecyclerView.setLayoutParams(marginLayoutParams);
  LinearLayoutManager layoutManager=new LinearLayoutManager(AppController.getAppContext());
  layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
  layoutManager.setStackFromEnd(true);
  layoutManager.setReverseLayout(true);
  mRecyclerView.setLayoutManager(layoutManager);
  mRecyclerView.addOnScrollListener(new EndlessRecyclerViewScrollListener(layoutManager){
    @Override public void onLoadMore(    int page,    int totalItemsCount){
      count++;
      callApiGetChatConversation(count);
    }
  }
);
  callApiGetChatConversation(count);
  emptyTextView.setVisibility(View.GONE);
  chatConversationAdapter=new ChatConversationAdapter(this,mContext,chatConversationArrayList,"String_Node_Str",countUnseen);
  mRecyclerView.setAdapter(chatConversationAdapter);
  blockMode();
}
Program: 174190
Project: 174190
Buggy source:
public static ChatConversationFragment newInstance(String chatId,String userID,int position,String countUnseen){
  ChatConversationFragment chatConversationFragment=new ChatConversationFragment();
  Bundle args=new Bundle();
  args.putString(Constants.CHAT_ID,chatId);
  args.putString(Constants.USER_ID,userID);
  args.putString(Constants.COUNT_UNSEEN,countUnseen);
  positionSelected=position;
  chatConversationFragment.setArguments(args);
  return chatConversationFragment;
}

Fixed version (ground truth):
public static ChatConversationFragment newInstance(String chatId,String userID,String countUnseen){
  ChatConversationFragment chatConversationFragment=new ChatConversationFragment();
  Bundle args=new Bundle();
  args.putString(Constants.CHAT_ID,chatId);
  args.putString(Constants.USER_ID,userID);
  args.putString(Constants.COUNT_UNSEEN,countUnseen);
  chatConversationFragment.setArguments(args);
  return chatConversationFragment;
}
Program: 174191
Project: 174191
Buggy source:
@Override public void onResponse(Call call,Response response){
  if (response.body() instanceof AppInfoOutput) {
    onUpdateVersionResponse((AppInfoOutput)response.body());
  }
 else   if (response.body() instanceof ArrayList) {
    ArrayList<Gift> gifts=(ArrayList<Gift>)response.body();
    if (gifts.size() > 0) {
      MaterialDialog.Builder builder=MaterialDialogBuilder.create(this).customView(R.layout.dialog_simple_yes_no,false);
      final MaterialDialog dialog=builder.build();
      ((TextView)dialog.findViewById(R.id.message_textview)).setText("String_Node_Str");
      RippleView yesBtnRipple=(RippleView)dialog.findViewById(R.id.yes_ripple_btn_cardview);
      yesBtnRipple.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener(){
        @Override public void onComplete(        RippleView rippleView){
          ReceivedRequestsFragment receivedRequestsFragment=new ReceivedRequestsFragment();
          replaceFragment(receivedRequestsFragment,ReceivedRequestsFragment.class.getName());
          mToolbarTitleTextView.setText("String_Node_Str");
          dialog.dismiss();
        }
      }
);
      RippleView noBtnRipple=(RippleView)dialog.findViewById(R.id.no_ripple_btn_cardview);
      noBtnRipple.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener(){
        @Override public void onComplete(        RippleView rippleView){
          dialog.dismiss();
        }
      }
);
      dialog.show();
    }
  }
 else {
    Snackbari.showS(mToolbarTitleTextView,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onResponse(Call call,Response response){
  if (response.body() instanceof AppInfoOutput) {
    onUpdateVersionResponse((AppInfoOutput)response.body());
  }
 else   if (response.body() instanceof ArrayList) {
    ArrayList<Gift> gifts=(ArrayList<Gift>)response.body();
    if (gifts.size() > 0) {
      MaterialDialog.Builder builder=MaterialDialogBuilder.create(this).customView(R.layout.dialog_simple_yes_no,false);
      final MaterialDialog dialog=builder.build();
      ((TextView)dialog.findViewById(R.id.message_textview)).setText("String_Node_Str");
      RippleView yesBtnRipple=(RippleView)dialog.findViewById(R.id.yes_ripple_btn_cardview);
      yesBtnRipple.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener(){
        @Override public void onComplete(        RippleView rippleView){
          startActivity(MyRequestsActivity.createIntent());
          dialog.dismiss();
        }
      }
);
      RippleView noBtnRipple=(RippleView)dialog.findViewById(R.id.no_ripple_btn_cardview);
      noBtnRipple.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener(){
        @Override public void onComplete(        RippleView rippleView){
          dialog.dismiss();
        }
      }
);
      dialog.show();
    }
  }
 else {
    Snackbari.showS(mToolbarTitleTextView,"String_Node_Str");
  }
}
Program: 174192
Project: 174192
Buggy source:
private void onUpdateVersionResponse(AppInfoOutput appInfoOutput){
  AppController.storeString(Constants.SMS_CENTER,appInfoOutput.smsCenter);
  boolean isForcedUpdate;
  if (appInfoOutput.updateInfo.force_update != null && appInfoOutput.updateInfo.force_update.equalsIgnoreCase("String_Node_Str")) {
    isForcedUpdate=true;
  }
 else {
    isForcedUpdate=false;
  }
  UpdateChecker updateChecker=new UpdateChecker(this,getResources().getString(R.string.app_name),appInfoOutput.updateInfo.version,appInfoOutput.updateInfo.apk_url,null,appInfoOutput.updateInfo.changes);
  if (isForcedUpdate || DeviceInfo.getAppVersionCode() < Integer.valueOf(updateChecker.mUpdateDetail.latestVersion)) {
    Intent[] intents=new Intent[1];
    intents[0]=Intent.makeMainActivity(new ComponentName(AppController.getAppContext(),BottomBarActivity.class));
    updateChecker.showUpdaterDialog(context,getString(R.string.update_to_new_version),getString(R.string.exist_new_version),appInfoOutput.updateInfo.changes,appInfoOutput.updateInfo.version,intents,isForcedUpdate);
    AppController.getInstance().setIsCheckedUpdate(true);
  }
 else {
    Snackbari.showS(mToolbarTitleTextView,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void onUpdateVersionResponse(AppInfoOutput appInfoOutput){
  AppController.storeString(Constants.SMS_CENTER,appInfoOutput.smsCenter);
  boolean isForcedUpdate;
  if (appInfoOutput.updateInfo.force_update != null && appInfoOutput.updateInfo.force_update.equalsIgnoreCase("String_Node_Str")) {
    isForcedUpdate=true;
  }
 else {
    isForcedUpdate=false;
  }
  UpdateChecker updateChecker=new UpdateChecker(this,getResources().getString(R.string.app_name),appInfoOutput.updateInfo.version,appInfoOutput.updateInfo.apk_url,null,appInfoOutput.updateInfo.changes);
  if (Integer.valueOf(appInfoOutput.updateInfo.version) > DeviceInfo.getAppVersionCode() && (isForcedUpdate || DeviceInfo.getAppVersionCode() < Integer.valueOf(updateChecker.mUpdateDetail.latestVersion))) {
    Intent[] intents=new Intent[1];
    intents[0]=Intent.makeMainActivity(new ComponentName(AppController.getAppContext(),BottomBarActivity.class));
    updateChecker.showUpdaterDialog(context,getString(R.string.update_to_new_version),getString(R.string.exist_new_version),appInfoOutput.updateInfo.changes,appInfoOutput.updateInfo.version,intents,isForcedUpdate);
    AppController.getInstance().setIsCheckedUpdate(true);
  }
 else {
    Snackbari.showS(mToolbarTitleTextView,"String_Node_Str");
  }
}
Program: 174193
Project: 174193
Buggy source:
private void onUpdateVersionResponse(AppInfoOutput appInfoOutput){
  AppController.storeString(Constants.SMS_CENTER,appInfoOutput.smsCenter);
  boolean isForcedUpdate;
  if (appInfoOutput.updateInfo.force_update != null && appInfoOutput.updateInfo.force_update.equalsIgnoreCase("String_Node_Str")) {
    isForcedUpdate=true;
  }
 else {
    isForcedUpdate=false;
  }
  UpdateChecker updateChecker=new UpdateChecker(this,getResources().getString(R.string.app_name),appInfoOutput.updateInfo.version,appInfoOutput.updateInfo.apk_url,null,appInfoOutput.updateInfo.changes);
  if (isForcedUpdate || DeviceInfo.getAppVersionCode() < Integer.valueOf(updateChecker.mUpdateDetail.latestVersion)) {
    Intent[] intents=new Intent[1];
    intents[0]=Intent.makeMainActivity(new ComponentName(AppController.getAppContext(),BottomBarActivity.class));
    updateChecker.showUpdaterDialog(context,getString(R.string.update_to_new_version),getString(R.string.exist_new_version),appInfoOutput.updateInfo.changes,appInfoOutput.updateInfo.version,intents,isForcedUpdate);
    AppController.getInstance().setIsCheckedUpdate(true);
  }
 else {
    afterAll();
  }
}

Fixed version (ground truth):
private void onUpdateVersionResponse(AppInfoOutput appInfoOutput){
  AppController.storeString(Constants.SMS_CENTER,appInfoOutput.smsCenter);
  boolean isForcedUpdate;
  if (appInfoOutput.updateInfo.force_update != null && appInfoOutput.updateInfo.force_update.equalsIgnoreCase("String_Node_Str")) {
    isForcedUpdate=true;
  }
 else {
    isForcedUpdate=false;
  }
  UpdateChecker updateChecker=new UpdateChecker(this,getResources().getString(R.string.app_name),appInfoOutput.updateInfo.version,appInfoOutput.updateInfo.apk_url,null,appInfoOutput.updateInfo.changes);
  if (Integer.valueOf(appInfoOutput.updateInfo.version) > DeviceInfo.getAppVersionCode() && (isForcedUpdate || DeviceInfo.getAppVersionCode() < Integer.valueOf(updateChecker.mUpdateDetail.latestVersion))) {
    Intent[] intents=new Intent[1];
    intents[0]=Intent.makeMainActivity(new ComponentName(AppController.getAppContext(),BottomBarActivity.class));
    updateChecker.showUpdaterDialog(context,getString(R.string.update_to_new_version),getString(R.string.exist_new_version),appInfoOutput.updateInfo.changes,appInfoOutput.updateInfo.version,intents,isForcedUpdate);
    AppController.getInstance().setIsCheckedUpdate(true);
  }
 else {
    afterAll();
  }
}
Program: 174194
Project: 174194
Buggy source:
private void onUpdateVersionResponse(AppInfoOutput appInfoOutput){
  AppController.storeString(Constants.SMS_CENTER,appInfoOutput.smsCenter);
  boolean isForcedUpdate;
  if (appInfoOutput.updateInfo.force_update != null && appInfoOutput.updateInfo.force_update.equalsIgnoreCase("String_Node_Str")) {
    isForcedUpdate=true;
  }
 else {
    isForcedUpdate=false;
  }
  UpdateChecker updateChecker=new UpdateChecker(this,getResources().getString(R.string.app_name),appInfoOutput.updateInfo.version,appInfoOutput.updateInfo.apk_url,null,appInfoOutput.updateInfo.changes);
  if (isForcedUpdate || DeviceInfo.getAppVersionCode() < Integer.valueOf(updateChecker.mUpdateDetail.latestVersion)) {
    Intent[] intents=new Intent[1];
    intents[0]=Intent.makeMainActivity(new ComponentName(AppController.getAppContext(),BottomBarActivity.class));
    updateChecker.showUpdaterDialog(context,getString(R.string.update_to_new_version),getString(R.string.exist_new_version),appInfoOutput.updateInfo.changes,appInfoOutput.updateInfo.version,intents,isForcedUpdate);
    AppController.getInstance().setIsCheckedUpdate(true);
  }
 else {
    Snackbari.showS(mLog_in_out_lay,"String_Node_Str");
  }
}

Fixed version (ground truth):
private void onUpdateVersionResponse(AppInfoOutput appInfoOutput){
  AppController.storeString(Constants.SMS_CENTER,appInfoOutput.smsCenter);
  boolean isForcedUpdate;
  if (appInfoOutput.updateInfo.force_update != null && appInfoOutput.updateInfo.force_update.equalsIgnoreCase("String_Node_Str")) {
    isForcedUpdate=true;
  }
 else {
    isForcedUpdate=false;
  }
  UpdateChecker updateChecker=new UpdateChecker(this,getResources().getString(R.string.app_name),appInfoOutput.updateInfo.version,appInfoOutput.updateInfo.apk_url,null,appInfoOutput.updateInfo.changes);
  if (Integer.valueOf(appInfoOutput.updateInfo.version) > DeviceInfo.getAppVersionCode() && (isForcedUpdate || DeviceInfo.getAppVersionCode() < Integer.valueOf(updateChecker.mUpdateDetail.latestVersion))) {
    Intent[] intents=new Intent[1];
    intents[0]=Intent.makeMainActivity(new ComponentName(AppController.getAppContext(),BottomBarActivity.class));
    updateChecker.showUpdaterDialog(context,getString(R.string.update_to_new_version),getString(R.string.exist_new_version),appInfoOutput.updateInfo.changes,appInfoOutput.updateInfo.version,intents,isForcedUpdate);
    AppController.getInstance().setIsCheckedUpdate(true);
  }
 else {
    Snackbari.showS(mLog_in_out_lay,"String_Node_Str");
  }
}
Program: 174195
Project: 174195
Buggy source:
private void changeUIAfterCategorySelect(){
  mChooseCategoryLay.setBackgroundColor(getResources().getColor(R.color.white));
  mChooseCategoryTv.setVisibility(View.GONE);
  if (!category.title.equals("String_Node_Str")) {
    mChooseCategoryBtnTxt.setText(category.title);
  }
  mAfterCategorySelectLay.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
private void changeUIAfterCategorySelect(){
  if (!category.title.equals("String_Node_Str")) {
    mChooseCategoryBtnTxt.setText(category.title);
  }
  mAfterCategorySelectLay.setVisibility(View.VISIBLE);
}
Program: 174197
Project: 174197
Buggy source:
@Override public void onCitySelected(Place city){
  this.city=city;
  mChooseCityBtnTxt.setText(city.name);
  myGift.location=city.name;
  myGift.locationId=city.id;
  mChooseRegionBtnTxt.setText("String_Node_Str");
  findCityRegion();
}

Fixed version (ground truth):
@Override public void onCitySelected(Place city){
  this.city=city;
  mChooseCityBtnTxt.setText(city.name);
  myGift.location=city.name;
  myGift.locationId=city.id;
  mChooseRegionBtnTxt.setText("String_Node_Str");
  findCityRegion();
switch (mChooseRegionBtn.getVisibility()) {
case View.VISIBLE:
    chooseRegion();
  break;
}
}
Program: 174199
Project: 174199
Buggy source:
private void init(){
  Bundle bundle=getArguments();
  if (bundle != null) {
    cancelable=getArguments().getBoolean(Constants.CANCELABLE);
    setCancelable(cancelable);
  }
  if (bundle != null && getArguments().getString(Constants.CITY_ID) != null) {
    locationId=getArguments().getString(Constants.CITY_ID);
    readLevel4FromJson();
    choosePlaceAdapter=new ChoosePlaceAdapter(this,getContext(),level4.getPlaces());
  }
 else {
    readLevel2FromJson();
    choosePlaceAdapter=new ChoosePlaceAdapter(this,getContext(),level2.getPlaces());
  }
  recyclerView.setAdapter(choosePlaceAdapter);
  recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  setListeners();
}

Fixed version (ground truth):
private void init(){
  Bundle bundle=getArguments();
  if (bundle != null) {
    cancelable=getArguments().getBoolean(Constants.CANCELABLE);
    setCancelable(cancelable);
  }
  if (bundle != null && getArguments().getString(Constants.CITY_ID) != null) {
    locationId=getArguments().getString(Constants.CITY_ID);
    readLevel4FromJson();
    choosePlaceText.setText("String_Node_Str");
    choosePlaceAdapter=new ChoosePlaceAdapter(this,getContext(),level4.getPlaces());
  }
 else {
    readLevel2FromJson();
    choosePlaceAdapter=new ChoosePlaceAdapter(this,getContext(),level2.getPlaces());
  }
  recyclerView.setAdapter(choosePlaceAdapter);
  recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
  setListeners();
}
Program: 174200
Project: 174200
Buggy source:
public RequestToAGiftHolder(View itemView){
  super(itemView);
  this.itemView=itemView;
  rootLay=(RelativeLayout)itemView.findViewById(R.id.root_lay);
  callLay=(RelativeLayout)itemView.findViewById(R.id.call_lay);
  smsLay=(RelativeLayout)itemView.findViewById(R.id.sms_lay);
  acceptLay=(RelativeLayout)itemView.findViewById(R.id.accept_lay);
  rejectLay=(RelativeLayout)itemView.findViewById(R.id.deny_lay);
  mPhoneTv=(TextViewIranSansRegular)itemView.findViewById(R.id.rw_phone_number_tv);
  mCallIconIv=(ImageView)itemView.findViewById(R.id.rw_call_icon_iv);
  mSmsIconIv=(ImageView)itemView.findViewById(R.id.rw_sms_icon_iv);
}

Fixed version (ground truth):
public RequestToAGiftHolder(View itemView){
  super(itemView);
  this.itemView=itemView;
  rootLay=(RelativeLayout)itemView.findViewById(R.id.root_lay);
  callLay=(RelativeLayout)itemView.findViewById(R.id.call_lay);
  smsLay=(RelativeLayout)itemView.findViewById(R.id.sms_lay);
  acceptLay=(RelativeLayout)itemView.findViewById(R.id.accept_lay);
  rejectLay=(RelativeLayout)itemView.findViewById(R.id.deny_lay);
  mPhoneTv=(TextViewIranSansRegular)itemView.findViewById(R.id.rw_phone_number_tv);
  mNumberTv=itemView.findViewById(R.id.rw_number_tv);
  mCallIconIv=(ImageView)itemView.findViewById(R.id.rw_call_icon_iv);
  mSmsIconIv=(ImageView)itemView.findViewById(R.id.rw_sms_icon_iv);
}
Program: 174201
Project: 174201
Buggy source:
private void TabSelected(int menuItemId){
  if (menuItemId == R.id.bottomBarHome) {
    if (menuItemId != menuItemIdSelected) {
      clearStack();
      unlock=true;
      mToolbarTitleTextView.setText("String_Node_Str");
      replaceFragment(homeCategoryFragment,HomeCategoryFragment.class.getName());
    }
    menuItemIdSelected=menuItemId;
  }
 else   if (menuItemId == R.id.bottomBarMyGifts) {
    if (menuItemId != menuItemIdSelected) {
      clearStack();
      unlock=true;
      mToolbarTitleTextView.setText(R.string.mygifts);
      replaceFragment(myGiftsFragment,MyGiftsFragment.class.getName());
    }
    menuItemIdSelected=menuItemId;
  }
 else   if (menuItemId == R.id.bottomBarMyWall && unlock) {
    if (menuItemId != menuItemIdSelected) {
      clearStack();
      mToolbarTitleTextView.setText(R.string.bookshelf);
      Category category=new Category();
      category.categoryId="String_Node_Str";
      category.title="String_Node_Str";
      replaceFragment(HomeFragment.newInstance(Constants.CATEGORY_PAGETYPE,category),HomeFragment.class.getName() + CategoriesGridFragment.class.getName());
    }
    menuItemIdSelected=menuItemId;
  }
}

Fixed version (ground truth):
private void TabSelected(int menuItemId){
  if (menuItemId == R.id.bottomBarHome) {
    if (menuItemId != menuItemIdSelected) {
      clearStack();
      unlock=true;
      mToolbarTitleTextView.setText("String_Node_Str");
      replaceFragment(homeCategoryFragment,HomeCategoryFragment.class.getName());
    }
    menuItemIdSelected=menuItemId;
  }
 else   if (menuItemId == R.id.bottomBarMyGifts) {
    if (menuItemId != menuItemIdSelected) {
      clearStack();
      unlock=true;
      mToolbarTitleTextView.setText(R.string.mygifts);
      replaceFragment(myGiftsFragment,MyGiftsFragment.class.getName());
    }
    menuItemIdSelected=menuItemId;
  }
 else   if (menuItemId == R.id.bottomBarMyWall && unlock) {
    if (menuItemId != menuItemIdSelected) {
      clearStack();
      mToolbarTitleTextView.setText(R.string.bookshelf);
      Category category=new Category();
      category.categoryId="String_Node_Str";
      category.title="String_Node_Str";
      replaceFragment(HomeFragment.newInstance(Constants.CATEGORY_PAGETYPE,category),HomeFragment.class.getName());
    }
    menuItemIdSelected=menuItemId;
  }
}
Program: 174202
Project: 174202
Buggy source:
private void settingBottomBar(Bundle savedInstanceState){
  mBottomBar=BottomBar.attach(this,savedInstanceState);
  mBottomBar.noTopOffset();
  mBottomBar.useFixedMode();
  mBottomBar.setTypeFace("String_Node_Str");
  mBottomBar.setItems(R.menu.menu_bottombar);
  mBottomBar.findViewById(R.id.bb_bottom_bar_background_view).setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
  int color=getResources().getColor(R.color.white);
  ((ImageView)mBottomBar.findViewById(R.id.bb_bottom_bar_icon)).setColorFilter(color);
  mBottomBar.setOnMenuTabClickListener(new OnMenuTabClickListener(){
    @Override public void onMenuTabSelected(    @IdRes int menuItemId){
      TabSelected(menuItemId);
    }
    @Override public void onMenuTabReSelected(    @IdRes int menuItemId){
      TabSelected(menuItemId);
      if (menuItemId == R.id.bottomBarMyGifts) {
      }
 else       if (menuItemId == R.id.bottomBarMyWall) {
        onBackPressed();
      }
    }
  }
);
}

Fixed version (ground truth):
private void settingBottomBar(Bundle savedInstanceState){
  mBottomBar=BottomBar.attach(this,savedInstanceState);
  mBottomBar.noTopOffset();
  mBottomBar.useFixedMode();
  mBottomBar.setTypeFace("String_Node_Str");
  mBottomBar.setItems(R.menu.menu_bottombar);
  mBottomBar.findViewById(R.id.bb_bottom_bar_background_view).setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
  int color=getResources().getColor(R.color.white);
  ((ImageView)mBottomBar.findViewById(R.id.bb_bottom_bar_icon)).setColorFilter(color);
  mBottomBar.setOnMenuTabClickListener(new OnMenuTabClickListener(){
    @Override public void onMenuTabSelected(    @IdRes int menuItemId){
      TabSelected(menuItemId);
    }
    @Override public void onMenuTabReSelected(    @IdRes int menuItemId){
      TabSelected(menuItemId);
      if (menuItemId == R.id.bottomBarHome) {
        if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
          onBackPressed();
        }
      }
 else       if (menuItemId == R.id.bottomBarMyGifts) {
      }
 else       if (menuItemId == R.id.bottomBarMyWall) {
      }
    }
  }
);
}
Program: 174203
Project: 174203
Buggy source:
@Override public void onBackPressed(){
  if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
    int index=getSupportFragmentManager().getBackStackEntryCount() - 1;
    FragmentManager.BackStackEntry backEntry=getSupportFragmentManager().getBackStackEntryAt(index);
    String tag=backEntry.getName();
    if (tag.equals(HomeCategoryFragment.class.getName() + Constants.HOME_PAGETYPE)) {
      finish();
    }
 else     if (tag.equals(BookmarkFragment.class.getName()) || tag.equals(StatisticFragment.class.getName()) || tag.equals(MyRequestsFragment.class.getName())|| tag.equals(RequestsToAGiftFragment.class.getName())|| tag.equals(OurTeamFragment.class.getName())|| tag.equals(ContactUsFragment.class.getName())|| tag.equals(HomeFragment.class.getName() + CategoriesGridFragment.class.getName())) {
      super.onBackPressed();
    }
 else {
      clearStack();
      mToolbarTitleTextView.setText("String_Node_Str");
      replaceFragment(homeCategoryFragment,HomeCategoryFragment.class.getName());
      menuItemIdSelected=R.id.bottomBarHome;
    }
  }
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
    int index=getSupportFragmentManager().getBackStackEntryCount() - 1;
    FragmentManager.BackStackEntry backEntry=getSupportFragmentManager().getBackStackEntryAt(index);
    String tag=backEntry.getName();
    if (tag.equals(HomeCategoryFragment.class.getName())) {
      finish();
    }
 else     if (tag.equals(HomeFragment.class.getName() + CategoriesGridFragment.class.getName())) {
      super.onBackPressed();
    }
 else {
      clearStack();
      mToolbarTitleTextView.setText("String_Node_Str");
      replaceFragment(homeCategoryFragment,HomeCategoryFragment.class.getName());
      menuItemIdSelected=R.id.bottomBarHome;
    }
  }
}
Program: 174204
Project: 174204
Buggy source:
@Override public void onMenuTabReSelected(@IdRes int menuItemId){
  TabSelected(menuItemId);
  if (menuItemId == R.id.bottomBarMyGifts) {
  }
 else   if (menuItemId == R.id.bottomBarMyWall) {
    onBackPressed();
  }
}

Fixed version (ground truth):
@Override public void onMenuTabReSelected(@IdRes int menuItemId){
  TabSelected(menuItemId);
  if (menuItemId == R.id.bottomBarHome) {
    if (getSupportFragmentManager().getBackStackEntryCount() > 1) {
      onBackPressed();
    }
  }
 else   if (menuItemId == R.id.bottomBarMyGifts) {
  }
 else   if (menuItemId == R.id.bottomBarMyWall) {
  }
}