nus-yam/ex-repair huggingface dataset:
Program: 35623
Project: 35623
Buggy source:
@NonNull @Override protected Result onRunJob(Params params){
  NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
  long internalUserId=getParams().getExtras().getLong(BundleKeys.KEY_INTERNAL_USER_ID,-1);
  UserEntity userEntity;
  List userEntityObjectList=new ArrayList();
  if (internalUserId == -1 || (userEntity=userUtils.getUserWithInternalId(internalUserId)) == null) {
    userEntityObjectList=userUtils.getUsers();
  }
 else {
    userEntityObjectList.add(userEntity);
  }
  for (  Object userEntityObject : userEntityObjectList) {
    UserEntity internalUserEntity=(UserEntity)userEntityObject;
    ncApi=retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new JavaNetCookieJar(new java.net.CookieManager())).build()).build().create(NcApi.class);
    ncApi.getCapabilities(ApiUtils.getCredentials(internalUserEntity.getUsername(),internalUserEntity.getToken()),ApiUtils.getUrlForCapabilities(internalUserEntity.getBaseUrl())).subscribeOn(Schedulers.newThread()).subscribe(capabilitiesOverall -> userUtils.createOrUpdateUser(null,null,null,null,null,null,null,internalUserEntity.getId(),LoganSquare.serialize(capabilitiesOverall.getOcs().getData().getCapabilities())).subscribeOn(Schedulers.newThread()).subscribe());
  }
  return Result.SUCCESS;
}

Fixed version (ground truth):
@NonNull @Override protected Result onRunJob(Params params){
  NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
  long internalUserId=getParams().getExtras().getLong(BundleKeys.KEY_INTERNAL_USER_ID,-1);
  UserEntity userEntity;
  List userEntityObjectList=new ArrayList();
  if (internalUserId == -1 || (userEntity=userUtils.getUserWithInternalId(internalUserId)) == null) {
    userEntityObjectList=userUtils.getUsers();
  }
 else {
    userEntityObjectList.add(userEntity);
  }
  for (  Object userEntityObject : userEntityObjectList) {
    UserEntity internalUserEntity=(UserEntity)userEntityObject;
    ncApi=retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new JavaNetCookieJar(new java.net.CookieManager())).build()).build().create(NcApi.class);
    ncApi.getCapabilities(ApiUtils.getCredentials(internalUserEntity.getUsername(),internalUserEntity.getToken()),ApiUtils.getUrlForCapabilities(internalUserEntity.getBaseUrl())).subscribeOn(Schedulers.newThread()).subscribe(new Observer<CapabilitiesOverall>(){
      @Override public void onSubscribe(      Disposable d){
      }
      @Override public void onNext(      CapabilitiesOverall capabilitiesOverall){
        updateUser(capabilitiesOverall,internalUserEntity);
      }
      @Override public void onError(      Throwable e){
      }
      @Override public void onComplete(){
      }
    }
);
  }
  return Result.SUCCESS;
}
Program: 35624
Project: 35624
Buggy source:
@Override public void bindViewHolder(FlexibleAdapter adapter,UserItemViewHolder holder,int position,List payloads){
  flipView=holder.avatarFlipView;
  if (adapter.isSelected(position) && !flipView.isFlipped()) {
    flipItemSelection();
  }
  if (adapter.hasFilter()) {
    FlexibleUtils.highlightText(holder.contactDisplayName,participant.getName(),String.valueOf(adapter.getFilter(String.class)));
  }
 else {
    holder.contactDisplayName.setText(participant.getName());
  }
  GlideUrl glideUrl=new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),participant.getUserId(),false),new LazyHeaders.Builder().setHeader("String_Node_Str","String_Node_Str").setHeader("String_Node_Str",ApiUtils.getUserAgent()).build());
  int avatarSize=Math.round(NextcloudTalkApplication.getSharedApplication().getResources().getDimension(R.dimen.avatar_size));
  GlideApp.with(NextcloudTalkApplication.getSharedApplication().getApplicationContext()).asBitmap().diskCacheStrategy(DiskCacheStrategy.NONE).load(glideUrl).centerInside().override(avatarSize,avatarSize).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(holder.avatarFlipView.getFrontImageView());
}

Fixed version (ground truth):
@Override public void bindViewHolder(FlexibleAdapter adapter,UserItemViewHolder holder,int position,List payloads){
  flipView=holder.avatarFlipView;
  flipView.flipSilently(adapter.isSelected(position));
  if (adapter.hasFilter()) {
    FlexibleUtils.highlightText(holder.contactDisplayName,participant.getName(),String.valueOf(adapter.getFilter(String.class)));
  }
 else {
    holder.contactDisplayName.setText(participant.getName());
  }
  GlideUrl glideUrl=new GlideUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),participant.getUserId(),false),new LazyHeaders.Builder().setHeader("String_Node_Str","String_Node_Str").setHeader("String_Node_Str",ApiUtils.getUserAgent()).build());
  int avatarSize=Math.round(NextcloudTalkApplication.getSharedApplication().getResources().getDimension(R.dimen.avatar_size));
  GlideApp.with(NextcloudTalkApplication.getSharedApplication().getApplicationContext()).asBitmap().diskCacheStrategy(DiskCacheStrategy.NONE).load(glideUrl).centerInside().override(avatarSize,avatarSize).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(holder.avatarFlipView.getFrontImageView());
}
Program: 35627
Project: 35627
Buggy source:
@Override public void onNext(RoomOverall roomOverall){
  if (getActivity() != null) {
    overridePushHandler(new NoOpControllerChangeHandler());
    overridePopHandler(new NoOpControllerChangeHandler());
    Intent callIntent=new Intent(getActivity(),CallActivity.class);
    Bundle bundle=new Bundle();
    bundle.putString(BundleKeys.KEY_ROOM_TOKEN,roomOverall.getOcs().getData().getToken());
    bundle.putParcelable(BundleKeys.KEY_USER_ENTITY,Parcels.wrap(userEntity));
    callIntent.putExtras(bundle);
  }
}

