Program: 35611
Project: 35611
Buggy source:
private void fetchData(){
  dispose(null);
  Set<Sharee> shareeHashSet=new HashSet<>();
  contactItems=new ArrayList<>();
  userHeaderItems=new HashMap<>();
  RetrofitBucket retrofitBucket=ApiUtils.getRetrofitBucketForContactsSearch(currentUser.getBaseUrl(),"String_Node_Str");
  contactsQueryDisposable=ncApi.getContactsWithSearchParam(ApiUtils.getCredentials(currentUser.getUsername(),currentUser.getToken()),retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe((  ShareesOverall shareesOverall) -> {
    if (shareesOverall != null) {
      if (shareesOverall.getOcs().getData().getUsers() != null) {
        shareeHashSet.addAll(shareesOverall.getOcs().getData().getUsers());
      }
      if (shareesOverall.getOcs().getData().getExactUsers() != null && shareesOverall.getOcs().getData().getExactUsers().getExactSharees() != null) {
        shareeHashSet.addAll(shareesOverall.getOcs().getData().getExactUsers().getExactSharees());
      }
      Participant participant;
      for (      Sharee sharee : shareeHashSet) {
        if (!sharee.getValue().getShareWith().equals(currentUser.getUsername())) {
          participant=new Participant();
          participant.setName(sharee.getLabel());
          String headerTitle;
          headerTitle=sharee.getLabel().substring(0,1).toUpperCase();
          UserHeaderItem userHeaderItem;
          if (!userHeaderItems.containsKey(headerTitle)) {
            userHeaderItem=new UserHeaderItem(headerTitle);
            userHeaderItems.put(headerTitle,userHeaderItem);
          }
          participant.setUserId(sharee.getValue().getShareWith());
          contactItems.add(new UserItem(participant,currentUser,userHeaderItems.get(headerTitle)));
        }
      }
      userHeaderItems=new HashMap<>();
      Collections.sort(contactItems,(o1,o2) -> {
        String firstName;
        String secondName;
        if (o1 instanceof UserItem) {
          firstName=((UserItem)o1).getModel().getName();
        }
 else {
          firstName=((UserHeaderItem)o1).getModel();
        }
        if (o2 instanceof UserItem) {
          secondName=((UserItem)o2).getModel().getName();
        }
 else {
          secondName=((UserHeaderItem)o2).getModel();
        }
        return firstName.compareToIgnoreCase(secondName);
      }
);
      if (isNewConversationView) {
        callHeaderLayout.setVisibility(View.VISIBLE);
      }
 else {
        callHeaderLayout.setVisibility(View.GONE);
      }
      adapter.updateDataSet(contactItems,true);
      searchItem.setVisible(contactItems.size() > 0);
      swipeRefreshLayout.setRefreshing(false);
      if (isNewConversationView) {
        checkAndHandleBottomButtons();
      }
    }
  }
,throwable -> {
    if (searchItem != null) {
      searchItem.setVisible(false);
    }
    if (throwable instanceof HttpException) {
      HttpException exception=(HttpException)throwable;
switch (exception.code()) {
case 401:
        if (getParentController() != null && getParentController().getRouter() != null) {
          getParentController().getRouter().pushController((RouterTransaction.with(new WebViewLoginController(currentUser.getBaseUrl(),true)).pushChangeHandler(new VerticalChangeHandler()).popChangeHandler(new VerticalChangeHandler())));
        }
      break;
default :
    break;
}
}
swipeRefreshLayout.setRefreshing(false);
dispose(contactsQueryDisposable);
}
,() -> {
swipeRefreshLayout.setRefreshing(false);
dispose(contactsQueryDisposable);
}
);
}

Fixed version (ground truth):
private void fetchData(){
  dispose(null);
  Set<Sharee> shareeHashSet=new HashSet<>();
  contactItems=new ArrayList<>();
  userHeaderItems=new HashMap<>();
  RetrofitBucket retrofitBucket=ApiUtils.getRetrofitBucketForContactsSearch(currentUser.getBaseUrl(),"String_Node_Str");
  contactsQueryDisposable=ncApi.getContactsWithSearchParam(ApiUtils.getCredentials(currentUser.getUsername(),currentUser.getToken()),retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe((  ShareesOverall shareesOverall) -> {
    if (shareesOverall != null) {
      if (shareesOverall.getOcs().getData().getUsers() != null) {
        shareeHashSet.addAll(shareesOverall.getOcs().getData().getUsers());
      }
      if (shareesOverall.getOcs().getData().getExactUsers() != null && shareesOverall.getOcs().getData().getExactUsers().getExactSharees() != null) {
        shareeHashSet.addAll(shareesOverall.getOcs().getData().getExactUsers().getExactSharees());
      }
      Participant participant;
      for (      Sharee sharee : shareeHashSet) {
        if (!sharee.getValue().getShareWith().equals(currentUser.getUsername())) {
          participant=new Participant();
          participant.setName(sharee.getLabel());
          String headerTitle;
          headerTitle=sharee.getLabel().substring(0,1).toUpperCase();
          UserHeaderItem userHeaderItem;
          if (!userHeaderItems.containsKey(headerTitle)) {
            userHeaderItem=new UserHeaderItem(headerTitle);
            userHeaderItems.put(headerTitle,userHeaderItem);
          }
          participant.setUserId(sharee.getValue().getShareWith());
          contactItems.add(new UserItem(participant,currentUser,userHeaderItems.get(headerTitle)));
        }
      }
      userHeaderItems=new HashMap<>();
      Collections.sort(contactItems,(o1,o2) -> {
        String firstName;
        String secondName;
        if (o1 instanceof UserItem) {
          firstName=((UserItem)o1).getModel().getName();
        }
 else {
          firstName=((UserHeaderItem)o1).getModel();
        }
        if (o2 instanceof UserItem) {
          secondName=((UserItem)o2).getModel().getName();
        }
 else {
          secondName=((UserHeaderItem)o2).getModel();
        }
        return firstName.compareToIgnoreCase(secondName);
      }
);
      adapter.updateDataSet(contactItems,true);
      searchItem.setVisible(contactItems.size() > 0);
      swipeRefreshLayout.setRefreshing(false);
      if (isNewConversationView) {
        checkAndHandleBottomButtons();
      }
    }
  }
,throwable -> {
    if (searchItem != null) {
      searchItem.setVisible(false);
    }
    if (throwable instanceof HttpException) {
      HttpException exception=(HttpException)throwable;
switch (exception.code()) {
case 401:
        if (getParentController() != null && getParentController().getRouter() != null) {
          getParentController().getRouter().pushController((RouterTransaction.with(new WebViewLoginController(currentUser.getBaseUrl(),true)).pushChangeHandler(new VerticalChangeHandler()).popChangeHandler(new VerticalChangeHandler())));
        }
      break;
default :
    break;
}
}
swipeRefreshLayout.setRefreshing(false);
dispose(contactsQueryDisposable);
}
,() -> {
swipeRefreshLayout.setRefreshing(false);
dispose(contactsQueryDisposable);
}
);
}