nus-yam/ex-repair huggingface dataset:
Program: 168262
Project: 168262
Buggy source:
public static void checkReceiver(@NonNull final Context context,@NonNull final Intent broadcastIntent,@NonNull final String receiverName,@Nullable final String permission){
  final PackageManager packageManager=context.getPackageManager();
  final String packageName=context.getPackageName();
  final List<ResolveInfo> receivers=packageManager.queryBroadcastReceivers(broadcastIntent,PackageManager.GET_INTENT_FILTERS);
  if (receivers.isEmpty()) {
    throw new IllegalStateException("String_Node_Str" + OPFUtils.toString(broadcastIntent));
  }
  ResolveInfo neededReceiver=null;
  for (  ResolveInfo receiver : receivers) {
    if (receiver.activityInfo.name.equals(receiverName) && receiver.activityInfo.packageName.equals(packageName)) {
      neededReceiver=receiver;
      break;
    }
  }
  if (neededReceiver == null) {
    throw new IllegalStateException("String_Node_Str" + receiverName + "String_Node_Str");
  }
  if (permission != null && !permission.equals(neededReceiver.activityInfo.permission)) {
    throw new IllegalStateException("String_Node_Str" + permission + "String_Node_Str"+ receiverName);
  }
}

Fixed version (ground truth):
public static void checkReceiver(@NonNull final Context context,@NonNull final Intent broadcastIntent,@Nullable final String receiverName,@Nullable final String permission){
  final PackageManager packageManager=context.getPackageManager();
  final String packageName=context.getPackageName();
  final List<ResolveInfo> receivers=packageManager.queryBroadcastReceivers(broadcastIntent,PackageManager.GET_INTENT_FILTERS);
  if (receivers.isEmpty()) {
    throw new IllegalStateException("String_Node_Str" + OPFUtils.toString(broadcastIntent));
  }
  ResolveInfo neededReceiver=null;
  for (  ResolveInfo receiver : receivers) {
    if ((receiverName == null || receiver.activityInfo.name.equals(receiverName)) && receiver.activityInfo.packageName.equals(packageName)) {
      neededReceiver=receiver;
      break;
    }
  }
  if (neededReceiver == null) {
    throw new IllegalStateException("String_Node_Str" + receiverName + "String_Node_Str");
  }
  if (permission != null && !permission.equals(neededReceiver.activityInfo.permission)) {
    throw new IllegalStateException("String_Node_Str" + permission + "String_Node_Str"+ receiverName);
  }
}
Program: 168263
Project: 168263
Buggy source:
public ADMDelegate(@NonNull final Context context){
  OPFLog.methodD(context);
  if (OPFUtils.isInstalled(context,KINDLE_STORE_APP_PACKAGE)) {
    OPFLog.d("String_Node_Str");
    adm=new ADM(context.getApplicationContext());
  }
}

Fixed version (ground truth):
public ADMDelegate(@NonNull final Context context){
  OPFLog.methodD(context);
  if (OPFUtils.isInstalled(context,KINDLE_STORE_APP_PACKAGE) && isAdmClassExists()) {
    OPFLog.d("String_Node_Str");
    adm=new ADM(context.getApplicationContext());
  }
}
Program: 168264
Project: 168264
Buggy source:
@Override public void unregister(){
  OPFLog.methodD();
  adm.startUnregister();
}

Fixed version (ground truth):
@Override public void unregister(){
  OPFLog.methodD();
  OPFLog.i("String_Node_Str");
  adm.startUnregister();
}
Program: 168265
Project: 168265
Buggy source:
@Override public void register(){
  OPFLog.methodD();
  if (!isRegistered()) {
    OPFLog.d("String_Node_Str");
    adm.startRegister();
  }
}

Fixed version (ground truth):
@Override public void register(){
  OPFLog.methodD();
  OPFLog.d("String_Node_Str");
  adm.startRegister();
}
Program: 168266
Project: 168266
Buggy source:
public synchronized void unregister(){
  OPFLog.methodD();
  executeTask(new UnregisterTask(preferencesProvider.getRegistrationId()));
}

Fixed version (ground truth):
public synchronized void unregister(){
  OPFLog.methodD();
  OPFLog.i("String_Node_Str");
  executeTask(new UnregisterTask(preferencesProvider.getRegistrationId()));
}
Program: 168267
Project: 168267
Buggy source:
public synchronized void register(){
  OPFLog.methodD();
  executeTask(new RegisterTask());
}

Fixed version (ground truth):
public synchronized void register(){
  OPFLog.methodD();
  OPFLog.i("String_Node_Str");
  executeTask(new RegisterTask());
}
Program: 168268
Project: 168268
Buggy source:
@Override public void unregister(){
  OPFLog.methodD();
  PushRegistrar.unregister(getContext());
  PushRegistrar.onDestroy(getContext());
}

Fixed version (ground truth):
@Override public void unregister(){
  OPFLog.methodD();
  OPFLog.i("String_Node_Str");
  PushRegistrar.unregister(getContext());
  PushRegistrar.onDestroy(getContext());
}
Program: 168269
Project: 168269
Buggy source:
@Override public void register(){
  OPFLog.methodD();
  PushRegistrar.register(getContext(),sendersIds);
}

Fixed version (ground truth):
@Override public void register(){
  OPFLog.methodD();
  OPFLog.i("String_Node_Str");
  PushRegistrar.register(getContext(),sendersIds);
}
Program: 168270
Project: 168270
Buggy source:
private void registerNextAvailableProvider(@Nullable final String prevProviderName){
  OPFLog.methodD(prevProviderName);
  final int providersCount=sortedProvidersList.size();
  final int prevProviderPosition=getProviderPosition(sortedProvidersList,prevProviderName);
  for (int i=(prevProviderPosition + 1) % providersCount, j=0; j < providersCount; i=(i + 1) % providersCount, j++) {
    final PushProvider provider=sortedProvidersList.get(i);
    final String providerName=provider.getName();
    OPFLog.d("String_Node_Str" + providerName);
    if (provider.isAvailable() && !registerProviderErrors.containsKey(providerName)) {
      OPFLog.d("String_Node_Str");
      retryManager.cancelRetryAllOperations(provider.getName());
      register(provider);
    }
  }
  settings.saveState(UNREGISTERED);
  OPFLog.w("String_Node_Str");
  eventListenerWrapper.onNoAvailableProvider(appContext,registerProviderErrors);
}