Fixed version (ground truth):
@Override public void onNext(RoomOverall roomOverall){
  if (getActivity() != null) {
    overridePushHandler(new NoOpControllerChangeHandler());
    overridePopHandler(new NoOpControllerChangeHandler());
    Intent callIntent=new Intent(getActivity(),CallActivity.class);
    Bundle bundle=new Bundle();
    bundle.putString(BundleKeys.KEY_ROOM_TOKEN,roomOverall.getOcs().getData().getToken());
    bundle.putParcelable(BundleKeys.KEY_USER_ENTITY,Parcels.wrap(userEntity));
    callIntent.putExtras(bundle);
    startActivity(callIntent);
  }
}
Program: 35628
Project: 35628
Buggy source:
public ContactsController(Bundle args){
  super(args);
  setHasOptionsMenu(true);
  if (args.containsKey(BundleKeys.KEY_NEW_CONVERSATION)) {
    isNewConversationView=true;
  }
}

Fixed version (ground truth):
public ContactsController(Bundle args){
  super(args);
  if (args.containsKey(BundleKeys.KEY_NEW_CONVERSATION)) {
    isNewConversationView=true;
  }
}
Program: 35629
Project: 35629
Buggy source:
@Override protected void onAttach(@NonNull View view){
  super.onAttach(view);
  eventBus.register(this);
  if (isNewConversationView) {
    checkAndHandleBottomButtons();
    if (getActionBar() != null) {
      getActionBar().setDisplayHomeAsUpEnabled(true);
    }
  }
}

Fixed version (ground truth):
@Override protected void onAttach(@NonNull View view){
  super.onAttach(view);
  setHasOptionsMenu(true);
  eventBus.register(this);
  if (isNewConversationView) {
    checkAndHandleBottomButtons();
    if (getActionBar() != null) {
      getActionBar().setDisplayHomeAsUpEnabled(true);
    }
  }
}
Program: 35630
Project: 35630
Buggy source:
@Subscribe(threadMode=ThreadMode.MAIN) public void onMessageEvent(BottomSheetLockEvent bottomSheetLockEvent){
  if (bottomSheet != null) {
    if (!bottomSheetLockEvent.isCancelable()) {
      bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
    }
 else {
      bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
      if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) {
        bottomSheet.cancel();
      }
    }
  }
}

Fixed version (ground truth):
@Subscribe(threadMode=ThreadMode.MAIN) public void onMessageEvent(BottomSheetLockEvent bottomSheetLockEvent){
  if (bottomSheet != null) {
    if (!bottomSheetLockEvent.isCancelable()) {
      bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
    }
 else {
      bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
      if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) {
        new Handler().postDelayed(() -> bottomSheet.cancel(),bottomSheetLockEvent.getDelay());
        getRouter().popCurrentController();
      }
    }
  }
}
Program: 35633
Project: 35633
Buggy source:
@Override public void onNext(RoomOverall roomOverall){
  if (getActivity() != null) {
    overridePushHandler(new NoOpControllerChangeHandler());
    overridePopHandler(new NoOpControllerChangeHandler());
    Intent callIntent=new Intent(getActivity(),CallActivity.class);
    Bundle bundle=new Bundle();
    bundle.putString(BundleKeys.KEY_ROOM_TOKEN,roomOverall.getOcs().getData().getToken());
    bundle.putParcelable(BundleKeys.KEY_USER_ENTITY,Parcels.wrap(userEntity));
    callIntent.putExtras(bundle);
    startActivity(callIntent);
  }
}

Fixed version (ground truth):
@Override public void onNext(RoomOverall roomOverall){
  if (getActivity() != null) {
    Intent callIntent=new Intent(getActivity(),CallActivity.class);
    Bundle bundle=new Bundle();
    bundle.putString(BundleKeys.KEY_ROOM_TOKEN,roomOverall.getOcs().getData().getToken());
    bundle.putParcelable(BundleKeys.KEY_USER_ENTITY,Parcels.wrap(userEntity));
    callIntent.putExtras(bundle);
    startActivity(callIntent);
  }
}
Program: 35635
Project: 35635
Buggy source:
private void initiateCall(){
  eventBus.post(new BottomSheetLockEvent(true,0,true,true));
  Bundle bundle=new Bundle();
  bundle.putString(BundleKeys.KEY_ROOM_TOKEN,room.getToken());
  bundle.putParcelable(BundleKeys.KEY_USER_ENTITY,Parcels.wrap(userEntity));
  if (baseUrl != null && !baseUrl.equals(userEntity.getBaseUrl())) {
    bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL,baseUrl);
  }
  bundle.putString(BundleKeys.KEY_CALL_SESSION,callSession);
  overridePushHandler(new NoOpControllerChangeHandler());
  overridePopHandler(new NoOpControllerChangeHandler());
  Intent callIntent=new Intent(getActivity(),CallActivity.class);
  callIntent.putExtras(bundle);
  startActivity(callIntent);
}

Fixed version (ground truth):
private void initiateCall(boolean fromContactsView){
  eventBus.post(new BottomSheetLockEvent(true,0,true,true));
  Bundle bundle=new Bundle();
  bundle.putString(BundleKeys.KEY_ROOM_TOKEN,room.getToken());
  bundle.putParcelable(BundleKeys.KEY_USER_ENTITY,Parcels.wrap(userEntity));
  if (baseUrl != null && !baseUrl.equals(userEntity.getBaseUrl())) {
    bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL,baseUrl);
  }
  bundle.putString(BundleKeys.KEY_CALL_SESSION,callSession);
  Intent callIntent=new Intent(getActivity(),CallActivity.class);
  callIntent.putExtras(bundle);
  startActivity(callIntent);
  if (fromContactsView) {
    new Handler().postDelayed(() -> getParentController().getRouter().popCurrentController(),100);
  }
}
Program: 35636
Project: 35636
Buggy source:
@Override public void onNext(Object o){
  if (operationCode != 99) {
    showResultImage(true,false);
  }
 else {
    CallOverall callOverall=(CallOverall)o;
    callSession=callOverall.getOcs().getData().getSessionId();
    initiateCall();
  }
}

