Program: 35668
Project: 35668
Buggy source:
public void pushRegistrationToServer(){
  String token=appPreferences.getPushToken();
  if (!TextUtils.isEmpty(token)) {
    String pushTokenHash=generateSHA512Hash(token).toLowerCase();
    PublicKey devicePublicKey=(PublicKey)readKeyFromFile(true);
    if (devicePublicKey != null) {
      byte[] publicKeyBytes=Base64.encode(devicePublicKey.getEncoded(),Base64.NO_WRAP);
      String publicKey=new String(publicKeyBytes);
      publicKey=publicKey.replaceAll("String_Node_Str","String_Node_Str");
      publicKey="String_Node_Str" + publicKey + "String_Node_Str";
      if (userUtils.anyUserExists()) {
        String providerValue;
        PushConfigurationState accountPushData=null;
        for (        Object userEntityObject : userUtils.getUsers()) {
          UserEntity userEntity=(UserEntity)userEntityObject;
          providerValue=userEntity.getPushConfigurationState();
          if (!TextUtils.isEmpty(providerValue)) {
            try {
              accountPushData=LoganSquare.parse(providerValue,PushConfigurationState.class);
            }
 catch (            IOException e) {
              Log.d(TAG,"String_Node_Str");
              accountPushData=null;
            }
          }
 else {
            accountPushData=null;
          }
          if (accountPushData != null && !accountPushData.getPushToken().equals(token) && !userEntity.getScheduledForDeletion() || TextUtils.isEmpty(providerValue) && !userEntity.getScheduledForDeletion()) {
            Map<String,String> queryMap=new HashMap<>();
            queryMap.put("String_Node_Str","String_Node_Str");
            queryMap.put("String_Node_Str",pushTokenHash);
            queryMap.put("String_Node_Str",publicKey);
            queryMap.put("String_Node_Str",proxyServer);
            ncApi=retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new JavaNetCookieJar(new CookieManager())).build()).build().create(NcApi.class);
            ncApi.registerDeviceForNotificationsWithNextcloud(ApiHelper.getCredentials(userEntity.getUsername(),userEntity.getToken()),ApiHelper.getUrlNextcloudPush(userEntity.getBaseUrl()),queryMap).subscribeOn(Schedulers.newThread()).subscribe(pushRegistrationOverall -> {
              Map<String,String> proxyMap=new HashMap<>();
              proxyMap.put("String_Node_Str",token);
              proxyMap.put("String_Node_Str",pushRegistrationOverall.getOcs().getData().getDeviceIdentifier());
              proxyMap.put("String_Node_Str",pushRegistrationOverall.getOcs().getData().getSignature());
              proxyMap.put("String_Node_Str",pushRegistrationOverall.getOcs().getData().getPublicKey());
              ncApi.registerDeviceForNotificationsWithProxy(ApiHelper.getCredentials(userEntity.getUsername(),userEntity.getToken()),ApiHelper.getUrlPushProxy(),proxyMap).subscribeOn(Schedulers.newThread()).subscribe(new Consumer<Void>(){
                @Override public void accept(                Void aVoid) throws Exception {
                  PushConfigurationState pushConfigurationState=new PushConfigurationState();
                  pushConfigurationState.setPushToken(token);
                  pushConfigurationState.setDeviceIdentifier(pushRegistrationOverall.getOcs().getData().getDeviceIdentifier());
                  pushConfigurationState.setDeviceIdentifierSignature(pushRegistrationOverall.getOcs().getData().getSignature());
                  pushConfigurationState.setUserPublicKey(pushRegistrationOverall.getOcs().getData().getPublicKey());
                  pushConfigurationState.setUsesRegularPass(false);
                  userUtils.createOrUpdateUser(userEntity.getUsername(),userEntity.getToken(),userEntity.getBaseUrl(),userEntity.getDisplayName(),LoganSquare.serialize(pushConfigurationState),null).subscribe(new Consumer<UserEntity>(){
                    @Override public void accept(                    UserEntity userEntity) throws Exception {
                    }
                  }
,new Consumer<Throwable>(){
                    @Override public void accept(                    Throwable throwable) throws Exception {
                    }
                  }
);
                }
              }
,new Consumer<Throwable>(){
                @Override public void accept(                Throwable throwable) throws Exception {
                }
              }
);
            }
,new Consumer<Throwable>(){
              @Override public void accept(              Throwable throwable) throws Exception {
              }
            }
);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void pushRegistrationToServer(){
  String token=appPreferences.getPushToken();
  if (!TextUtils.isEmpty(token)) {
    String pushTokenHash=generateSHA512Hash(token).toLowerCase();
    PublicKey devicePublicKey=(PublicKey)readKeyFromFile(true);
    if (devicePublicKey != null) {
      byte[] publicKeyBytes=Base64.encode(devicePublicKey.getEncoded(),Base64.NO_WRAP);
      String publicKey=new String(publicKeyBytes);
      publicKey=publicKey.replaceAll("String_Node_Str","String_Node_Str");
      publicKey="String_Node_Str" + publicKey + "String_Node_Str";
      if (userUtils.anyUserExists()) {
        String providerValue;
        PushConfigurationState accountPushData=null;
        for (        Object userEntityObject : userUtils.getUsers()) {
          UserEntity userEntity=(UserEntity)userEntityObject;
          providerValue=userEntity.getPushConfigurationState();
          if (!TextUtils.isEmpty(providerValue)) {
            try {
              accountPushData=LoganSquare.parse(providerValue,PushConfigurationState.class);
            }
 catch (            IOException e) {
              Log.d(TAG,"String_Node_Str");
              accountPushData=null;
            }
          }
 else {
            accountPushData=null;
          }
          if (accountPushData != null && !accountPushData.getPushToken().equals(token) && !userEntity.getScheduledForDeletion() || TextUtils.isEmpty(providerValue) && !userEntity.getScheduledForDeletion()) {
            Map<String,String> queryMap=new HashMap<>();
            queryMap.put("String_Node_Str","String_Node_Str");
            queryMap.put("String_Node_Str",pushTokenHash);
            queryMap.put("String_Node_Str",publicKey);
            queryMap.put("String_Node_Str",proxyServer);
            ncApi=retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new JavaNetCookieJar(new CookieManager())).build()).build().create(NcApi.class);
            ncApi.registerDeviceForNotificationsWithNextcloud(ApiHelper.getCredentials(userEntity.getUsername(),userEntity.getToken()),ApiHelper.getUrlNextcloudPush(userEntity.getBaseUrl()),queryMap).subscribeOn(Schedulers.newThread()).subscribe(pushRegistrationOverall -> {
              Map<String,String> proxyMap=new HashMap<>();
              proxyMap.put("String_Node_Str",token);
              proxyMap.put("String_Node_Str",pushRegistrationOverall.getOcs().getData().getDeviceIdentifier());
              proxyMap.put("String_Node_Str",pushRegistrationOverall.getOcs().getData().getSignature());
              proxyMap.put("String_Node_Str",pushRegistrationOverall.getOcs().getData().getPublicKey());
              ncApi.registerDeviceForNotificationsWithProxy(ApiHelper.getCredentials(userEntity.getUsername(),userEntity.getToken()),ApiHelper.getUrlPushProxy(),proxyMap).subscribeOn(Schedulers.newThread()).subscribe(new Consumer<Void>(){
                @Override public void accept(                Void aVoid) throws Exception {
                  PushConfigurationState pushConfigurationState=new PushConfigurationState();
                  pushConfigurationState.setPushToken(token);
                  pushConfigurationState.setDeviceIdentifier(pushRegistrationOverall.getOcs().getData().getDeviceIdentifier());
                  pushConfigurationState.setDeviceIdentifierSignature(pushRegistrationOverall.getOcs().getData().getSignature());
                  pushConfigurationState.setUserPublicKey(pushRegistrationOverall.getOcs().getData().getPublicKey());
                  pushConfigurationState.setUsesRegularPass(false);
                  userUtils.createOrUpdateUser(userEntity.getUsername(),userEntity.getToken(),userEntity.getBaseUrl(),userEntity.getDisplayName(),LoganSquare.serialize(pushConfigurationState),null,null).subscribe(new Consumer<UserEntity>(){
                    @Override public void accept(                    UserEntity userEntity) throws Exception {
                    }
                  }
,new Consumer<Throwable>(){
                    @Override public void accept(                    Throwable throwable) throws Exception {
                    }
                  }
);
                }
              }
,new Consumer<Throwable>(){
                @Override public void accept(                Throwable throwable) throws Exception {
                }
              }
);
            }
,new Consumer<Throwable>(){
              @Override public void accept(              Throwable throwable) throws Exception {
              }
            }
);
          }
        }
      }
    }
  }
}