Fixed version (ground truth):
private void registerNextAvailableProvider(@Nullable final String prevProviderName){
  OPFLog.methodD(prevProviderName);
  final int providersCount=sortedProvidersList.size();
  final int prevProviderPosition=getProviderPosition(sortedProvidersList,prevProviderName);
  for (int i=(prevProviderPosition + 1) % providersCount, j=0; j < providersCount; i=(i + 1) % providersCount, j++) {
    final PushProvider provider=sortedProvidersList.get(i);
    final String providerName=provider.getName();
    OPFLog.d("String_Node_Str" + providerName);
    if (provider.isAvailable() && !registerProviderErrors.containsKey(providerName)) {
      OPFLog.d("String_Node_Str");
      retryManager.cancelRetryAllOperations(provider.getName());
      register(provider);
      return;
    }
  }
  settings.saveState(UNREGISTERED);
  OPFLog.w("String_Node_Str");
  eventListenerWrapper.onNoAvailableProvider(appContext,registerProviderErrors);
}
Program: 168271
Project: 168271
Buggy source:
private void postRetry(@NonNull final String providerName,@NonNull final Operation operation,@NonNull final String action){
  final long when=System.currentTimeMillis() + getTryDelay(providerName,operation);
  OPFLog.d("String_Node_Str",providerName,SimpleDateFormat.getDateTimeInstance().format(new Date(when)));
  final Intent intent=new Intent(appContext,RetryBroadcastReceiver.class);
  intent.setAction(action);
  intent.putExtra(EXTRA_PROVIDER_NAME,providerName);
  alarmManager.set(AlarmManager.RTC,when,PendingIntent.getBroadcast(appContext,providerName.hashCode(),intent,0));
}

Fixed version (ground truth):
private void postRetry(@NonNull final String providerName,@NonNull final Operation operation,@NonNull final String action){
  final long when=System.currentTimeMillis() + getTryDelay(providerName,operation);
  OPFLog.d("String_Node_Str",providerName,SimpleDateFormat.getDateTimeInstance().format(new Date(when)));
  final Intent intent=new Intent(appContext,RetryBroadcastReceiver.class);
  intent.setAction(action);
  intent.putExtra(EXTRA_PROVIDER_NAME,providerName);
  alarmManager.set(AlarmManager.RTC,when,PendingIntent.getBroadcast(appContext,0,intent,0));
}
Program: 168272
Project: 168272
Buggy source:
/** 
 * Called when a registration request fails. You should consider a registration error fatal. In response, your app may degrade gracefully, or you may wish to notify the user that this part of your app's functionality is not available.
 * @param errorId One of the following values:{@link ADMConstants#ERROR_AUTHENTICATION_FAILED},  {@link ADMConstants#ERROR_INVALID_SENDER},  {@link ADMConstants#ERROR_SERVICE_NOT_AVAILABLE}.
 */
@Override protected void onRegistrationError(@NonNull @ADMError final String errorId){
  OPFPushLog.methodD(ADMService.class,"String_Node_Str",errorId);
  final OPFError error=convertError(errorId);
  OPFPushLog.d("String_Node_Str" + error);
  OPFPush.getHelper().getReceivedMessageHandler().onRegistrationError(NAME,error);
}

Fixed version (ground truth):
/** 
 * Called when a registration request fails. You should consider a registration error fatal. In response, your app may degrade gracefully, or you may wish to notify the user that this part of your app's functionality is not available.
 * @param errorId One of the following values:{@link ADMConstants#ERROR_AUTHENTICATION_FAILED},  {@link ADMConstants#ERROR_INVALID_SENDER},  {@link ADMConstants#ERROR_SERVICE_NOT_AVAILABLE}.
 */
@Override protected void onRegistrationError(@NonNull @ADMError final String errorId){
  OPFPushLog.methodD(ADMService.class,"String_Node_Str",errorId);
  final OPFError error=convertError(errorId);
  OPFPushLog.d("String_Node_Str" + error);
  OPFPush.getHelper().getReceivedMessageHandler().onError(NAME,error);
}
Program: 168273
Project: 168273
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  OPFPushLog.setLogEnable(true);
  final Configuration.Builder configBuilder=new Configuration.Builder().addProviders(new GCMProvider(this,GCM_SENDER_ID),new ADMProvider(this),new NokiaNotificationsProvider(this,NOKIA_SENDER_ID)).setBackoff(new ExponentialBackoff()).setSelectSystemPreferred(true).setEventListener(new DemoEventListener(this));
  OPFPush.init(this,configBuilder.build());
  OPFPush.getHelper().register();
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  OPFPushLog.setLogEnable(true);
  OPFPushLog.methodD(DemoApplication.class,"String_Node_Str");
  final Configuration.Builder configBuilder=new Configuration.Builder().addProviders(new GCMProvider(this,GCM_SENDER_ID),new ADMProvider(this),new NokiaNotificationsProvider(this,NOKIA_SENDER_ID)).setBackoff(new ExponentialBackoff()).setSelectSystemPreferred(true).setEventListener(new DemoEventListener(this));
  OPFPush.init(this,configBuilder.build());
  OPFPush.getHelper().register();
}
Program: 168274
Project: 168274
Buggy source:
@SuppressWarnings("String_Node_Str") public void onEventMainThread(@NonNull final UnregistrationErrorEvent unregistrationErrorEvent){
  final OPFError error=unregistrationErrorEvent.getError();
  initViewsRegisteredState("String_Node_Str");
  infoText.setText(getString(R.string.unregistration_error_fmt,error.name()));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void onEventMainThread(@NonNull final UnregistrationErrorEvent unregistrationErrorEvent){
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str",unregistrationErrorEvent);
  final OPFError error=unregistrationErrorEvent.getError();
  initViewsRegisteredState("String_Node_Str");
  infoText.setText(getString(R.string.unregistration_error_fmt,error.name()));
  EventBus.getDefault().removeStickyEvent(unregistrationErrorEvent);
}
Program: 168275
Project: 168275
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_demo);
  infoText=(TextView)findViewById(R.id.info_text);
  registerButton=(Button)findViewById(R.id.register_button);
  unregisterButton=(Button)findViewById(R.id.unregister_button);
  final String registrationId=helper.getRegistrationId();
  if (!TextUtils.isEmpty(registrationId)) {
    OPFPushLog.d("String_Node_Str" + registrationId);
    initViewsRegisteredState(registrationId);
  }
 else {
    initViewsRegisteringState();
  }
  adapter=new ArrayAdapter<>(this,R.layout.item_message);
  final ListView messagesListView=(ListView)findViewById(R.id.messages_list);
  messagesListView.setAdapter(adapter);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str");
  setContentView(R.layout.activity_demo);
  infoText=(TextView)findViewById(R.id.info_text);
  registerButton=(Button)findViewById(R.id.register_button);
  unregisterButton=(Button)findViewById(R.id.unregister_button);
  final String registrationId=helper.getRegistrationId();
  if (!TextUtils.isEmpty(registrationId)) {
    OPFPushLog.d("String_Node_Str" + registrationId);
    initViewsRegisteredState(registrationId);
  }
 else {
    initViewsRegisteringState();
  }
  adapter=new ArrayAdapter<>(this,R.layout.item_message);
  final ListView messagesListView=(ListView)findViewById(R.id.messages_list);
  messagesListView.setAdapter(adapter);
}
Program: 168276
Project: 168276
Buggy source:
private void initViewsUnregisteredState(@NonNull final String registrationId){
  infoText.setText(getString(R.string.unregistered_state_fmt,registrationId));
  registerButton.setVisibility(View.VISIBLE);
  registerButton.setEnabled(true);
  unregisterButton.setVisibility(View.GONE);
}