Fixed version (ground truth):
@Override public void onNext(Object o){
  if (operationCode != 99) {
    showResultImage(true,false);
  }
 else {
    CallOverall callOverall=(CallOverall)o;
    callSession=callOverall.getOcs().getData().getSessionId();
    initiateCall(false);
  }
}
Program: 35637
Project: 35637
Buggy source:
private void inviteUsersToAConversation(){
  RetrofitBucket retrofitBucket;
  final ArrayList<String> localInvitedUsers=invitedUsers;
  if (localInvitedUsers.size() > 0) {
    for (int i=0; i < invitedUsers.size(); i++) {
      final String userId=invitedUsers.get(i);
      retrofitBucket=ApiUtils.getRetrofitBucketForAddParticipant(userEntity.getBaseUrl(),room.getToken(),userId);
      ncApi.addParticipant(credentials,retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<AddParticipantOverall>(){
        @Override public void onSubscribe(        Disposable d){
        }
        @Override public void onNext(        AddParticipantOverall addParticipantOverall){
        }
        @Override public void onError(        Throwable e){
          dispose();
        }
        @Override public void onComplete(){
synchronized (localInvitedUsers) {
            localInvitedUsers.remove(userId);
          }
          if (localInvitedUsers.size() == 0) {
            initiateCall();
          }
          dispose();
        }
      }
);
    }
  }
 else {
    showResultImage(true,false);
  }
}

Fixed version (ground truth):
private void inviteUsersToAConversation(){
  RetrofitBucket retrofitBucket;
  final ArrayList<String> localInvitedUsers=invitedUsers;
  if (localInvitedUsers.size() > 0) {
    for (int i=0; i < invitedUsers.size(); i++) {
      final String userId=invitedUsers.get(i);
      retrofitBucket=ApiUtils.getRetrofitBucketForAddParticipant(userEntity.getBaseUrl(),room.getToken(),userId);
      ncApi.addParticipant(credentials,retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).retry(1).subscribe(new Observer<AddParticipantOverall>(){
        @Override public void onSubscribe(        Disposable d){
        }
        @Override public void onNext(        AddParticipantOverall addParticipantOverall){
        }
        @Override public void onError(        Throwable e){
          dispose();
        }
        @Override public void onComplete(){
synchronized (localInvitedUsers) {
            localInvitedUsers.remove(userId);
          }
          if (localInvitedUsers.size() == 0) {
            initiateCall(true);
          }
          dispose();
        }
      }
);
    }
  }
 else {
    showResultImage(true,false);
  }
}
Program: 35638
Project: 35638
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  new ClosedInterfaceImpl().ProviderInstallerInstallIfNeededAsync();
  JobManager.create(this).addJobCreator(new MagicJobCreator());
  sharedApplication=this;
  initializeWebRtc();
  DisplayUtils.useCompatVectorIfNeeded();
  try {
    buildComponent();
  }
 catch (  final GeneralSecurityException exception) {
    if (BuildConfig.DEBUG) {
      exception.printStackTrace();
    }
  }
  componentApplication.inject(this);
  refWatcher=LeakCanary.install(this);
  DeviceUtils.ignoreSpecialBatteryFeatures();
  new JobRequest.Builder(PushRegistrationJob.TAG).setUpdateCurrent(true).startNow().build().schedule();
  new JobRequest.Builder(AccountRemovalJob.TAG).setUpdateCurrent(true).startNow().build().schedule();
  schedulePeriodCapabilitiesJob();
  new JobRequest.Builder(CapabilitiesJob.TAG).setUpdateCurrent(false).startNow().build().schedule();
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  JobManager.create(this).addJobCreator(new MagicJobCreator());
  sharedApplication=this;
  initializeWebRtc();
  DisplayUtils.useCompatVectorIfNeeded();
  try {
    buildComponent();
  }
 catch (  final GeneralSecurityException exception) {
    if (BuildConfig.DEBUG) {
      exception.printStackTrace();
    }
  }
  componentApplication.inject(this);
  refWatcher=LeakCanary.install(this);
  new ClosedInterfaceImpl().ProviderInstallerInstallIfNeededAsync();
  DeviceUtils.ignoreSpecialBatteryFeatures();
  new JobRequest.Builder(PushRegistrationJob.TAG).setUpdateCurrent(true).startNow().build().schedule();
  new JobRequest.Builder(AccountRemovalJob.TAG).setUpdateCurrent(true).startNow().build().schedule();
  schedulePeriodCapabilitiesJob();
  new JobRequest.Builder(CapabilitiesJob.TAG).setUpdateCurrent(false).startNow().build().schedule();
}
Program: 35639
Project: 35639
Buggy source:
private void prepareAndShowBottomSheetWithBundle(Bundle bundle,boolean shouldShowCallMenuController){
  View view=getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet,null,false);
  if (shouldShowCallMenuController) {
    getChildRouter((ViewGroup)view).setRoot(RouterTransaction.with(new CallMenuController(bundle)).popChangeHandler(new VerticalChangeHandler()).pushChangeHandler(new VerticalChangeHandler()));
  }
 else {
    getChildRouter((ViewGroup)view).setRoot(RouterTransaction.with(new EntryMenuController(bundle)).popChangeHandler(new VerticalChangeHandler()).pushChangeHandler(new VerticalChangeHandler()));
  }
  boolean isNew=false;
  if (bottomSheet == null) {
    bottomSheet=new BottomSheet.Builder(getActivity()).setView(view).create();
    isNew=true;
  }
  if (bottomSheet.getWindow() != null && isNew) {
    bottomSheet.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
  }
  bottomSheet.show();
}

Fixed version (ground truth):
private void prepareAndShowBottomSheetWithBundle(Bundle bundle,boolean shouldShowCallMenuController){
  if (view == null) {
    view=getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet,null,false);
  }
  if (shouldShowCallMenuController) {
    getChildRouter((ViewGroup)view).setRoot(RouterTransaction.with(new CallMenuController(bundle)).popChangeHandler(new VerticalChangeHandler()).pushChangeHandler(new VerticalChangeHandler()));
  }
 else {
    getChildRouter((ViewGroup)view).setRoot(RouterTransaction.with(new EntryMenuController(bundle)).popChangeHandler(new VerticalChangeHandler()).pushChangeHandler(new VerticalChangeHandler()));
  }
  if (bottomSheet == null) {
    bottomSheet=new BottomSheet.Builder(getActivity()).setView(view).create();
  }
 else   if (bottomSheet.getWindow() != null) {
    bottomSheet.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
  }
  bottomSheet.show();
}
Program: 35641
Project: 35641
Buggy source:
@OnClick(R.id.call_control_camera) public void onCameraClick(){
  if (EffortlessPermissions.hasPermissions(this,PERMISSIONS_CAMERA)) {
    videoOn=!videoOn;
    if (videoOn) {
      cameraControlButton.getFrontImageView().setImageResource(R.drawable.ic_videocam_white_24px);
      cameraSwitchButton.setVisibility(View.GONE);
    }
 else {
      cameraControlButton.getFrontImageView().setImageResource(R.drawable.ic_videocam_off_white_24px);
      if (cameraEnumerator.getDeviceNames().length > 1) {
        cameraSwitchButton.setVisibility(View.VISIBLE);
      }
    }
    toggleMedia(videoOn,true);
  }
 else   if (EffortlessPermissions.somePermissionPermanentlyDenied(this,PERMISSIONS_CAMERA)) {
    OpenAppDetailsDialogFragment.show(R.string.nc_camera_permission_permanently_denied,R.string.nc_permissions_settings,this);
  }
 else {
    EffortlessPermissions.requestPermissions(this,R.string.nc_permissions_video,100,PERMISSIONS_CAMERA);
  }
}

Fixed version (ground truth):
@OnClick(R.id.call_control_camera) public void onCameraClick(){
  if (EffortlessPermissions.hasPermissions(this,PERMISSIONS_CAMERA)) {
    videoOn=!videoOn;
    if (videoOn) {
      cameraControlButton.getFrontImageView().setImageResource(R.drawable.ic_videocam_white_24px);
      if (cameraEnumerator.getDeviceNames().length > 1) {
        cameraSwitchButton.setVisibility(View.VISIBLE);
      }
    }
 else {
      cameraControlButton.getFrontImageView().setImageResource(R.drawable.ic_videocam_off_white_24px);
      cameraSwitchButton.setVisibility(View.GONE);
    }
    toggleMedia(videoOn,true);
  }
 else   if (EffortlessPermissions.somePermissionPermanentlyDenied(this,PERMISSIONS_CAMERA)) {
    OpenAppDetailsDialogFragment.show(R.string.nc_camera_permission_permanently_denied,R.string.nc_permissions_settings,this);
  }
 else {
    EffortlessPermissions.requestPermissions(this,R.string.nc_permissions_video,100,PERMISSIONS_CAMERA);
  }
}
Program: 35642
Project: 35642
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  JobManager.create(this).addJobCreator(new MagicJobCreator());
  FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false);
  sharedApplication=this;
  initializeWebRtc();
  DisplayUtils.useCompatVectorIfNeeded();
  try {
    buildComponent();
  }
 catch (  final GeneralSecurityException exception) {
    if (BuildConfig.DEBUG) {
      exception.printStackTrace();
    }
  }
  componentApplication.inject(this);
  refWatcher=LeakCanary.install(this);
  new JobRequest.Builder(PushRegistrationJob.TAG).setUpdateCurrent(true).startNow().build().schedule();
  new JobRequest.Builder(AccountRemovalJob.TAG).setUpdateCurrent(true).startNow().build().schedule();
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  ProviderInstaller.installIfNeededAsync(this,this);
  JobManager.create(this).addJobCreator(new MagicJobCreator());
  FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false);
  sharedApplication=this;
  initializeWebRtc();
  DisplayUtils.useCompatVectorIfNeeded();
  try {
    buildComponent();
  }
 catch (  final GeneralSecurityException exception) {
    if (BuildConfig.DEBUG) {
      exception.printStackTrace();
    }
  }
  componentApplication.inject(this);
  refWatcher=LeakCanary.install(this);
  new JobRequest.Builder(PushRegistrationJob.TAG).setUpdateCurrent(true).startNow().build().schedule();
  new JobRequest.Builder(AccountRemovalJob.TAG).setUpdateCurrent(true).startNow().build().schedule();
}
Program: 35644
Project: 35644
Buggy source:
@Override public void afterTextChanged(Editable s){
  if (!TextUtils.isEmpty(s)) {
    if (operationCode == 2) {
      if (room.getName() == null || !room.getName().equals(s.toString())) {
        if (proceedButton.isEnabled()) {
          proceedButton.setEnabled(true);
          proceedButton.setAlpha(1.0f);
        }
      }
 else {
        if (!proceedButton.isEnabled()) {
          proceedButton.setEnabled(false);
          proceedButton.setAlpha(0.7f);
        }
        textFieldBoxes.setError(getResources().getString(R.string.nc_call_name_is_same),true);
      }
    }
 else {
      if (!proceedButton.isEnabled()) {
        proceedButton.setEnabled(true);
        proceedButton.setAlpha(1.0f);
      }
    }
  }
 else {
    if (proceedButton.isEnabled()) {
      proceedButton.setEnabled(false);
      proceedButton.setAlpha(0.7f);
    }
  }
}