Fixed version (ground truth):
private void initViewsUnregisteredState(@NonNull final String registrationId){
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str",registrationId);
  infoText.setText(getString(R.string.unregistered_state_fmt,registrationId));
  registerButton.setVisibility(View.VISIBLE);
  registerButton.setEnabled(true);
  unregisterButton.setVisibility(View.GONE);
}
Program: 168277
Project: 168277
Buggy source:
private void initViewsUnregisteringState(){
  infoText.setText(getString(R.string.unregistration));
  registerButton.setVisibility(View.GONE);
  unregisterButton.setVisibility(View.VISIBLE);
  unregisterButton.setEnabled(false);
}

Fixed version (ground truth):
private void initViewsUnregisteringState(){
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str");
  infoText.setText(getString(R.string.unregistration));
  registerButton.setVisibility(View.GONE);
  unregisterButton.setVisibility(View.VISIBLE);
  unregisterButton.setEnabled(false);
}
Program: 168278
Project: 168278
Buggy source:
public void onUnregisterClick(@NonNull final View view){
  initViewsUnregisteringState();
  helper.unregister();
}

Fixed version (ground truth):
public void onUnregisterClick(@NonNull final View view){
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str");
  initViewsUnregisteringState();
  helper.unregister();
}
Program: 168279
Project: 168279
Buggy source:
@Override protected void onPause(){
  super.onPause();
  EventBus.getDefault().unregister(this);
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str");
  EventBus.getDefault().unregister(this);
}
Program: 168280
Project: 168280
Buggy source:
@Override protected void onResume(){
  super.onResume();
  EventBus.getDefault().registerSticky(this);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str");
  EventBus.getDefault().registerSticky(this);
}
Program: 168281
Project: 168281
Buggy source:
public void onRegisterClick(@NonNull final View view){
  initViewsRegisteringState();
  helper.register();
}

Fixed version (ground truth):
public void onRegisterClick(@NonNull final View view){
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str");
  initViewsRegisteringState();
  helper.register();
}
Program: 168282
Project: 168282
Buggy source:
private void initViewsRegisteredState(@NonNull final String registrationId){
  infoText.setText(getString(R.string.registered_state_fmt,registrationId));
  registerButton.setVisibility(View.GONE);
  unregisterButton.setVisibility(View.VISIBLE);
  unregisterButton.setEnabled(true);
}

Fixed version (ground truth):
private void initViewsRegisteredState(@NonNull final String registrationId){
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str",registrationId);
  infoText.setText(getString(R.string.registered_state_fmt,registrationId));
  registerButton.setVisibility(View.GONE);
  unregisterButton.setVisibility(View.VISIBLE);
  unregisterButton.setEnabled(true);
}
Program: 168283
Project: 168283
Buggy source:
private void initViewsRegisteringState(){
  infoText.setText(getString(R.string.registration));
  registerButton.setVisibility(View.VISIBLE);
  registerButton.setEnabled(false);
  unregisterButton.setVisibility(View.GONE);
}

Fixed version (ground truth):
private void initViewsRegisteringState(){
  OPFPushLog.methodD(DemoActivity.class,"String_Node_Str");
  infoText.setText(getString(R.string.registration));
  registerButton.setVisibility(View.VISIBLE);
  registerButton.setEnabled(false);
  unregisterButton.setVisibility(View.GONE);
}
Program: 168284
Project: 168284
Buggy source:
private void initLastProvider(){
  final PushProvider lastProvider=getLastProvider();
  if (lastProvider == null) {
    return;
  }
  LOGI(String.format("String_Node_Str",lastProvider));
  if (lastProvider.isAvailable()) {
    if (lastProvider.isRegistered()) {
      LOGI("String_Node_Str");
      mCurrentProvider=lastProvider;
      mState.set(STATE_WORKING);
    }
 else {
      LOGI("String_Node_Str");
      mState.set(STATE_REGISTERING);
      if (!registerProvider(lastProvider)) {
        mState.set(STATE_NONE);
        saveLastProvider(null);
      }
    }
  }
 else {
    LOGI("String_Node_Str");
    reset();
    if (mOptions.isRecoverProvider()) {
      LOGI("String_Node_Str");
      register();
    }
  }
}

Fixed version (ground truth):
private void initLastProvider(){
  final PushProvider lastProvider=getLastProvider();
  if (lastProvider == null) {
    return;
  }
  LOGI(String.format("String_Node_Str",lastProvider));
  if (lastProvider.isAvailable()) {
    if (lastProvider.isRegistered()) {
      LOGI("String_Node_Str");
      mCurrentProvider=lastProvider;
      mState.set(STATE_WORKING);
    }
 else {
      LOGI("String_Node_Str");
      mState.set(STATE_REGISTERING);
      if (!registerProvider(lastProvider)) {
        mState.set(STATE_NONE);
        saveLastProvider(null);
      }
    }
  }
 else {
    lastProvider.onUnavailable();
    LOGI("String_Node_Str");
    reset();
    if (mOptions.isRecoverProvider()) {
      LOGI("String_Node_Str");
      register();
    }
  }
}
Program: 168285
Project: 168285
Buggy source:
public synchronized void onResult(Result result){
switch (mState.get()) {
case STATE_REGISTERING:
    onRegistrationResult(result);
  break;
case STATE_UNREGISTERING:
onUnregistrationResult(result);
break;
default :
throw new UnsupportedOperationException("String_Node_Str" + "String_Node_Str");
}
}

Fixed version (ground truth):
public void onResult(Result result){
synchronized (mRegistrationLock) {
switch (mState.get()) {
case STATE_REGISTERING:
      onRegistrationResult(result);
    break;
case STATE_UNREGISTERING:
  onUnregistrationResult(result);
break;
default :
throw new UnsupportedOperationException("String_Node_Str" + "String_Node_Str");
}
}
}
Program: 168286
Project: 168286
Buggy source:
private void reset(){
  mPreferences.edit().clear().apply();
  mState.set(STATE_NONE);
}

Fixed version (ground truth):
void reset(){
  mPreferences.edit().clear().apply();
  mState.set(STATE_NONE);
}
Program: 168287
Project: 168287
Buggy source:
/** 
 * Called when a registration request fails. You should consider a registration error fatal. In response, your app may degrade gracefully, or you may wish to notify the user that this part of your app's functionality is not available.
 * @param errorId One of the following values:{@link ADMConstants#ERROR_AUTHENTICATION_FAILED},  {@link ADMConstants#ERROR_INVALID_SENDER},  {@link ADMConstants#ERROR_SERVICE_NOT_AVAILABLE}.
 */
@Override protected void onRegistrationError(@NotNull @MagicConstant(stringValues={ADMConstants.ERROR_AUTHENTICATION_FAILED,ADMConstants.ERROR_INVALID_SENDER,ADMConstants.ERROR_SERVICE_NOT_AVAILABLE}) String errorId){
  if (!ADMConstants.ERROR_SERVICE_NOT_AVAILABLE.equals(errorId)) {
    Error error=convertError(errorId);
    OpenPushHelper.getInstance(this).onRegistrationEnd(new RegistrationResult(ADMProvider.NAME,error,false));
  }
}

Fixed version (ground truth):
/** 
 * Called when a registration request fails. You should consider a registration error fatal. In response, your app may degrade gracefully, or you may wish to notify the user that this part of your app's functionality is not available.
 * @param errorId One of the following values:{@link ADMConstants#ERROR_AUTHENTICATION_FAILED},  {@link ADMConstants#ERROR_INVALID_SENDER},  {@link ADMConstants#ERROR_SERVICE_NOT_AVAILABLE}.
 */
@Override protected void onRegistrationError(@NotNull @MagicConstant(stringValues={ADMConstants.ERROR_AUTHENTICATION_FAILED,ADMConstants.ERROR_INVALID_SENDER,ADMConstants.ERROR_SERVICE_NOT_AVAILABLE}) String errorId){
  OpenPushHelper.getInstance(this).onRegistrationEnd(new RegistrationResult(ADMProvider.NAME,convertError(errorId),false));
}
Program: 168288
Project: 168288
Buggy source:
@Override public boolean isAvailable(){
  return true;
}

Fixed version (ground truth):
@Override public boolean isAvailable(){
  return mHostAppEnable && mAvailable;
}
Program: 168289
Project: 168289
Buggy source:
@Override public void unregister(){
  mRegistrationId=null;
  OpenPushHelperKeeper.getInstance(getContext()).onUnregistrationEnd(new RegistrationResult(NAME,mRegistrationId));
}

Fixed version (ground truth):
@Override public void unregister(){
  mRegistrationId=null;
  OpenPushHelperKeeper.getInstance(getContext()).onUnregistrationEnd(new RegistrationResult(getName(),mRegistrationId));
}
Program: 168290
Project: 168290
Buggy source:
MockPushProvider(@NotNull Context context){
  super(context,NAME,"String_Node_Str");
}

Fixed version (ground truth):
MockPushProvider(@NotNull Context context,@NotNull String name,boolean available,@NotNull String hotAppPackage){
  super(context,name,hotAppPackage);
  mAvailable=available;
}
Program: 168291
Project: 168291
Buggy source:
@Override public void register(){
  mRegistrationId=UUID.randomUUID().toString();
  OpenPushHelperKeeper.getInstance(getContext()).onRegistrationEnd(new RegistrationResult(NAME,mRegistrationId));
}

Fixed version (ground truth):
@Override public void register(){
  mRegistrationId=UUID.randomUUID().toString();
  OpenPushHelperKeeper.getInstance(getContext()).onRegistrationEnd(new RegistrationResult(getName(),mRegistrationId));
}
Program: 168292
Project: 168292
Buggy source:
@Test public void testInit(){
  Options.Builder builder=new Options.Builder();
  builder.addProviders(new MockPushProvider(Robolectric.application));
  OpenPushHelper openPushHelper=OpenPushHelperKeeper.getNewInstance(Robolectric.application);
  assertEquals(false,openPushHelper.isInitDone());
  assertEquals(OpenPushHelper.State.NONE,openPushHelper.getState());
  openPushHelper.init(builder.build());
  assertEquals(true,openPushHelper.isInitDone());
  assertEquals(OpenPushHelper.State.NONE,openPushHelper.getState());
}

Fixed version (ground truth):
@Test public void testInit(){
  Options.Builder builder=new Options.Builder();
  builder.addProviders(new MockPushProvider(Robolectric.application));
  OpenPushHelper openPushHelper=OpenPushHelperKeeper.getNewInstance(Robolectric.application);
  assertFalse(openPushHelper.isInitDone());
  assertEquals(OpenPushHelper.State.NONE,openPushHelper.getState());
  openPushHelper.init(builder.build());
  assertTrue(openPushHelper.isInitDone());
  assertEquals(OpenPushHelper.State.NONE,openPushHelper.getState());
}
Program: 168293
Project: 168293
Buggy source:
@Test(expected=OpenPushException.class) public void testInitTwice(){
  Options.Builder builder=new Options.Builder();
  builder.addProviders(new MockPushProvider(Robolectric.application));
  OpenPushHelper openPushHelper=OpenPushHelperKeeper.getNewInstance(Robolectric.application);
  assertEquals(false,openPushHelper.isInitDone());
  openPushHelper.init(builder.build());
  assertEquals(true,openPushHelper.isInitDone());
  openPushHelper.init(builder.build());
}