Fixed version (ground truth):
@Override public void afterTextChanged(Editable s){
  if (!TextUtils.isEmpty(s)) {
    if (operationCode == 2) {
      if (room.getName() == null || !room.getName().equals(s.toString())) {
        if (!proceedButton.isEnabled()) {
          proceedButton.setEnabled(true);
          proceedButton.setAlpha(1.0f);
        }
      }
 else {
        if (proceedButton.isEnabled()) {
          proceedButton.setEnabled(false);
          proceedButton.setAlpha(0.7f);
        }
        textFieldBoxes.setError(getResources().getString(R.string.nc_call_name_is_same),true);
      }
    }
 else {
      if (!proceedButton.isEnabled()) {
        proceedButton.setEnabled(true);
        proceedButton.setAlpha(1.0f);
      }
    }
  }
 else {
    if (proceedButton.isEnabled()) {
      proceedButton.setEnabled(false);
      proceedButton.setAlpha(0.7f);
    }
  }
}
Program: 35645
Project: 35645
Buggy source:
private void basicInitialization(){
  rootEglBase=EglBase.create();
  createCameraEnumerator();
  PeerConnectionFactory.Options options=new PeerConnectionFactory.Options();
  peerConnectionFactory=new PeerConnectionFactory(options);
  if (!MagicWebRtcLists.HARDWARE_ACCELERATION_VENDOR_BLACKLIST.contains(Build.MANUFACTURER.toLowerCase())) {
    peerConnectionFactory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(),rootEglBase.getEglBaseContext());
  }
  audioConstraints=new MediaConstraints();
  videoConstraints=new MediaConstraints();
  localMediaStream=peerConnectionFactory.createLocalMediaStream("String_Node_Str");
  audioManager=MagicAudioManager.create(getApplicationContext());
  Log.d(TAG,"String_Node_Str");
  audioManager.start(new MagicAudioManager.AudioManagerEvents(){
    @Override public void onAudioDeviceChanged(    MagicAudioManager.AudioDevice selectedAudioDevice,    Set<MagicAudioManager.AudioDevice> availableAudioDevices){
      onAudioManagerDevicesChanged(selectedAudioDevice,availableAudioDevices);
    }
  }
);
  iceServers=new ArrayList<>();
  sdpConstraints=new MediaConstraints();
  sdpConstraints.mandatory.add(new MediaConstraints.KeyValuePair("String_Node_Str","String_Node_Str"));
  sdpConstraints.mandatory.add(new MediaConstraints.KeyValuePair("String_Node_Str","String_Node_Str"));
  sdpConstraints.optional.add(new MediaConstraints.KeyValuePair("String_Node_Str","String_Node_Str"));
  sdpConstraints.optional.add(new MediaConstraints.KeyValuePair("String_Node_Str","String_Node_Str"));
  cameraInitialization();
  microphoneInitialization();
}