Fixed version (ground truth):
@Test(expected=OpenPushException.class) public void testInitTwice(){
  Options.Builder builder=new Options.Builder();
  builder.addProviders(new MockPushProvider(Robolectric.application));
  OpenPushHelper openPushHelper=OpenPushHelperKeeper.getNewInstance(Robolectric.application);
  assertFalse(openPushHelper.isInitDone());
  openPushHelper.init(builder.build());
  assertTrue(openPushHelper.isInitDone());
  openPushHelper.init(builder.build());
}
Program: 168294
Project: 168294
Buggy source:
@Test public void testRegister(){
  OpenPushHelper helper=OpenPushHelperKeeper.getNewInstance(Robolectric.application);
  Options.Builder builder=new Options.Builder();
  builder.addProviders(new MockPushProvider(Robolectric.application));
  Options options=builder.build();
  helper.init(options);
  assertEquals(true,helper.isInitDone());
  assertEquals(OpenPushHelper.State.NONE,helper.getState());
  helper.register();
  assertEquals(OpenPushHelper.State.RUNNING,helper.getState());
  assertEquals(MockPushProvider.NAME,helper.getCurrentProviderName());
  assertNotNull(helper.getCurrentProviderRegistrationId());
}

Fixed version (ground truth):
@Test public void testRegister(){
  OpenPushHelper helper=OpenPushHelperKeeper.getNewInstance(Robolectric.application);
  Options.Builder builder=new Options.Builder();
  final String providerName="String_Node_Str";
  builder.addProviders(new MockPushProvider(Robolectric.application,providerName));
  Options options=builder.build();
  helper.init(options);
  assertTrue(helper.isInitDone());
  assertEquals(OpenPushHelper.State.NONE,helper.getState());
  helper.register();
  assertEquals(OpenPushHelper.State.RUNNING,helper.getState());
  assertEquals(providerName,helper.getCurrentProviderName());
  assertNotNull(helper.getCurrentProviderRegistrationId());
}
Program: 168295
Project: 168295
Buggy source:
@Test public void testUnregister(){
  OpenPushHelper helper=OpenPushHelperKeeper.getNewInstance(Robolectric.application);
  Options.Builder builder=new Options.Builder();
  builder.addProviders(new MockPushProvider(Robolectric.application));
  Options options=builder.build();
  helper.init(options);
  assertEquals(true,helper.isInitDone());
  assertEquals(OpenPushHelper.State.NONE,helper.getState());
  helper.register();
  assertEquals(OpenPushHelper.State.RUNNING,helper.getState());
  assertEquals(MockPushProvider.NAME,helper.getCurrentProviderName());
  assertNotNull(helper.getCurrentProviderRegistrationId());
  helper.unregister();
  assertEquals(OpenPushHelper.State.NONE,helper.getState());
  assertNull(helper.getCurrentProviderName());
  assertNull(helper.getCurrentProviderRegistrationId());
}

Fixed version (ground truth):
@Test public void testUnregister(){
  OpenPushHelper helper=OpenPushHelperKeeper.getNewInstance(Robolectric.application);
  Options.Builder builder=new Options.Builder();
  final String providerName="String_Node_Str";
  builder.addProviders(new MockPushProvider(Robolectric.application,providerName));
  Options options=builder.build();
  helper.init(options);
  assertTrue(helper.isInitDone());
  assertEquals(OpenPushHelper.State.NONE,helper.getState());
  helper.register();
  assertEquals(OpenPushHelper.State.RUNNING,helper.getState());
  assertEquals(providerName,helper.getCurrentProviderName());
  assertNotNull(helper.getCurrentProviderRegistrationId());
  helper.unregister();
  assertEquals(OpenPushHelper.State.NONE,helper.getState());
  assertNull(helper.getCurrentProviderName());
  assertNull(helper.getCurrentProviderRegistrationId());
}
Program: 168296
Project: 168296
Buggy source:
public void onProviderBecameUnavailable(@NotNull PushProvider provider){
  LOGD(TAG,String.format("String_Node_Str",provider));
  if (mCurrentProvider != null && mCurrentProvider.equals(provider)) {
    reset();
    mCurrentProvider=null;
    if (mListener != null) {
      mListener.onProviderBecameUnavailable(provider.getName());
    }
    if (mOptions.isRecoverProvider()) {
      register();
    }
  }
}

Fixed version (ground truth):
public void onProviderBecameUnavailable(@NotNull PushProvider provider){
  LOGD(TAG,String.format("String_Node_Str",provider));
  if (mCurrentProvider != null && mCurrentProvider.equals(provider)) {
    reset();
    mCurrentProvider.onAppStateChanged();
    mCurrentProvider=null;
    if (mListener != null) {
      mListener.onProviderBecameUnavailable(provider.getName());
    }
    if (mOptions.isRecoverProvider()) {
      register();
    }
  }
}
Program: 168297
Project: 168297
Buggy source:
public void onRegistrationEnd(@NotNull RegistrationResult result){
  if (mState != State.STATE_REGISTRATION_RUNNING) {
    return;
  }
  if (result.isSuccess()) {
    mState=State.STATE_RUNNING;
    mRetryNumber=0;
    mCurrentProvider=getProviderByName(result.getProviderName());
    saveLastProvider(mCurrentProvider);
    Assert.assertNotNull(result.getRegistrationId());
    if (mListener != null) {
      mListener.onRegistered(result.getProviderName(),result.getRegistrationId());
    }
    Assert.assertNotNull(mCurrentProvider);
    registerPackageChangeReceiver(mCurrentProvider);
  }
 else {
    PushProvider provider=getProviderByName(result.getProviderName());
    Assert.assertNotNull(provider);
    if (result.isRecoverableError() && mOptions.getBackoff() != null && mRetryNumber < mOptions.getBackoff().getTryCount()) {
      postRegistrationRetry(provider);
    }
 else {
      if (mListener != null) {
        mListener.onRegistrationError(provider.getName(),result.getErrorCode());
      }
      mRetryNumber=0;
      PushProvider nextProvider=getNextCandidate(provider);
      if (nextProvider == null || !registerProvider(nextProvider)) {
        mState=State.STATE_NO_AVAILABLE_PROVIDERS;
        if (mListener != null) {
          mListener.onNoAvailableProvider();
        }
      }
    }
  }
}

Fixed version (ground truth):
public void onRegistrationEnd(@NotNull RegistrationResult result){
  if (mState != State.STATE_REGISTRATION_RUNNING) {
    return;
  }
  if (result.isSuccess()) {
    mState=State.STATE_RUNNING;
    cancelRetryRegistration();
    mCurrentProvider=getProviderByName(result.getProviderName());
    saveLastProvider(mCurrentProvider);
    Assert.assertNotNull(result.getRegistrationId());
    if (mListener != null) {
      mListener.onRegistered(result.getProviderName(),result.getRegistrationId());
    }
    Assert.assertNotNull(mCurrentProvider);
    registerPackageChangeReceiver(mCurrentProvider);
  }
 else {
    PushProvider provider=getProviderByName(result.getProviderName());
    Assert.assertNotNull(provider);
    if (!result.isRecoverableError() || !postRegistrationRetry(provider)) {
      if (mListener != null) {
        mListener.onRegistrationError(provider.getName(),result.getErrorCode());
      }
      mRetryNumber=0;
      registerNextProvider(provider);
    }
  }
}
Program: 168298
Project: 168298
Buggy source:
public void onNeedRetryRegister(@NotNull String providerName){
  if (mCurrentProvider != null && providerName.equals(mCurrentProvider.getName())) {
    reset();
    mCurrentProvider.onAppStateChanged();
    registerProvider(mCurrentProvider);
  }
}

Fixed version (ground truth):
public void onNeedRetryRegister(@NotNull String providerName){
  if (mCurrentProvider != null && mCurrentProvider.getName().equals(providerName)) {
    reset();
    mCurrentProvider.onAppStateChanged();
    registerProvider(mCurrentProvider);
  }
}
Program: 168299
Project: 168299
Buggy source:
private void reset(){
  mPreferences.edit().clear().apply();
  mState=State.STATE_NONE;
  mRetryNumber=0;
  if (mRegistrationRunnable != null) {
    sHandler.removeCallbacks(mRegistrationRunnable);
    mRegistrationRunnable=null;
  }
}

Fixed version (ground truth):
private void reset(){
  mPreferences.edit().clear().apply();
  mState=State.STATE_NONE;
  cancelRetryRegistration();
}
Program: 168300
Project: 168300
Buggy source:
public synchronized void register(){
  checkInitDone();
switch (mState) {
case STATE_NONE:
case STATE_NO_AVAILABLE_PROVIDERS:
    mState=State.STATE_REGISTRATION_RUNNING;
  PushProvider provider=getNextCandidate(null);
if (provider == null || !registerProvider(provider)) {
  if (mListener != null) {
    mListener.onNoAvailableProvider();
  }
  mState=State.STATE_NONE;
}
break;
case STATE_UNREGISTRATION_RUNNING:
throw new OpenPushException("String_Node_Str");
default :
throw new OpenPushException("String_Node_Str");
}
}

Fixed version (ground truth):
public synchronized void register(){
  checkInitDone();
switch (mState) {
case STATE_NONE:
case STATE_NO_AVAILABLE_PROVIDERS:
    mState=State.STATE_REGISTRATION_RUNNING;
  registerNextProvider(null);
break;
case STATE_UNREGISTRATION_RUNNING:
throw new OpenPushException("String_Node_Str");
default :
throw new OpenPushException("String_Node_Str");
}
}
Program: 168301
Project: 168301
Buggy source:
private void postRegistrationRetry(@NotNull PushProvider provider){
  long start=System.currentTimeMillis() + mOptions.getBackoff().getDelay(mRetryNumber);
  mRetryNumber++;
  if (mRegistrationRunnable == null) {
    mRegistrationRunnable=new RetryRegistrationRunnable(provider);
  }
  sHandler.postAtTime(mRegistrationRunnable,start);
}

Fixed version (ground truth):
private boolean postRegistrationRetry(@NotNull PushProvider provider){
  if (mOptions.getBackoff() != null && mRetryNumber < mOptions.getBackoff().getTryCount()) {
    long start=System.currentTimeMillis() + mOptions.getBackoff().getDelay(mRetryNumber);
    mRetryNumber++;
    if (mRegistrationRunnable == null || !mRegistrationRunnable.getProvider().equals(provider)) {
      mRegistrationRunnable=new RetryRegistrationRunnable(provider);
    }
    sHandler.postAtTime(mRegistrationRunnable,start);
    return true;
  }
 else {
    return false;
  }
}
Program: 168302
Project: 168302
Buggy source:
private void saveProvider(PushProvider provider){
  mAppContext.getSharedPreferences(PREFERENCES,Context.MODE_PRIVATE).edit().putString(KEY_LAST_PROVIDER_NAME,provider.getName()).apply();
}

Fixed version (ground truth):
private void saveProvider(@Nullable PushProvider provider){
  if (provider == null) {
    mAppContext.getSharedPreferences(PREFERENCES,Context.MODE_PRIVATE).edit().remove(KEY_LAST_PROVIDER_NAME).apply();
  }
 else {
    mAppContext.getSharedPreferences(PREFERENCES,Context.MODE_PRIVATE).edit().putString(KEY_LAST_PROVIDER_NAME,provider.getName()).apply();
  }
}
Program: 168303
Project: 168303
Buggy source:
private OpenPushHelper(@NotNull Context context){
  mAppContext=context.getApplicationContext();
  sListener=new OpenPushListener(mAppContext);
  mInitStatus=getSavedInitStatus();
  PushProvider provider=getLastProvider();
  if (provider != null && provider.isAvailable() && mInitStatus == INIT_SUCCESS) {
    mCurrentProvider=provider;
  }
}

Fixed version (ground truth):
private OpenPushHelper(@NotNull Context context){
  mAppContext=context.getApplicationContext();
  sListener=new BroadcastOpenPushListener(mAppContext);
  mInitStatus=getSavedInitStatus();
  PushProvider provider=getLastProvider();
  if (provider != null && provider.isAvailable() && mInitStatus == INIT_SUCCESS) {
    mCurrentProvider=provider;
  }
}
Program: 168304
Project: 168304
Buggy source:
private void onRegistrationResult(@NotNull final ProviderRegistrationResult result){
  final PushProvider provider=getProviderByName(result.getProviderName());
  Assert.assertNotNull(provider);
  if (result.isSuccess()) {
    mInitStatus=INIT_SUCCESS;
    saveInitStatus(INIT_SUCCESS);
    mRetryNumber=0;
    mCurrentProvider=provider;
    saveProvider(mCurrentProvider);
    sListener.onRegistered(result.getProviderName(),result.getRegistrationId());
  }
 else {
    if (result.isRecoverableError() && mOptions.getRetryPolice() != null && mRetryNumber < mOptions.getRetryPolice().tryCount()) {
      sHandler.postDelayed(new RetryRegistrationRunnable(provider),mOptions.getRetryPolice().getDelay(mRetryNumber));
      mRetryNumber++;
    }
 else {
      sListener.onRegistrationError(provider.getName(),result.getErrorCode());
      mRetryNumber=0;
      PushProvider nextProvider=getNextCandidate(provider);
      if (nextProvider != null) {
        nextProvider.register();
      }
 else {
        mInitStatus=INIT_ERROR;
        sListener.onNoAvailableProvider();
      }
    }
  }
}