Fixed version (ground truth):
private void basicInitialization(){
  rootEglBase=EglBase.create();
  createCameraEnumerator();
  PeerConnectionFactory.Options options=new PeerConnectionFactory.Options();
  peerConnectionFactory=new PeerConnectionFactory(options);
  peerConnectionFactory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(),rootEglBase.getEglBaseContext());
  audioConstraints=new MediaConstraints();
  videoConstraints=new MediaConstraints();
  localMediaStream=peerConnectionFactory.createLocalMediaStream("String_Node_Str");
  audioManager=MagicAudioManager.create(getApplicationContext());
  Log.d(TAG,"String_Node_Str");
  audioManager.start(new MagicAudioManager.AudioManagerEvents(){
    @Override public void onAudioDeviceChanged(    MagicAudioManager.AudioDevice selectedAudioDevice,    Set<MagicAudioManager.AudioDevice> availableAudioDevices){
      onAudioManagerDevicesChanged(selectedAudioDevice,availableAudioDevices);
    }
  }
);
  iceServers=new ArrayList<>();
  sdpConstraints=new MediaConstraints();
  sdpConstraints.mandatory.add(new MediaConstraints.KeyValuePair("String_Node_Str","String_Node_Str"));
  sdpConstraints.mandatory.add(new MediaConstraints.KeyValuePair("String_Node_Str","String_Node_Str"));
  sdpConstraints.optional.add(new MediaConstraints.KeyValuePair("String_Node_Str","String_Node_Str"));
  sdpConstraints.optional.add(new MediaConstraints.KeyValuePair("String_Node_Str","String_Node_Str"));
  cameraInitialization();
  microphoneInitialization();
}
Program: 35646
Project: 35646
Buggy source:
@Override public boolean onItemClick(int position){
  if (callItems.size() > position) {
    overridePushHandler(new NoOpControllerChangeHandler());
    overridePopHandler(new NoOpControllerChangeHandler());
    CallItem callItem=callItems.get(position);
    Intent callIntent=new Intent(getActivity(),CallActivity.class);
    BundleBuilder bundleBuilder=new BundleBuilder(new Bundle());
    bundleBuilder.putString("String_Node_Str",callItem.getModel().getToken());
    bundleBuilder.putParcelable("String_Node_Str",Parcels.wrap(userEntity));
    callIntent.putExtras(bundleBuilder.build());
    startActivity(callIntent);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onItemClick(int position){
  overridePushHandler(new NoOpControllerChangeHandler());
  overridePopHandler(new NoOpControllerChangeHandler());
  CallItem callItem=adapter.getItem(position);
  Intent callIntent=new Intent(getActivity(),CallActivity.class);
  BundleBuilder bundleBuilder=new BundleBuilder(new Bundle());
  bundleBuilder.putString("String_Node_Str",callItem.getModel().getToken());
  bundleBuilder.putParcelable("String_Node_Str",Parcels.wrap(userEntity));
  callIntent.putExtras(bundleBuilder.build());
  startActivity(callIntent);
  return true;
}
Program: 35647
Project: 35647
Buggy source:
@Override public boolean onItemClick(int position){
  if (contactItems.size() > position) {
    UserItem userItem=contactItems.get(position);
    RetrofitBucket retrofitBucket=ApiHelper.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(),"String_Node_Str",userItem.getModel().getUserId());
    ncApi.createRoom(ApiHelper.getCredentials(userEntity.getUsername(),userEntity.getToken()),retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<RoomOverall>(){
      @Override public void onSubscribe(      Disposable d){
      }
      @Override public void onNext(      RoomOverall roomOverall){
        overridePushHandler(new NoOpControllerChangeHandler());
        overridePopHandler(new NoOpControllerChangeHandler());
        Intent callIntent=new Intent(getActivity(),CallActivity.class);
        BundleBuilder bundleBuilder=new BundleBuilder(new Bundle());
        bundleBuilder.putString("String_Node_Str",roomOverall.getOcs().getData().getToken());
        bundleBuilder.putParcelable("String_Node_Str",Parcels.wrap(userEntity));
        callIntent.putExtras(bundleBuilder.build());
        startActivity(callIntent);
      }
      @Override public void onError(      Throwable e){
      }
      @Override public void onComplete(){
      }
    }
);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onItemClick(int position){
  UserItem userItem=adapter.getItem(position);
  RetrofitBucket retrofitBucket=ApiHelper.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(),"String_Node_Str",userItem.getModel().getUserId());
  ncApi.createRoom(ApiHelper.getCredentials(userEntity.getUsername(),userEntity.getToken()),retrofitBucket.getUrl(),retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<RoomOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    RoomOverall roomOverall){
      overridePushHandler(new NoOpControllerChangeHandler());
      overridePopHandler(new NoOpControllerChangeHandler());
      Intent callIntent=new Intent(getActivity(),CallActivity.class);
      BundleBuilder bundleBuilder=new BundleBuilder(new Bundle());
      bundleBuilder.putString("String_Node_Str",roomOverall.getOcs().getData().getToken());
      bundleBuilder.putParcelable("String_Node_Str",Parcels.wrap(userEntity));
      callIntent.putExtras(bundleBuilder.build());
      startActivity(callIntent);
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
  return true;
}
Program: 35649
Project: 35649
Buggy source:
private void gotRemoteStream(MediaStream stream,String session){
  removeMediaStream(session);
  if (stream.videoTracks.size() == 1) {
    VideoTrack videoTrack=stream.videoTracks.get(0);
    try {
      RelativeLayout relativeLayout=(RelativeLayout)getLayoutInflater().inflate(R.layout.surface_renderer,remoteRenderersLayout,false);
      relativeLayout.setTag(session);
      SurfaceViewRenderer surfaceViewRenderer=relativeLayout.findViewById(R.id.surface_view);
      surfaceViewRenderer.setMirror(false);
      surfaceViewRenderer.init(rootEglBase.getEglBaseContext(),null);
      surfaceViewRenderer.setZOrderMediaOverlay(false);
      surfaceViewRenderer.setEnableHardwareScaler(false);
      surfaceViewRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
      VideoRenderer remoteRenderer=new VideoRenderer(surfaceViewRenderer);
      videoTrack.addRenderer(remoteRenderer);
      remoteRenderersLayout.addView(relativeLayout);
      gotNick(session,getPeerConnectionWrapperForSessionId(session).getNick());
    }
 catch (    Exception e) {
      Log.d(TAG,"String_Node_Str");
    }
  }
  callControls.setZ(100.0f);
}

Fixed version (ground truth):
private void gotRemoteStream(MediaStream stream,String session){
  removeMediaStream(session);
  if (stream.videoTracks.size() == 1) {
    VideoTrack videoTrack=stream.videoTracks.get(0);
    try {
      RelativeLayout relativeLayout=(RelativeLayout)getLayoutInflater().inflate(R.layout.surface_renderer,remoteRenderersLayout,false);
      relativeLayout.setTag(session);
      SurfaceViewRenderer surfaceViewRenderer=relativeLayout.findViewById(R.id.surface_view);
      surfaceViewRenderer.setMirror(false);
      surfaceViewRenderer.init(rootEglBase.getEglBaseContext(),null);
      surfaceViewRenderer.setZOrderMediaOverlay(false);
      surfaceViewRenderer.setEnableHardwareScaler(false);
      surfaceViewRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
      surfaceViewRenderer.setOnClickListener(videoOnClickListener);
      VideoRenderer remoteRenderer=new VideoRenderer(surfaceViewRenderer);
      videoTrack.addRenderer(remoteRenderer);
      remoteRenderersLayout.addView(relativeLayout);
      gotNick(session,getPeerConnectionWrapperForSessionId(session).getNick());
    }
 catch (    Exception e) {
      Log.d(TAG,"String_Node_Str");
    }
  }
  callControls.setZ(100.0f);
}
Program: 35650
Project: 35650
Buggy source:
@OnClick(R.id.call_control_hangup) public void onHangupClick(){
  hangup(false);
  finish();
}

Fixed version (ground truth):
@OnClick(R.id.call_control_hangup) public void onHangupClick(){
  hangup(false);
}
Program: 35651
Project: 35651
Buggy source:
@Override public void onBackPressed(){
  onHangupClick();
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  hangup(false);
}
Program: 35652
Project: 35652
Buggy source:
private void hangupNetworkCalls(){
  String credentials=ApiHelper.getCredentials(userEntity.getUsername(),userEntity.getToken());
  ncApi.leaveCall(credentials,ApiHelper.getUrlForCall(userEntity.getBaseUrl(),roomToken)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<GenericOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    GenericOverall genericOverall){
      ncApi.leaveRoom(credentials,ApiHelper.getUrlForRoom(userEntity.getBaseUrl(),roomToken)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<GenericOverall>(){
        @Override public void onSubscribe(        Disposable d){
        }
        @Override public void onNext(        GenericOverall genericOverall){
        }
        @Override public void onError(        Throwable e){
        }
        @Override public void onComplete(){
        }
      }
);
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}

Fixed version (ground truth):
private void hangupNetworkCalls(){
  String credentials=ApiHelper.getCredentials(userEntity.getUsername(),userEntity.getToken());
  ncApi.leaveCall(credentials,ApiHelper.getUrlForCall(userEntity.getBaseUrl(),roomToken)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<GenericOverall>(){
    @Override public void onSubscribe(    Disposable d){
    }
    @Override public void onNext(    GenericOverall genericOverall){
      ncApi.leaveRoom(credentials,ApiHelper.getUrlForRoom(userEntity.getBaseUrl(),roomToken)).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<GenericOverall>(){
        @Override public void onSubscribe(        Disposable d){
        }
        @Override public void onNext(        GenericOverall genericOverall){
          finish();
        }
        @Override public void onError(        Throwable e){
        }
        @Override public void onComplete(){
        }
      }
);
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onComplete(){
    }
  }
);
}
Program: 35653
Project: 35653
Buggy source:
private void deleteMagicPeerConnection(MagicPeerConnectionWrapper magicPeerConnectionWrapper){
  if (magicPeerConnectionWrapper.getPeerConnection() != null) {
    magicPeerConnectionWrapper.removeMediaStream();
    magicPeerConnectionWrapper.getPeerConnection().close();
    magicPeerConnectionWrapper.getPeerConnection().dispose();
  }
  magicPeerConnectionWrapperList.remove(magicPeerConnectionWrapper);
}

Fixed version (ground truth):
private void deleteMagicPeerConnection(MagicPeerConnectionWrapper magicPeerConnectionWrapper){
  if (magicPeerConnectionWrapper.getPeerConnection() != null) {
    magicPeerConnectionWrapper.removeMediaStream();
    magicPeerConnectionWrapper.getPeerConnection().close();
  }
  magicPeerConnectionWrapperList.remove(magicPeerConnectionWrapper);
}
Program: 35654
Project: 35654
Buggy source:
public void initViews(){
  if (cameraEnumerator.getDeviceNames().length < 2) {
    cameraSwitchButton.setVisibility(View.GONE);
  }
  pipVideoView.setMirror(true);
  pipVideoView.init(rootEglBase.getEglBaseContext(),null);
  pipVideoView.setZOrderMediaOverlay(true);
  pipVideoView.setEnableHardwareScaler(true);
  pipVideoView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
}

Fixed version (ground truth):
public void initViews(){
  if (cameraEnumerator.getDeviceNames().length < 2) {
    cameraSwitchButton.setVisibility(View.GONE);
  }
  pipVideoView.setMirror(true);
  pipVideoView.init(rootEglBase.getEglBaseContext(),null);
  pipVideoView.setZOrderMediaOverlay(true);
  pipVideoView.setEnableHardwareScaler(false);
  pipVideoView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
}
Program: 35655
Project: 35655
Buggy source:
private void gotRemoteStream(MediaStream stream,String session){
  removeMediaStream(session);
  if (stream.videoTracks.size() == 1) {
    VideoTrack videoTrack=stream.videoTracks.get(0);
    try {
      RelativeLayout relativeLayout=(RelativeLayout)getLayoutInflater().inflate(R.layout.surface_renderer,remoteRenderersLayout,false);
      relativeLayout.setTag(session);
      SurfaceViewRenderer surfaceViewRenderer=relativeLayout.findViewById(R.id.surface_view);
      surfaceViewRenderer.setMirror(false);
      surfaceViewRenderer.init(rootEglBase.getEglBaseContext(),null);
      surfaceViewRenderer.setZOrderMediaOverlay(false);
      surfaceViewRenderer.setEnableHardwareScaler(true);
      surfaceViewRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
      VideoRenderer remoteRenderer=new VideoRenderer(surfaceViewRenderer);
      videoTrack.addRenderer(remoteRenderer);
      remoteRenderersLayout.addView(relativeLayout);
      gotNick(session,getPeerConnectionWrapperForSessionId(session).getNick());
    }
 catch (    Exception e) {
      Log.d(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void gotRemoteStream(MediaStream stream,String session){
  removeMediaStream(session);
  if (stream.videoTracks.size() == 1) {
    VideoTrack videoTrack=stream.videoTracks.get(0);
    try {
      RelativeLayout relativeLayout=(RelativeLayout)getLayoutInflater().inflate(R.layout.surface_renderer,remoteRenderersLayout,false);
      relativeLayout.setTag(session);
      SurfaceViewRenderer surfaceViewRenderer=relativeLayout.findViewById(R.id.surface_view);
      surfaceViewRenderer.setMirror(false);
      surfaceViewRenderer.init(rootEglBase.getEglBaseContext(),null);
      surfaceViewRenderer.setZOrderMediaOverlay(false);
      surfaceViewRenderer.setEnableHardwareScaler(false);
      surfaceViewRenderer.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FIT);
      VideoRenderer remoteRenderer=new VideoRenderer(surfaceViewRenderer);
      videoTrack.addRenderer(remoteRenderer);
      remoteRenderersLayout.addView(relativeLayout);
      gotNick(session,getPeerConnectionWrapperForSessionId(session).getNick());
    }
 catch (    Exception e) {
      Log.d(TAG,"String_Node_Str");
    }
  }
}
Program: 35660
Project: 35660
Buggy source:
@TargetApi(Build.VERSION_CODES.O) public static void createNotificationChannel(NotificationManager notificationManager,String channelId,String channelName,String channelDescription,boolean vibrate,int importance){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O && notificationManager.getNotificationChannel(channelId) == null) {
    NotificationChannel channel=new NotificationChannel(channelId,channelName,importance);
    channel.setDescription(channelDescription);
    channel.enableLights(vibrate);
    channel.enableVibration(vibrate);
    channel.setLightColor(Color.RED);
    notificationManager.createNotificationChannel(channel);
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.O) public static void createNotificationChannel(NotificationManager notificationManager,String channelId,String channelName,String channelDescription,boolean vibrate,int importance,Uri soundUri){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O && notificationManager.getNotificationChannel(channelId) == null) {
    NotificationChannel channel=new NotificationChannel(channelId,channelName,importance);
    int usage;
    if (channelId.equals(NotificationUtils.NOTIFICATION_CHANNEL_CALLS)) {
      usage=AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_REQUEST;
    }
 else {
      usage=AudioAttributes.USAGE_NOTIFICATION_COMMUNICATION_INSTANT;
    }
    channel.setSound(soundUri,new AudioAttributes.Builder().setUsage(usage).build());
    channel.setDescription(channelDescription);
    channel.enableLights(vibrate);
    channel.enableVibration(vibrate);
    channel.setLightColor(Color.RED);
    notificationManager.createNotificationChannel(channel);
  }
}
Program: 35665
Project: 35665
Buggy source:
@Override public boolean onItemClick(int position){
  if (userItems.size() > position) {
    UserEntity userEntity=((AdvancedUserItem)userItems.get(position)).getEntity();
    userUtils.createOrUpdateUser(userEntity.getUsername(),userEntity.getToken(),userEntity.getBaseUrl(),null,null,true).subscribe(new Observer<UserEntity>(){
      @Override public void onSubscribe(      Disposable d){
      }
      @Override public void onNext(      UserEntity userEntity){
        cookieManager.getCookieStore().removeAll();
        userUtils.disableAllUsersWithoutId(userEntity.getId());
        getRouter().popCurrentController();
      }
      @Override public void onError(      Throwable e){
      }
      @Override public void onComplete(){
      }
    }
);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onItemClick(int position){
  if (userItems.size() > position) {
    UserEntity userEntity=((AdvancedUserItem)userItems.get(position)).getEntity();
    userUtils.createOrUpdateUser(userEntity.getUsername(),userEntity.getToken(),userEntity.getBaseUrl(),null,null,true,null).subscribe(new Observer<UserEntity>(){
      @Override public void onSubscribe(      Disposable d){
      }
      @Override public void onNext(      UserEntity userEntity){
        cookieManager.getCookieStore().removeAll();
        userUtils.disableAllUsersWithoutId(userEntity.getId());
        getRouter().popCurrentController();
      }
      @Override public void onError(      Throwable e){
      }
      @Override public void onComplete(){
      }
    }
);
  }
  return true;
}
Program: 35667
Project: 35667
Buggy source:
@Provides @Singleton public ReactiveEntityStore<Persistable> provideDataStore(@NonNull final Context context){
  final SqlCipherDatabaseSource source=new SqlCipherDatabaseSource(context,Models.DEFAULT,context.getResources().getString(R.string.nc_app_name).toLowerCase().replace("String_Node_Str","String_Node_Str").trim() + "String_Node_Str",context.getString(R.string.nc_talk_database_encryption_key),1);
  final Configuration configuration=source.getConfiguration();
  return ReactiveSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
}

Fixed version (ground truth):
@Provides @Singleton public ReactiveEntityStore<Persistable> provideDataStore(@NonNull final Context context){
  final SqlCipherDatabaseSource source=new SqlCipherDatabaseSource(context,Models.DEFAULT,context.getResources().getString(R.string.nc_app_name).toLowerCase().replace("String_Node_Str","String_Node_Str").trim() + "String_Node_Str",context.getString(R.string.nc_talk_database_encryption_key),2);
  final Configuration configuration=source.getConfiguration();
  return ReactiveSupport.toReactiveStore(new EntityDataStore<Persistable>(configuration));
}
Program: 35670
Project: 35670
Buggy source:
@Override public boolean handleBack(){
  return lastActiveChildRouter != null && lastActiveChildRouter.handleBack();
}

Fixed version (ground truth):
@Override public boolean handleBack(){
  return lastActiveChildRouter.handleBack();
}
Program: 35671
Project: 35671
Buggy source:
/** 
 * Resets the current backstack to the   {@link Controller}, supplied by   {@link BottomNavigationController#getControllerFor(int)}, using a   {@link FadeChangeHandler}.
 */
protected void resetCurrentBackstack(){
  if (lastActiveChildRouter != null) {
    lastActiveChildRouter.setRoot(RouterTransaction.with(this.getControllerFor(currentlySelectedItemId)).pushChangeHandler(new FadeChangeHandler()).popChangeHandler(new FadeChangeHandler()));
  }
}

Fixed version (ground truth):
/** 
 * Resets the current backstack to the   {@link Controller}, supplied by   {@link BottomNavigationController#getControllerFor(int)}, using a   {@link FadeChangeHandler}.
 */
protected void resetCurrentBackstack(){
  lastActiveChildRouter.setRoot(RouterTransaction.with(this.getControllerFor(currentlySelectedItemId)).pushChangeHandler(new FadeChangeHandler()).popChangeHandler(new FadeChangeHandler()));
}
Program: 35672
Project: 35672
Buggy source:
@Override public boolean onNavigationItemSelected(@NonNull MenuItem item){
  if (currentlySelectedItemId != item.getItemId()) {
    BottomNavigationController.this.destroyChildRouter(BottomNavigationController.this.getChildRouter(currentlySelectedItemId),currentlySelectedItemId);
    currentlySelectedItemId=item.getItemId();
    BottomNavigationController.this.configureRouter(BottomNavigationController.this.getChildRouter(currentlySelectedItemId),currentlySelectedItemId);
  }
 else {
    BottomNavigationController.this.resetCurrentBackstack();
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onNavigationItemSelected(@NonNull MenuItem item){
  navigateTo(item.getItemId(),getControllerFor(item.getItemId()));
  return true;
}
Program: 35673
Project: 35673
Buggy source:
@Override protected void onViewBound(@NonNull View view){
  super.onViewBound(view);
  bottomNavigationView.inflateMenu(getMenuResource());
  if (routerSavedStateBundles == null) {
    Menu menu=bottomNavigationView.getMenu();
    int menuSize=menu.size();
    routerSavedStateBundles=new SparseArray<>(menuSize);
    for (int i=0; i < menuSize; i++) {
      MenuItem menuItem=menu.getItem(i);
      if (menuItem.isChecked()) {
        int itemId=menuItem.getItemId();
        configureRouter(getChildRouter(itemId),itemId);
        bottomNavigationView.setSelectedItemId(itemId);
        currentlySelectedItemId=bottomNavigationView.getSelectedItemId();
        break;
      }
    }
  }
 else {
    Router childRouter=getChildRouter(currentlySelectedItemId);
    childRouter.rebindIfNeeded();
    lastActiveChildRouter=childRouter;
  }
  bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener(){
    @Override public boolean onNavigationItemSelected(    @NonNull MenuItem item){
      if (currentlySelectedItemId != item.getItemId()) {
        BottomNavigationController.this.destroyChildRouter(BottomNavigationController.this.getChildRouter(currentlySelectedItemId),currentlySelectedItemId);
        currentlySelectedItemId=item.getItemId();
        BottomNavigationController.this.configureRouter(BottomNavigationController.this.getChildRouter(currentlySelectedItemId),currentlySelectedItemId);
      }
 else {
        BottomNavigationController.this.resetCurrentBackstack();
      }
      return true;
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onViewBound(@NonNull View view){
  super.onViewBound(view);
  bottomNavigationView.inflateMenu(getMenuResource());
  bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener(){
    @Override public boolean onNavigationItemSelected(    @NonNull MenuItem item){
      navigateTo(item.getItemId(),getControllerFor(item.getItemId()));
      return true;
    }
  }
);
}
Program: 35674
Project: 35674
Buggy source:
@Override public boolean handleBack(){
  return lastActiveChildRouter.handleBack();
}

Fixed version (ground truth):
@Override public boolean handleBack(){
  return lastActiveChildRouter != null && lastActiveChildRouter.handleBack();
}