Fixed version (ground truth):
private void onRegistrationResult(@NotNull final ProviderRegistrationResult result){
  final PushProvider provider=getProviderByName(result.getProviderName());
  Assert.assertNotNull(provider);
  if (result.isSuccess()) {
    mInitStatus=INIT_SUCCESS;
    mAppContext.getSharedPreferences(PREFERENCES,Context.MODE_PRIVATE).edit().putInt(KEY_INIT_STATUS,INIT_SUCCESS).apply();
    mRetryNumber=0;
    mCurrentProvider=provider;
    saveProvider(mCurrentProvider);
    sListener.onRegistered(result.getProviderName(),result.getRegistrationId());
  }
 else {
    if (result.isRecoverableError() && mOptions.getRetryPolice() != null && mRetryNumber < mOptions.getRetryPolice().tryCount()) {
      sHandler.postDelayed(new RetryRegistrationRunnable(provider),mOptions.getRetryPolice().getDelay(mRetryNumber));
      mRetryNumber++;
    }
 else {
      sListener.onRegistrationError(provider.getName(),result.getErrorCode());
      mRetryNumber=0;
      PushProvider nextProvider=getNextCandidate(provider);
      if (nextProvider != null) {
        nextProvider.register();
      }
 else {
        mInitStatus=INIT_ERROR;
        sListener.onNoAvailableProvider();
      }
    }
  }
}
Program: 168305
Project: 168305
Buggy source:
void onRegistrationError(@NotNull String providerName,int errorId){
  Bundle extras=new Bundle(1);
  extras.putInt(OpenPushConstants.EXTRA_ERROR_ID,errorId);
  sendBroadcast(OpenPushConstants.ACTION_REGISTRATION_ERROR,providerName,extras);
}

Fixed version (ground truth):
void onRegistrationError(@NotNull String providerName,int errorId);
Program: 168306
Project: 168306
Buggy source:
void onNoAvailableProvider(){
  sendBroadcast(OpenPushConstants.ACTION_NO_AVAILABLE_PROVIDER,null,null);
}

Fixed version (ground truth):
void onNoAvailableProvider();
Program: 168307
Project: 168307
Buggy source:
public void onMessage(@NotNull String providerName,@Nullable Bundle extras){
  sendBroadcast(OpenPushConstants.ACTION_MESSAGE,providerName,extras);
}

Fixed version (ground truth):
void onMessage(@NotNull String providerName,@Nullable Bundle extras);
Program: 168308
Project: 168308
Buggy source:
public void onDeletedMessages(@NotNull String providerName,@Nullable Bundle extras){
  sendBroadcast(OpenPushConstants.ACTION_DELETED_MESSAGES,providerName,extras);
}

Fixed version (ground truth):
void onDeletedMessages(@NotNull String providerName,@Nullable Bundle extras);
Program: 168309
Project: 168309
Buggy source:
void onRegistered(@NotNull String providerName,@Nullable String registrationId){
  Bundle extras=new Bundle(1);
  extras.putString(OpenPushConstants.EXTRA_REGISTRATION_ID,registrationId);
  sendBroadcast(OpenPushConstants.ACTION_REGISTERED,providerName,extras);
}

Fixed version (ground truth):
void onRegistered(@NotNull String providerName,@Nullable String registrationId);
Program: 168310
Project: 168310
Buggy source:
public void onUnregistered(@NotNull String providerName,@Nullable String registrationId){
  Bundle extras=new Bundle(1);
  extras.putString(OpenPushConstants.EXTRA_REGISTRATION_ID,registrationId);
  sendBroadcast(OpenPushConstants.ACTION_UNREGISTERED,providerName,extras);
}

Fixed version (ground truth):
void onUnregistered(@NotNull String providerName,@Nullable String registrationId);
Program: 168311
Project: 168311
Buggy source:
public ProviderRegistrationResult(@NotNull String providerName,@MagicConstant(intValues={OpenPushConstants.ERROR_INVALID_PARAMETERS,OpenPushConstants.ERROR_INVALID_SENDER,OpenPushConstants.ERROR_SERVICE_NOT_AVAILABLE,OpenPushConstants.ERROR_UNKNOWN,OpenPushConstants.ERROR_AUTHEFICATION_FAILED}) int errorCode){
  mProviderName=providerName;
  mRegistrationId=null;
  mErrorCode=errorCode;
}

Fixed version (ground truth):
public ProviderRegistrationResult(@NotNull String providerName,@MagicConstant(intValues={OpenPushConstants.ERROR_INVALID_PARAMETERS,OpenPushConstants.ERROR_INVALID_SENDER,OpenPushConstants.ERROR_SERVICE_NOT_AVAILABLE,OpenPushConstants.ERROR_UNKNOWN,OpenPushConstants.ERROR_AUTHEFICATION_FAILED}) int errorCode,boolean recoverableError){
  mProviderName=providerName;
  mRegistrationId=null;
  mErrorCode=errorCode;
  mRecoverableError=recoverableError;
}
Program: 168312
Project: 168312
Buggy source:
public static void notifyRegistrationEnd(@NotNull final ProviderRegistrationResult r){
  if (sInstance != null && sInstance.mInitStatus == INIT_IN_PROGRESS) {
    sInstance.onRegistrationResult(r);
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
}

Fixed version (ground truth):
public static void notifyRegistrationEnd(@NotNull final RegistrationResult r){
  if (sInstance != null && sInstance.mInitStatus == INIT_IN_PROGRESS) {
    sInstance.onRegistrationResult(r);
  }
 else {
    throw new UnsupportedOperationException("String_Node_Str");
  }
}
Program: 168313
Project: 168313
Buggy source:
private void onRegistrationResult(@NotNull final ProviderRegistrationResult result){
  final PushProvider provider=getProviderByName(result.getProviderName());
  Assert.assertNotNull(provider);
  if (result.isSuccess()) {
    mInitStatus=INIT_SUCCESS;
    mAppContext.getSharedPreferences(PREFERENCES,Context.MODE_PRIVATE).edit().putInt(KEY_INIT_STATUS,INIT_SUCCESS).apply();
    mRetryNumber=0;
    mCurrentProvider=provider;
    saveProvider(mCurrentProvider);
    sListener.onRegistered(result.getProviderName(),result.getRegistrationId());
  }
 else {
    if (result.isRecoverableError() && mOptions.getRetryPolice() != null && mRetryNumber < mOptions.getRetryPolice().tryCount()) {
      sHandler.postDelayed(new RetryRegistrationRunnable(provider),mOptions.getRetryPolice().getDelay(mRetryNumber));
      mRetryNumber++;
    }
 else {
      sListener.onRegistrationError(provider.getName(),result.getErrorCode());
      mRetryNumber=0;
      PushProvider nextProvider=getNextCandidate(provider);
      if (nextProvider != null) {
        nextProvider.register();
      }
 else {
        mInitStatus=INIT_ERROR;
        sListener.onNoAvailableProvider();
      }
    }
  }
}

Fixed version (ground truth):
private void onRegistrationResult(@NotNull final RegistrationResult result){
  final PushProvider provider=getProviderByName(result.getProviderName());
  Assert.assertNotNull(provider);
  if (result.isSuccess()) {
    mInitStatus=INIT_SUCCESS;
    mAppContext.getSharedPreferences(PREFERENCES,Context.MODE_PRIVATE).edit().putInt(KEY_INIT_STATUS,INIT_SUCCESS).apply();
    mRetryNumber=0;
    mCurrentProvider=provider;
    saveProvider(mCurrentProvider);
    sListener.onRegistered(result.getProviderName(),result.getRegistrationId());
  }
 else {
    if (result.isRecoverableError() && mOptions.getRetryPolice() != null && mRetryNumber < mOptions.getRetryPolice().tryCount()) {
      sHandler.postDelayed(new RetryRegistrationRunnable(provider),mOptions.getRetryPolice().getDelay(mRetryNumber));
      mRetryNumber++;
    }
 else {
      sListener.onRegistrationError(provider.getName(),result.getErrorCode());
      mRetryNumber=0;
      PushProvider nextProvider=getNextCandidate(provider);
      if (nextProvider != null) {
        nextProvider.register();
      }
 else {
        mInitStatus=INIT_ERROR;
        sListener.onNoAvailableProvider();
      }
    }
  }
}
Program: 168314
Project: 168314
Buggy source:
private void onError(@NotNull @MagicConstant(stringValues={GCMConstants.ERROR_AUTHEFICATION_FAILED,GCMConstants.ERROR_SERVICE_NOT_AVAILABLE}) String errorId){
  int error;
  if (errorId.equals(GCMConstants.ERROR_SERVICE_NOT_AVAILABLE)) {
    error=OpenPushConstants.ERROR_SERVICE_NOT_AVAILABLE;
  }
 else   if (errorId.equals(GCMConstants.ERROR_AUTHEFICATION_FAILED)) {
    error=OpenPushConstants.ERROR_AUTHEFICATION_FAILED;
  }
 else {
    error=OpenPushConstants.ERROR_UNKNOWN;
  }
  OpenPushHelper.notifyRegistrationEnd(new ProviderRegistrationResult(GCMProvider.NAME,error));
}

Fixed version (ground truth):
private void onError(@NotNull @MagicConstant(stringValues={GCMConstants.ERROR_AUTHEFICATION_FAILED,GCMConstants.ERROR_SERVICE_NOT_AVAILABLE}) String errorId){
  int error;
  if (errorId.equals(GCMConstants.ERROR_SERVICE_NOT_AVAILABLE)) {
    error=OpenPushConstants.ERROR_SERVICE_NOT_AVAILABLE;
  }
 else   if (errorId.equals(GCMConstants.ERROR_AUTHEFICATION_FAILED)) {
    error=OpenPushConstants.ERROR_AUTHEFICATION_FAILED;
  }
 else {
    error=OpenPushConstants.ERROR_UNKNOWN;
  }
  OpenPushHelper.notifyRegistrationEnd(new RegistrationResult(GCMProvider.NAME,error));
}
Program: 168315
Project: 168315
Buggy source:
private void onRegistered(String registrationToken){
  OpenPushHelper.notifyRegistrationEnd(new ProviderRegistrationResult(GCMProvider.NAME,registrationToken));
}

Fixed version (ground truth):
private void onRegistered(String registrationToken){
  OpenPushHelper.notifyRegistrationEnd(new RegistrationResult(GCMProvider.NAME,registrationToken));
}
Program: 168316
Project: 168316
Buggy source:
/** 
 * Called on a registration error that could be retried. By default, it does nothing and returns true, but could be overridden to change that behavior and/or display the error.
 * @param appContext Application's context.
 * @param errorId    Error id returned by the Push Notifications service.
 * @return If true, failed operation will be retried (using exponential backoff).
 */
@Override protected boolean onRecoverableError(@NotNull Context appContext,@NotNull @MagicConstant(stringValues={PushConstants.ERROR_INVALID_PARAMETERS,PushConstants.ERROR_INVALID_SENDER,PushConstants.ERROR_SERVICE_NOT_AVAILABLE}) String errorId){
  OpenPushHelper.notifyRegistrationEnd(new ProviderRegistrationResult(NokiaPushProvider.NAME,convertError(errorId),true));
  return false;
}

Fixed version (ground truth):
/** 
 * Called on a registration error that could be retried. By default, it does nothing and returns true, but could be overridden to change that behavior and/or display the error.
 * @param appContext Application's context.
 * @param errorId    Error id returned by the Push Notifications service.
 * @return If true, failed operation will be retried (using exponential backoff).
 */
@Override protected boolean onRecoverableError(@NotNull Context appContext,@NotNull @MagicConstant(stringValues={PushConstants.ERROR_INVALID_PARAMETERS,PushConstants.ERROR_INVALID_SENDER,PushConstants.ERROR_SERVICE_NOT_AVAILABLE}) String errorId){
  OpenPushHelper.notifyRegistrationEnd(new RegistrationResult(NokiaPushProvider.NAME,convertError(errorId),true));
  return false;
}
Program: 168317
Project: 168317
Buggy source:
/** 
 * Called on registration or unregistration error.
 * @param appContext Application's context.
 * @param errorId    Error id returned by the Push Notifications service.
 */
@Override protected void onError(@NotNull Context appContext,String errorId){
  OpenPushHelper.notifyRegistrationEnd(new ProviderRegistrationResult(NokiaPushProvider.NAME,convertError(errorId),false));
}

Fixed version (ground truth):
/** 
 * Called on registration or unregistration error.
 * @param appContext Application's context.
 * @param errorId    Error id returned by the Push Notifications service.
 */
@Override protected void onError(@NotNull Context appContext,String errorId){
  OpenPushHelper.notifyRegistrationEnd(new RegistrationResult(NokiaPushProvider.NAME,convertError(errorId),false));
}