nus-yam/ex-repair huggingface dataset:
Program: 13599
Project: 13599
Buggy source:
AbstractScanner(SettingsManager stgMgr,boolean shouldRestoreBeaconStates,Clock clk,FileManager fileManager,ServiceScheduler scheduler,HandlerManager handlerManager,BluetoothPlatform btPlatform){
  settingsManager=stgMgr;
  clock=clk;
  serviceScheduler=scheduler;
  scanning=false;
  runLoop=handlerManager.getScannerRunLoop(this);
  bluetoothPlatform=btPlatform;
  File beaconFile=shouldRestoreBeaconStates ? fileManager.getFile("String_Node_Str") : null;
  enteredBeacons=new BeaconMap(fileManager,beaconFile);
  waitTime=settingsManager.getBackgroundWaitTime();
  scanTime=settingsManager.getBackgroundScanTime();
  SensorbergSdk.getComponent().inject(this);
}

Fixed version (ground truth):
AbstractScanner(SettingsManager stgMgr,boolean shouldRestoreBeaconStates,Clock clk,FileManager fileManager,ServiceScheduler scheduler,HandlerManager handlerManager,BluetoothPlatform btPlatform){
  settingsManager=stgMgr;
  clock=clk;
  serviceScheduler=scheduler;
  scanning=false;
  runLoop=handlerManager.getScannerRunLoop(this);
  bluetoothPlatform=btPlatform;
  File beaconFile=shouldRestoreBeaconStates ? fileManager.getFile("String_Node_Str") : null;
  enteredBeacons=new BeaconMap(fileManager,beaconFile);
  waitTime=settingsManager.getBackgroundWaitTime();
  scanTime=settingsManager.getBackgroundScanTime();
  exitGraceTime=settingsManager.getExitBackgroundGraceMillis();
  if (exitGraceTime >= scanTime) {
    exitGraceTime=scanTime / 2;
  }
  SensorbergSdk.getComponent().inject(this);
}
Program: 13600
Project: 13600
Buggy source:
/** 
 * Sends a flag for indicating whether to show a permissions dialogue or not.
 * @param context
 * @param toShow
 */
private void shouldDisplayPermission(Context context,boolean toShow){
  Intent service=new Intent(context,SensorbergServiceMessage.class);
  service.putExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,SensorbergServiceMessage.MSG_LOCATION_SERVICES_IS_SET);
  service.putExtra(SensorbergServiceMessage.EXTRA_LOCATION_PERMISSION,toShow);
  context.startService(service);
}

Fixed version (ground truth):
/** 
 * Sends a flag for indicating whether to show a permissions dialogue or not.
 * @param context
 * @param toShow
 */
private void shouldDisplayPermission(Context context,boolean toShow){
  Intent service=new Intent(context,SensorbergService.class);
  service.putExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,SensorbergServiceMessage.MSG_LOCATION_SERVICES_IS_SET);
  service.putExtra(SensorbergServiceMessage.EXTRA_LOCATION_PERMISSION,toShow);
  context.startService(service);
}
Program: 13601
Project: 13601
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public int onStartCommand(Intent intent,int flags,int startId){
  Logger.log.logServiceState("String_Node_Str");
  if (!bluetoothPlatform.isBluetoothLowEnergySupported()) {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
  if (!platform.registerBroadcastReceiver()) {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
  SensorbergSdk.init(getBaseContext());
  if (intent == null) {
    return restartSensorbergService();
  }
 else {
    return handleIntent(intent);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public int onStartCommand(Intent intent,int flags,int startId){
  Logger.log.logServiceState("String_Node_Str");
  if (!bluetoothPlatform.isBluetoothLowEnergySupported()) {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
  if (!platform.registerBroadcastReceiver()) {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
  if (!new PermissionChecker(this).hasScanPermissionCheckAndroid6()) {
    logError("String_Node_Str");
    if (intent != null) {
      String apikey=intent.getStringExtra(SensorbergServiceMessage.EXTRA_API_KEY);
      if (apikey != null && !apikey.isEmpty()) {
        ResolverConfiguration configuration=new ResolverConfiguration();
        configuration.setApiToken(apikey);
        persistConfiguration(configuration);
      }
    }
    return stopSensorbergService();
  }
  SensorbergSdk.init(getBaseContext());
  if (intent == null) {
    return restartSensorbergService();
  }
 else {
    return handleIntent(intent);
  }
}
Program: 13602
Project: 13602
Buggy source:
/** 
 * Call this to let SDK know you've attempted to show the   {@link com.sensorberg.sdk.action.Action} to the user.This is for situations when you are not certain if user have seen the Action, like showing notification on the status bar.
 * @param actionUUID UUID of the {@link com.sensorberg.sdk.action.Action} that was attempted to be shown.
 * @param context Caller's context.
 */
public static void notifyActionShowAttempt(UUID actionUUID,Context context){
  Intent intent=SensorbergServiceIntents.getConversionIntent(context,actionUUID,ActionConversion.TYPE_IGNORED);
  context.startService(intent);
}

Fixed version (ground truth):
/** 
 * Call this to let SDK know you've attempted to show the   {@link com.sensorberg.sdk.action.Action} to the user.This is for situations when you are not certain if user have seen the Action, like showing notification on the status bar.
 * @param actionUUID UUID of the {@link com.sensorberg.sdk.action.Action} that was attempted to be shown.
 * @param context    Caller's context.
 */
public static void notifyActionShowAttempt(UUID actionUUID,Context context){
  Intent intent=SensorbergServiceIntents.getConversionIntent(context,actionUUID,ActionConversion.TYPE_IGNORED);
  context.startService(intent);
}
Program: 13603
Project: 13603
Buggy source:
/** 
 * Call this to let SDK know the user haven't seen and will not be able to see the   {@link com.sensorberg.sdk.action.Action} in future.This is for situations where e.g. the notification with action is dismissed by the user and you won't show this action to the user again. Calling this after  {@link #notifyActionSuccess(UUID,Context) notifyActionSuccess} has no effect.
 * @param actionUUID UUID of the {@link com.sensorberg.sdk.action.Action} that user haven't seen and will not see in the future.
 * @param context Caller's context.
 */
protected static void notifyActionRejected(UUID actionUUID,Context context){
}

Fixed version (ground truth):
/** 
 * Call this to let SDK know the user haven't seen and will not be able to see the   {@link com.sensorberg.sdk.action.Action} in future.This is for situations where e.g. the notification with action is dismissed by the user and you won't show this action to the user again. Calling this after  {@link #notifyActionSuccess(UUID,Context) notifyActionSuccess} has no effect.
 * @param actionUUID UUID of the {@link com.sensorberg.sdk.action.Action} that user haven't seen and will not see in the future.
 * @param context    Caller's context.
 */
protected static void notifyActionRejected(UUID actionUUID,Context context){
}
Program: 13604
Project: 13604
Buggy source:
public void changeAPIToken(String newApiToken){
  context.startService(SensorbergServiceIntents.getApiTokenIntent(context,newApiToken));
}

Fixed version (ground truth):
public void changeAPIToken(String newApiToken){
  if (TextUtils.isEmpty(newApiToken)) {
    context.startService(SensorbergServiceIntents.getApiTokenIntent(context,newApiToken));
  }
 else {
    Logger.log.logError("String_Node_Str");
  }
}
Program: 13605
Project: 13605
Buggy source:
/** 
 * Constructor to be used for starting the SDK.
 * @param ctx {@code Context} Context used for starting the service.
 * @param apiKey {@code String} Your API key that you can get from your Sensorberg dashboard.
 */
public SensorbergSdk(Context ctx,String apiKey){
  init(ctx);
  getComponent().inject(this);
  activateService(apiKey);
}

Fixed version (ground truth):
/** 
 * Constructor to be used for starting the SDK.
 * @param ctx    {@code Context} Context used for starting the service.
 * @param apiKey {@code String} Your API key that you can get from your Sensorberg dashboard.
 */
public SensorbergSdk(Context ctx,String apiKey){
  init(ctx);
  getComponent().inject(this);
  activateService(apiKey);
}
Program: 13606
Project: 13606
Buggy source:
/** 
 * Call this to let SDK know you've confirmed that user has seen the   {@link com.sensorberg.sdk.action.Action} and acted on it.This is for situation where e.g. user tapped the notification and was redirected to website.
 * @param actionUUID UUID of the {@link com.sensorberg.sdk.action.Action} that user has seen and acted on.
 * @param context Caller's context.
 */
public static void notifyActionSuccess(UUID actionUUID,Context context){
  Intent intent=SensorbergServiceIntents.getConversionIntent(context,actionUUID,ActionConversion.TYPE_SUCCESS);
  context.startService(intent);
}

Fixed version (ground truth):
/** 
 * Call this to let SDK know you've confirmed that user has seen the   {@link com.sensorberg.sdk.action.Action} and acted on it.This is for situation where e.g. user tapped the notification and was redirected to website.
 * @param actionUUID UUID of the {@link com.sensorberg.sdk.action.Action} that user has seen and acted on.
 * @param context    Caller's context.
 */
public static void notifyActionSuccess(UUID actionUUID,Context context){
  Intent intent=SensorbergServiceIntents.getConversionIntent(context,actionUUID,ActionConversion.TYPE_SUCCESS);
  context.startService(intent);
}
Program: 13607
Project: 13607
Buggy source:
public void setApiToken(String apiToken){
  transport.setApiToken(apiToken);
  beaconActionHistoryPublisher.publishHistory();
  if (resolver.configuration.setApiToken(apiToken)) {
    unscheduleAllPendingActions();
    beaconActionHistoryPublisher.deleteAllObjects();
  }
}

Fixed version (ground truth):
public void setApiToken(String apiToken){
  if (resolver.configuration.setApiToken(apiToken)) {
    Logger.log.applicationStateChanged("String_Node_Str");
    scanner.stop();
    unscheduleAllPendingActions();
    beaconActionHistoryPublisher.deleteAllObjects();
    transport.setApiToken(apiToken);
    updateSettings();
    updateBeaconLayout();
    scanner.clearCache();
    scanner.start();
  }
}
Program: 13608
Project: 13608
Buggy source:
@SuppressWarnings("String_Node_Str") public static List<BroadcastReceiver> findBroadcastReceiver(Context context){
  List<BroadcastReceiver> result=new ArrayList<>();
  List<ResolveInfo> infos=context.getPackageManager().queryBroadcastReceivers(actionIntent,PackageManager.SIGNATURE_MATCH);
  for (  ResolveInfo resolveInfo : infos) {
    try {
      if (!resolveInfo.activityInfo.processName.endsWith("String_Node_Str")) {
        continue;
      }
      BroadcastReceiver broadcastReceiver=(BroadcastReceiver)Class.forName(resolveInfo.activityInfo.name).newInstance();
      result.add(broadcastReceiver);
    }
 catch (    Exception e) {
      Logger.log.logError("String_Node_Str",e);
    }
  }
  return result;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static List<BroadcastReceiver> findBroadcastReceiver(Context context){
  List<BroadcastReceiver> result=new ArrayList<>();
  Intent actionIntent=new Intent();
  actionIntent.setPackage(context.getPackageName());
  actionIntent.setAction(actionString);
  List<ResolveInfo> infos=context.getPackageManager().queryBroadcastReceivers(actionIntent,0);
  for (  ResolveInfo resolveInfo : infos) {
    try {
      if (!resolveInfo.activityInfo.processName.endsWith("String_Node_Str")) {
        continue;
      }
      if (!resolveInfo.activityInfo.packageName.equals(context.getPackageName())) {
        continue;
      }
      BroadcastReceiver broadcastReceiver=(BroadcastReceiver)Class.forName(resolveInfo.activityInfo.name).newInstance();
      result.add(broadcastReceiver);
    }
 catch (    Exception e) {
      Logger.log.logError("String_Node_Str",e);
    }
  }
  return result;
}
Program: 13609
Project: 13609
Buggy source:
@Override public int compare(Location t1,Location t2){
  if (t1.getTime() > t2.getTime()) {
    return 1;
  }
  if (t2.getTime() > t1.getTime()) {
    return -1;
  }
  return 0;
}

Fixed version (ground truth):
@Override public int compare(Location t1,Location t2){
  if (t1.getTime() > t2.getTime()) {
    return -1;
  }
  if (t2.getTime() > t1.getTime()) {
    return 1;
  }
  return 0;
}
Program: 13610
Project: 13610
Buggy source:
@Test public void should_handle_intent_with_generic_noop_message(){
  Intent sensorbergServiceStartIntent=new Intent(InstrumentationRegistry.getContext(),SensorbergService.class);
  sensorbergServiceStartIntent.putExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1);
  int handleIntentResult=tested.handleIntent(sensorbergServiceStartIntent);
  Assertions.assertThat(handleIntentResult).isEqualTo(SensorbergService.START_STICKY);
  Assertions.assertThat(tested.bootstrapper).isNotNull();
  Mockito.verify(tested,Mockito.times(1)).handleDebuggingIntent(sensorbergServiceStartIntent,tested,true);
  Mockito.verify(tested,Mockito.times(1)).handleIntentEvenIfNoBootstrapperPresent(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).updateDiskConfiguration(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).handleIntentMessage(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(0)).startSensorbergService(anyString());
  Mockito.verify(tested,Mockito.times(0)).stopSensorbergService();
}

Fixed version (ground truth):
@Test public void should_handle_intent_with_generic_noop_message(){
  Intent sensorbergServiceStartIntent=new Intent(InstrumentationRegistry.getContext(),SensorbergService.class);
  sensorbergServiceStartIntent.putExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1);
  int handleIntentResult=tested.handleIntent(sensorbergServiceStartIntent);
  Assertions.assertThat(handleIntentResult).isEqualTo(SensorbergService.START_STICKY);
  Assertions.assertThat(tested.bootstrapper).isNotNull();
  Mockito.verify(tested,Mockito.times(1)).handleDebuggingIntent(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).handleIntentEvenIfNoBootstrapperPresent(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).updateDiskConfiguration(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).handleIntentMessage(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(0)).startSensorbergService(anyString());
  Mockito.verify(tested,Mockito.times(0)).stopSensorbergService();
}
Program: 13611
Project: 13611
Buggy source:
@Test public void should_handle_empty_intent(){
  Intent sensorbergServiceStartIntent=new Intent(InstrumentationRegistry.getContext(),SensorbergService.class);
  int handleIntentResult=tested.handleIntent(sensorbergServiceStartIntent);
  Assertions.assertThat(handleIntentResult).isEqualTo(SensorbergService.START_STICKY);
  Assertions.assertThat(tested.bootstrapper).isNull();
  Mockito.verify(tested,Mockito.times(1)).handleDebuggingIntent(sensorbergServiceStartIntent,tested,true);
  Mockito.verify(tested,Mockito.times(1)).handleIntentEvenIfNoBootstrapperPresent(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).updateDiskConfiguration(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(0)).startSensorbergService(anyString());
  Mockito.verify(tested,Mockito.times(0)).stopSensorbergService();
  Mockito.verify(tested,Mockito.times(0)).handleIntentMessage(sensorbergServiceStartIntent);
}

Fixed version (ground truth):
@Test public void should_handle_empty_intent(){
  Intent sensorbergServiceStartIntent=new Intent(InstrumentationRegistry.getContext(),SensorbergService.class);
  int handleIntentResult=tested.handleIntent(sensorbergServiceStartIntent);
  Assertions.assertThat(handleIntentResult).isEqualTo(SensorbergService.START_STICKY);
  Assertions.assertThat(tested.bootstrapper).isNull();
  Mockito.verify(tested,Mockito.times(1)).handleDebuggingIntent(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).handleIntentEvenIfNoBootstrapperPresent(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).updateDiskConfiguration(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(0)).startSensorbergService(anyString());
  Mockito.verify(tested,Mockito.times(0)).stopSensorbergService();
  Mockito.verify(tested,Mockito.times(0)).handleIntentMessage(sensorbergServiceStartIntent);
}
Program: 13612
Project: 13612
Buggy source:
@Test public void should_handle_intent_with_shutdown_message(){
  Intent sensorbergServiceShutdownIntent=SensorbergServiceIntents.getShutdownServiceIntent(InstrumentationRegistry.getContext());
  int handleIntentResult=tested.handleIntent(sensorbergServiceShutdownIntent);
  Assertions.assertThat(handleIntentResult).isEqualTo(SensorbergService.START_NOT_STICKY);
  Mockito.verify(tested,Mockito.times(1)).handleDebuggingIntent(sensorbergServiceShutdownIntent,tested,true);
  Mockito.verify(tested,Mockito.times(1)).handleIntentEvenIfNoBootstrapperPresent(sensorbergServiceShutdownIntent);
  Mockito.verify(tested,Mockito.times(1)).stopSensorbergService();
  Mockito.verify(tested,Mockito.times(0)).updateDiskConfiguration(sensorbergServiceShutdownIntent);
  Mockito.verify(tested,Mockito.times(0)).startSensorbergService(anyString());
  Mockito.verify(tested,Mockito.times(0)).handleIntentMessage(sensorbergServiceShutdownIntent);
}

Fixed version (ground truth):
@Test public void should_handle_intent_with_shutdown_message(){
  Intent sensorbergServiceShutdownIntent=SensorbergServiceIntents.getShutdownServiceIntent(InstrumentationRegistry.getContext());
  int handleIntentResult=tested.handleIntent(sensorbergServiceShutdownIntent);
  Assertions.assertThat(handleIntentResult).isEqualTo(SensorbergService.START_NOT_STICKY);
  Mockito.verify(tested,Mockito.times(1)).handleDebuggingIntent(sensorbergServiceShutdownIntent);
  Mockito.verify(tested,Mockito.times(1)).handleIntentEvenIfNoBootstrapperPresent(sensorbergServiceShutdownIntent);
  Mockito.verify(tested,Mockito.times(1)).stopSensorbergService();
  Mockito.verify(tested,Mockito.times(0)).updateDiskConfiguration(sensorbergServiceShutdownIntent);
  Mockito.verify(tested,Mockito.times(0)).startSensorbergService(anyString());
  Mockito.verify(tested,Mockito.times(0)).handleIntentMessage(sensorbergServiceShutdownIntent);
}
Program: 13613
Project: 13613
Buggy source:
@Test public void should_handle_intent_with_start_message_and_api_key(){
  Intent sensorbergServiceStartIntent=SensorbergServiceIntents.getStartServiceIntent(InstrumentationRegistry.getContext(),TestConstants.API_TOKEN_DEFAULT);
  int handleIntentResult=tested.handleIntent(sensorbergServiceStartIntent);
  Assertions.assertThat(handleIntentResult).isEqualTo(SensorbergService.START_STICKY);
  Mockito.verify(tested,Mockito.times(1)).handleDebuggingIntent(sensorbergServiceStartIntent,tested,true);
  Mockito.verify(tested,Mockito.times(1)).handleIntentEvenIfNoBootstrapperPresent(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).updateDiskConfiguration(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).startSensorbergService(TestConstants.API_TOKEN_DEFAULT);
  Mockito.verify(tested,Mockito.times(0)).stopSensorbergService();
  Mockito.verify(tested,Mockito.times(0)).handleIntentMessage(sensorbergServiceStartIntent);
}

Fixed version (ground truth):
@Test public void should_handle_intent_with_start_message_and_api_key(){
  Intent sensorbergServiceStartIntent=SensorbergServiceIntents.getStartServiceIntent(InstrumentationRegistry.getContext(),TestConstants.API_TOKEN_DEFAULT);
  int handleIntentResult=tested.handleIntent(sensorbergServiceStartIntent);
  Assertions.assertThat(handleIntentResult).isEqualTo(SensorbergService.START_STICKY);
  Mockito.verify(tested,Mockito.times(1)).handleDebuggingIntent(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).handleIntentEvenIfNoBootstrapperPresent(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).updateDiskConfiguration(sensorbergServiceStartIntent);
  Mockito.verify(tested,Mockito.times(1)).startSensorbergService(TestConstants.API_TOKEN_DEFAULT);
  Mockito.verify(tested,Mockito.times(0)).stopSensorbergService();
  Mockito.verify(tested,Mockito.times(0)).handleIntentMessage(sensorbergServiceStartIntent);
}
Program: 13614
Project: 13614
Buggy source:
@Test public void should_turn_debugging_off_in_transport_from_intent(){
  Intent serviceDebuggingOffIntent=SensorbergServiceIntents.getServiceLoggingIntent(InstrumentationRegistry.getContext(),false);
  tested.handleDebuggingIntent(serviceDebuggingOffIntent,InstrumentationRegistry.getContext(),false);
  Mockito.verify(tested.transport,times(1)).setLoggingEnabled(false);
  Assertions.assertThat(Logger.log).isEqualTo(Logger.QUIET_LOG);
}

Fixed version (ground truth):
@Test public void should_turn_debugging_off_in_transport_from_intent(){
  Intent serviceDebuggingOffIntent=SensorbergServiceIntents.getServiceLoggingIntent(InstrumentationRegistry.getContext(),false);
  tested.handleDebuggingIntent(serviceDebuggingOffIntent);
  Mockito.verify(tested.transport,times(1)).setLoggingEnabled(false);
  Assertions.assertThat(Logger.log).isEqualTo(Logger.QUIET_LOG);
}
Program: 13615
Project: 13615
Buggy source:
@Test public void should_turn_debugging_on_in_transport_from_intent(){
  Intent serviceDebuggingOnIntent=SensorbergServiceIntents.getServiceLoggingIntent(InstrumentationRegistry.getContext(),true);
  tested.handleDebuggingIntent(serviceDebuggingOnIntent,InstrumentationRegistry.getContext(),false);
  Mockito.verify(tested.transport,times(1)).setLoggingEnabled(true);
  Assertions.assertThat(Logger.log).isInstanceOf(Logger.VerboseLogger.class);
}

Fixed version (ground truth):
@Test public void should_turn_debugging_on_in_transport_from_intent(){
  Intent serviceDebuggingOnIntent=SensorbergServiceIntents.getServiceLoggingIntent(InstrumentationRegistry.getContext(),true);
  tested.handleDebuggingIntent(serviceDebuggingOnIntent);
  Mockito.verify(tested.transport,times(1)).setLoggingEnabled(true);
  Assertions.assertThat(Logger.log).isInstanceOf(Logger.VerboseLogger.class);
}
Program: 13616
Project: 13616
Buggy source:
public void setLogging(boolean enableLogging){
  context.startService(SensorbergServiceIntents.getServiceLoggingIntent(context,enableLogging));
}

Fixed version (ground truth):
/** 
 * To set the logging and whether to show a message notifying the user logging is enabled or not.
 * @param enableLogging - true|false if to enable logging or not.
 */
public void setLogging(boolean enableLogging){
  context.startService(SensorbergServiceIntents.getServiceLoggingIntent(context,enableLogging));
}
Program: 13617
Project: 13617
Buggy source:
protected int handleIntent(Intent intent){
  Logger.log.serviceHandlesMessage(SensorbergServiceMessage.stringFrom(intent.getIntExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1)));
  handleDebuggingIntent(intent,this,true);
  if (handleIntentEvenIfNoBootstrapperPresent(intent)) {
    return stopSensorbergService();
  }
  if (bootstrapper == null) {
    updateDiskConfiguration(intent);
  }
  if (intent.hasExtra(SensorbergServiceMessage.EXTRA_START_SERVICE)) {
    return startSensorbergService(intent.getStringExtra(SensorbergServiceMessage.EXTRA_API_KEY));
  }
  if (intent.hasExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE)) {
    return handleIntentMessage(intent);
  }
  return START_STICKY;
}

Fixed version (ground truth):
protected int handleIntent(Intent intent){
  Logger.log.serviceHandlesMessage(SensorbergServiceMessage.stringFrom(intent.getIntExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1)));
  handleDebuggingIntent(intent);
  if (handleIntentEvenIfNoBootstrapperPresent(intent)) {
    return stopSensorbergService();
  }
  if (bootstrapper == null) {
    updateDiskConfiguration(intent);
  }
  if (intent.hasExtra(SensorbergServiceMessage.EXTRA_START_SERVICE)) {
    return startSensorbergService(intent.getStringExtra(SensorbergServiceMessage.EXTRA_API_KEY));
  }
  if (intent.hasExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE)) {
    return handleIntentMessage(intent);
  }
  return START_STICKY;
}
Program: 13618
Project: 13618
Buggy source:
protected void handleDebuggingIntent(Intent intent,Context context,boolean showMessage){
switch (intent.getIntExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1)) {
case SensorbergServiceMessage.MSG_TYPE_DISABLE_LOGGING:
{
      Logger.log=Logger.QUIET_LOG;
      transport.setLoggingEnabled(false);
      if (showMessage) {
        Toast.makeText(context,"String_Node_Str" + context.getPackageName(),Toast.LENGTH_SHORT).show();
      }
      break;
    }
case SensorbergServiceMessage.MSG_TYPE_ENABLE_LOGGING:
{
    Logger.enableVerboseLogging();
    transport.setLoggingEnabled(true);
    if (showMessage) {
      Toast.makeText(context,"String_Node_Str" + context.getPackageName(),Toast.LENGTH_SHORT).show();
    }
    break;
  }
}
}

Fixed version (ground truth):
protected void handleDebuggingIntent(Intent intent){
switch (intent.getIntExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1)) {
case SensorbergServiceMessage.MSG_TYPE_DISABLE_LOGGING:
{
      Logger.log.verbose("String_Node_Str");
      Logger.log=Logger.QUIET_LOG;
      transport.setLoggingEnabled(false);
      break;
    }
case SensorbergServiceMessage.MSG_TYPE_ENABLE_LOGGING:
{
    Logger.log.verbose("String_Node_Str");
    Logger.enableVerboseLogging();
    transport.setLoggingEnabled(true);
    break;
  }
}
}
Program: 13619
Project: 13619
Buggy source:
@Override public void onActivityResumed(Activity activity){
  handler.removeCallbacksAndMessages(null);
  this.isInForeground=true;
  handler.postDelayed(FOREGROUND,500);
}

Fixed version (ground truth):
@Override public void onActivityResumed(Activity activity){
  handler.removeCallbacksAndMessages(null);
  this.isInForeground=true;
  handler.postDelayed(FOREGROUND,500);
  if (!hasPermission && permissionChecker.hasScanPermissionCheckAndroid6()) {
    hasPermission=true;
    activity.startService(SensorbergServiceIntents.getPingIntent(activity));
  }
}
Program: 13620
Project: 13620
Buggy source:
@Override public void onActivityCreated(Activity activity,Bundle savedInstanceState){
}

Fixed version (ground truth):
@Override public void onActivityCreated(Activity activity,Bundle savedInstanceState){
  if (permissionChecker == null) {
    permissionChecker=new PermissionChecker(activity.getApplicationContext());
    hasPermission=permissionChecker.hasScanPermissionCheckAndroid6();
  }
}
Program: 13621
Project: 13621
Buggy source:
private boolean checkForPermission(String permissionIdentifier){
  if (permissionCache.get(permissionIdentifier) != null) {
    return permissionCache.get(permissionIdentifier);
  }
  int res=context.checkCallingOrSelfPermission(permissionIdentifier);
  boolean value=(res == PackageManager.PERMISSION_GRANTED);
  permissionCache.put(permissionIdentifier,value);
  return value;
}

Fixed version (ground truth):
private boolean checkForPermission(String permissionIdentifier){
  return context.checkCallingOrSelfPermission(permissionIdentifier) == PackageManager.PERMISSION_GRANTED;
}
Program: 13622
Project: 13622
Buggy source:
@Override public void onActivityResumed(Activity activity){
  handler.removeCallbacksAndMessages(null);
  this.isInForeground=true;
  handler.postDelayed(FOREGROUND,500);
}

Fixed version (ground truth):
@Override public void onActivityResumed(Activity activity){
  handler.removeCallbacksAndMessages(null);
  this.isInForeground=true;
  handler.postDelayed(FOREGROUND,500);
  if (!hasPermission && permissionChecker.hasScanPermissionCheckAndroid6()) {
    hasPermission=true;
    activity.startService(SensorbergServiceIntents.getPingIntent(activity));
  }
}
Program: 13623
Project: 13623
Buggy source:
@Override public void onActivityCreated(Activity activity,Bundle savedInstanceState){
}

Fixed version (ground truth):
@Override public void onActivityCreated(Activity activity,Bundle savedInstanceState){
  if (permissionChecker == null) {
    permissionChecker=new PermissionChecker(activity.getApplicationContext());
    hasPermission=permissionChecker.hasScanPermissionCheckAndroid6();
  }
}
Program: 13624
Project: 13624
Buggy source:
private boolean checkForPermission(String permissionIdentifier){
  if (permissionCache.get(permissionIdentifier) != null) {
    return permissionCache.get(permissionIdentifier);
  }
  int res=context.checkCallingOrSelfPermission(permissionIdentifier);
  boolean value=(res == PackageManager.PERMISSION_GRANTED);
  permissionCache.put(permissionIdentifier,value);
  return value;
}

Fixed version (ground truth):
private boolean checkForPermission(String permissionIdentifier){
  return context.checkCallingOrSelfPermission(permissionIdentifier) == PackageManager.PERMISSION_GRANTED;
}
Program: 13625
Project: 13625
Buggy source:
protected int startSensorbergService(String apiKey){
  if (bootstrapper == null && (!TextUtils.isEmpty(apiKey))) {
    bootstrapper=createBootstrapper(apiKey);
    persistConfiguration(bootstrapper.resolver.configuration);
    bootstrapper.startScanning();
    return START_STICKY;
  }
 else   if (bootstrapper != null) {
    bootstrapper.startScanning();
    logError("String_Node_Str");
    return START_STICKY;
  }
 else {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
}

Fixed version (ground truth):
protected int startSensorbergService(String apiKey){
  if (bootstrapper == null && (!TextUtils.isEmpty(apiKey))) {
    ResolverConfiguration configuration=new ResolverConfiguration();
    configuration.setApiToken(apiKey);
    bootstrapper=createBootstrapper(configuration);
    persistConfiguration(bootstrapper.resolver.configuration);
    bootstrapper.startScanning();
    return START_STICKY;
  }
 else   if (bootstrapper != null) {
    bootstrapper.startScanning();
    logError("String_Node_Str");
    return START_STICKY;
  }
 else {
    logError("String_Node_Str");
    return stopSensorbergService();
  }
}
Program: 13626
Project: 13626
Buggy source:
public void setLogging(boolean enableLogging){
  context.startService(SensorbergServiceIntents.getServiceLoggingIntent(context,enableLogging));
}

Fixed version (ground truth):
/** 
 * To set the logging and whether to show a message notifying the user logging is enabled or not.
 * @param enableLogging - true|false if to enable logging or not.
 * @param showMessage - true|false if to show a message to display the message.
 */
public void setLogging(boolean enableLogging,boolean showMessage){
  context.startService(SensorbergServiceIntents.getServiceLoggingIntent(context,enableLogging,showMessage));
}
Program: 13627
Project: 13627
Buggy source:
protected int handleIntent(Intent intent){
  Logger.log.serviceHandlesMessage(SensorbergServiceMessage.stringFrom(intent.getIntExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1)));
  handleDebuggingIntent(intent,this,true);
  if (handleIntentEvenIfNoBootstrapperPresent(intent)) {
    return stopSensorbergService();
  }
  if (bootstrapper == null) {
    updateDiskConfiguration(intent);
  }
  if (intent.hasExtra(SensorbergServiceMessage.EXTRA_START_SERVICE)) {
    return startSensorbergService(intent.getStringExtra(SensorbergServiceMessage.EXTRA_API_KEY));
  }
  if (intent.hasExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE)) {
    return handleIntentMessage(intent);
  }
  return START_STICKY;
}

Fixed version (ground truth):
protected int handleIntent(Intent intent){
  Logger.log.serviceHandlesMessage(SensorbergServiceMessage.stringFrom(intent.getIntExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1)));
  handleDebuggingIntent(intent,this);
  if (handleIntentEvenIfNoBootstrapperPresent(intent)) {
    return stopSensorbergService();
  }
  if (bootstrapper == null) {
    updateDiskConfiguration(intent);
  }
  if (intent.hasExtra(SensorbergServiceMessage.EXTRA_START_SERVICE)) {
    return startSensorbergService(intent.getStringExtra(SensorbergServiceMessage.EXTRA_API_KEY));
  }
  if (intent.hasExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE)) {
    return handleIntentMessage(intent);
  }
  return START_STICKY;
}
Program: 13628
Project: 13628
Buggy source:
protected void handleDebuggingIntent(Intent intent,Context context,boolean showMessage){
switch (intent.getIntExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1)) {
case SensorbergServiceMessage.MSG_TYPE_DISABLE_LOGGING:
{
      Logger.log=Logger.QUIET_LOG;
      transport.setLoggingEnabled(false);
      if (showMessage) {
        Toast.makeText(context,"String_Node_Str" + context.getPackageName(),Toast.LENGTH_SHORT).show();
      }
      break;
    }
case SensorbergServiceMessage.MSG_TYPE_ENABLE_LOGGING:
{
    Logger.enableVerboseLogging();
    transport.setLoggingEnabled(true);
    if (showMessage) {
      Toast.makeText(context,"String_Node_Str" + context.getPackageName(),Toast.LENGTH_SHORT).show();
    }
    break;
  }
}
}

Fixed version (ground truth):
protected void handleDebuggingIntent(Intent intent,Context context){
switch (intent.getIntExtra(SensorbergServiceMessage.EXTRA_GENERIC_TYPE,-1)) {
case SensorbergServiceMessage.MSG_TYPE_DISABLE_LOGGING:
{
      Logger.log=Logger.QUIET_LOG;
      transport.setLoggingEnabled(false);
      if (intent.getBooleanExtra(SensorbergServiceMessage.EXTRA_SHOW_MESSAGE,false)) {
        Toast.makeText(context,"String_Node_Str" + context.getPackageName(),Toast.LENGTH_SHORT).show();
      }
      break;
    }
case SensorbergServiceMessage.MSG_TYPE_ENABLE_LOGGING:
{
    Logger.enableVerboseLogging();
    transport.setLoggingEnabled(true);
    if (intent.getBooleanExtra(SensorbergServiceMessage.EXTRA_SHOW_MESSAGE,true)) {
      Toast.makeText(context,"String_Node_Str" + context.getPackageName(),Toast.LENGTH_SHORT).show();
    }
    break;
  }
}
}
Program: 13629
Project: 13629
Buggy source:
public static Intent getServiceLoggingIntent(Context ctx,boolean enableLogging){
  int message=enableLogging ? SensorbergServiceMessage.MSG_TYPE_ENABLE_LOGGING : SensorbergServiceMessage.MSG_TYPE_DISABLE_LOGGING;
  return getServiceIntentWithMessage(ctx,message);
}

Fixed version (ground truth):
public static Intent getServiceLoggingIntent(Context ctx,boolean enableLogging,boolean showMessage){
  int message=enableLogging ? SensorbergServiceMessage.MSG_TYPE_ENABLE_LOGGING : SensorbergServiceMessage.MSG_TYPE_DISABLE_LOGGING;
  return getServiceIntentLoggingMessage(ctx,message,showMessage);
}
Program: 13630
Project: 13630
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  Intent loggingIntent=new Intent(context,SensorbergService.class);
  if (intent.getData().getAuthority().endsWith("String_Node_Str")) {
    loggingIntent=SensorbergServiceIntents.getServiceLoggingIntent(context,true);
  }
 else   if (intent.getData().getAuthority().endsWith("String_Node_Str")) {
    loggingIntent=SensorbergServiceIntents.getServiceLoggingIntent(context,false);
  }
  context.startService(loggingIntent);
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  Intent loggingIntent=new Intent(context,SensorbergService.class);
  if (intent.getData().getAuthority().endsWith("String_Node_Str")) {
    loggingIntent=SensorbergServiceIntents.getServiceLoggingIntent(context,true,true);
  }
 else   if (intent.getData().getAuthority().endsWith("String_Node_Str")) {
    loggingIntent=SensorbergServiceIntents.getServiceLoggingIntent(context,false,true);
  }
  context.startService(loggingIntent);
}
Program: 13632
Project: 13632
Buggy source:
@Provides @Named("String_Node_Str") @Singleton public BluetoothPlatform provideAndroidBluetoothPlatform(BluetoothAdapter adapter,CrashCallBackWrapper wrapper,Context context){
  return new AndroidBluetoothPlatform(adapter,wrapper,context);
}

Fixed version (ground truth):
@Provides @Named("String_Node_Str") @Singleton public BluetoothPlatform provideAndroidBluetoothPlatform(BluetoothAdapter adapter,Context context){
  return new AndroidBluetoothPlatform(adapter,context);
}
Program: 13633
Project: 13633
Buggy source:
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public AndroidBluetoothPlatform(BluetoothAdapter adapter,CrashCallBackWrapper wrapper,Context ctx){
  context=ctx;
  crashCallBackWrapper=wrapper;
  bluetoothAdapter=adapter;
  permissionChecker=new PermissionChecker(ctx);
}

Fixed version (ground truth):
public AndroidBluetoothPlatform(BluetoothAdapter adapter,Context ctx){
  context=ctx;
  bluetoothAdapter=adapter;
  permissionChecker=new PermissionChecker(ctx);
  if (Build.VERSION.SDK_INT >= 18) {
    crashCallBackWrapper=new CrashCallBackWrapper(ctx);
  }
 else {
    crashCallBackWrapper=null;
  }
}
Program: 13634
Project: 13634
Buggy source:
/** 
 * Returns a flag indicating whether Bluetooth is supported.
 * @return a flag indicating whether Bluetooth is supported
 */
@Override public boolean isBluetoothLowEnergySupported(){
  return bluetoothAdapter != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE);
}

Fixed version (ground truth):
/** 
 * Returns a flag indicating whether Bluetooth is supported.
 * @return a flag indicating whether Bluetooth is supported
 */
@Override public boolean isBluetoothLowEnergySupported(){
  return bluetoothAdapter != null && crashCallBackWrapper != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE);
}
Program: 13635
Project: 13635
Buggy source:
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) @Override public void startLeScan(BluetoothAdapter.LeScanCallback scanCallback){
  if (isBluetoothLowEnergySupported()) {
    if (bluetoothAdapter.getState() == BluetoothAdapter.STATE_ON && permissionChecker.hasScanPermissionCheckAndroid6()) {
      Log.i("String_Node_Str",Integer.toString(bluetoothAdapter.getState()));
      bluetoothAdapter.startLeScan(crashCallBackWrapper);
      crashCallBackWrapper.setCallback(scanCallback);
      leScanRunning=true;
    }
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) @Override public void startLeScan(BluetoothAdapter.LeScanCallback scanCallback){
  if (isBluetoothLowEnergySupported() && crashCallBackWrapper != null) {
    if (bluetoothAdapter.getState() == BluetoothAdapter.STATE_ON && permissionChecker.hasScanPermissionCheckAndroid6()) {
      Log.i("String_Node_Str",Integer.toString(bluetoothAdapter.getState()));
      bluetoothAdapter.startLeScan(crashCallBackWrapper);
      crashCallBackWrapper.setCallback(scanCallback);
      leScanRunning=true;
    }
  }
}
Program: 13636
Project: 13636
Buggy source:
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) @Override public void stopLeScan(){
  if (isBluetoothLowEnergySupported()) {
    try {
      bluetoothAdapter.stopLeScan(crashCallBackWrapper);
    }
 catch (    NullPointerException sentBySysteminternally) {
      Logger.log.logError("String_Node_Str",sentBySysteminternally);
    }
 finally {
      leScanRunning=false;
      crashCallBackWrapper.setCallback(null);
    }
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) @Override public void stopLeScan(){
  if (isBluetoothLowEnergySupported() && crashCallBackWrapper != null) {
    try {
      bluetoothAdapter.stopLeScan(crashCallBackWrapper);
    }
 catch (    NullPointerException sentBySysteminternally) {
      Logger.log.logError("String_Node_Str",sentBySysteminternally);
    }
 finally {
      leScanRunning=false;
      crashCallBackWrapper.setCallback(null);
    }
  }
}
Program: 13637
Project: 13637
Buggy source:
@Test public void should_parse_action_type_url_message(){
  try {
    JsonObject URI_JSON_OBJECT=Utils.getRawResourceAsJSON(com.sensorberg.sdk.test.R.raw.action_factory_001,InstrumentationRegistry.getContext());
    Action result=ActionFactory.actionFromJSONObject(URI_JSON_OBJECT);
    Assertions.assertThat(result).isNotNull();
    Assertions.assertThat(result).isInstanceOf(UriMessageAction.class);
    Assertions.assertThat(((UriMessageAction)result).getContent()).isNotEmpty();
    Assertions.assertThat(((UriMessageAction)result).getTitle()).isNotEmpty();
    Assertions.assertThat(((UriMessageAction)result).getUri()).isNotEmpty();
  }
 catch (  Exception e) {
    Assertions.fail(e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void should_parse_action_type_url_message(){
  try {
    JsonObject URI_JSON_OBJECT=Utils.getRawResourceAsJSON(com.sensorberg.sdk.test.R.raw.action_factory_001,InstrumentationRegistry.getContext());
    Action result=ActionFactory.actionFromJSONObject(URI_JSON_OBJECT);
    Assertions.assertThat(result).isNotNull();
    Assertions.assertThat(result).isInstanceOf(UriMessageAction.class);
    Assertions.assertThat(((UriMessageAction)result).getContent()).isNotEmpty();
    Assertions.assertThat(((UriMessageAction)result).getTitle()).isNotEmpty();
    Assertions.assertThat(((UriMessageAction)result).getUri()).isEmpty();
  }
 catch (  Exception e) {
    Assertions.fail(e.getMessage());
  }
}
Program: 13638
Project: 13638
Buggy source:
@Before public void setUp() throws Exception {
  ((TestComponent)SensorbergTestApplication.getComponent()).inject(this);
  Transport testTransportWithMockService=new RetrofitApiTransport(mockRetrofitApiService,clock);
  tested=new BeaconActionHistoryPublisher(InstrumentationRegistry.getContext(),testTransportWithMockService,testSettingsManager,clock,testHandlerManager,sharedPreferences,gson);
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  ((TestComponent)SensorbergTestApplication.getComponent()).inject(this);
  testTransportWithMockService=new RetrofitApiTransport(mockRetrofitApiService,clock);
  tested=new BeaconActionHistoryPublisher(InstrumentationRegistry.getContext(),testTransportWithMockService,testSettingsManager,clock,testHandlerManager,sharedPreferences,gson);
}
Program: 13639
Project: 13639
Buggy source:
public void saveAllData(){
  if (beaconActions.size() > 0) {
    deleteSavedBeaconActions();
    String actionsJson=gson.toJson(beaconActions);
    sharedPreferences.edit().putString(BeaconAction.SHARED_PREFS_TAG,actionsJson).apply();
    beaconActions=Collections.synchronizedSet(new HashSet<BeaconAction>());
  }
  if (beaconScans.size() > 0) {
    deleteSavedBeaconScans();
    String actionsJson=gson.toJson(beaconScans);
    sharedPreferences.edit().putString(BeaconScan.SHARED_PREFS_TAG,actionsJson).apply();
    beaconScans=Collections.synchronizedSet(new HashSet<BeaconScan>());
  }
}

Fixed version (ground truth):
public void saveAllData(){
  if (beaconActions.size() > 0) {
    deleteSavedBeaconActions();
    String actionsJson=gson.toJson(beaconActions);
    sharedPreferences.edit().putString(BeaconAction.SHARED_PREFS_TAG,actionsJson).apply();
    beaconActions=Collections.synchronizedSet(new HashSet<BeaconAction>());
  }
  if (beaconScans.size() > 0) {
    deleteSavedBeaconScans();
    String scansJson=gson.toJson(beaconScans);
    sharedPreferences.edit().putString(BeaconScan.SHARED_PREFS_TAG,scansJson).apply();
    beaconScans=Collections.synchronizedSet(new HashSet<BeaconScan>());
  }
}
Program: 13640
Project: 13640
Buggy source:
private void loadAllData(){
  String actionJson=sharedPreferences.getString(BeaconAction.SHARED_PREFS_TAG,"String_Node_Str");
  if (!actionJson.isEmpty()) {
    Type listType=new TypeToken<Set<BeaconAction>>(){
    }
.getType();
synchronized (beaconActionsLock) {
      beaconActions=Collections.synchronizedSet((Set<BeaconAction>)gson.fromJson(actionJson,listType));
    }
  }
  String scanJson=sharedPreferences.getString(BeaconScan.SHARED_PREFS_TAG,"String_Node_Str");
  if (!scanJson.isEmpty()) {
    Type listType=new TypeToken<Set<BeaconScan>>(){
    }
.getType();
synchronized (beaconScansLock) {
      beaconScans=Collections.synchronizedSet((Set<BeaconScan>)gson.fromJson(actionJson,listType));
    }
  }
}

Fixed version (ground truth):
private void loadAllData(){
  String actionJson=sharedPreferences.getString(BeaconAction.SHARED_PREFS_TAG,"String_Node_Str");
  if (!actionJson.isEmpty()) {
    Type listType=new TypeToken<Set<BeaconAction>>(){
    }
.getType();
synchronized (beaconActionsLock) {
      beaconActions=Collections.synchronizedSet((Set<BeaconAction>)gson.fromJson(actionJson,listType));
    }
  }
  String scanJson=sharedPreferences.getString(BeaconScan.SHARED_PREFS_TAG,"String_Node_Str");
  if (!scanJson.isEmpty()) {
    Type listType=new TypeToken<Set<BeaconScan>>(){
    }
.getType();
synchronized (beaconScansLock) {
      beaconScans=Collections.synchronizedSet((Set<BeaconScan>)gson.fromJson(scanJson,listType));
    }
  }
}
Program: 13641
Project: 13641
Buggy source:
@Override public Object getContentsOfFileOrNull(File file){
  FileInputStream fis=null;
  ObjectInputStream ois=null;
  try {
    fis=new FileInputStream(file);
    ois=new ObjectInputStream(fis);
    return ois.readObject();
  }
 catch (  Exception e) {
    return null;
    Logger.log.logError("String_Node_Str",e);
  }
 finally {
    Closeables.close(fis);
    Closeables.close(ois);
  }
}

Fixed version (ground truth):
@Override public Object getContentsOfFileOrNull(File file){
  FileInputStream fis=null;
  ObjectInputStream ois=null;
  try {
    fis=new FileInputStream(file);
    ois=new ObjectInputStream(fis);
    return ois.readObject();
  }
 catch (  Exception e) {
    Logger.log.logError("String_Node_Str",e);
  }
 finally {
    Closeables.close(fis);
    Closeables.close(ois);
  }
  return null;
}
Program: 13642
Project: 13642
Buggy source:
public void setResolverBaseURL(URL resolverBaseURL){
  Intent service=new Intent(context,SensorbergService.class);
  service.putExtra(SensorbergService.EXTRA_GENERIC_WHAT,SensorbergService.MSG_TYPE_SET_RESOLVER_ENDPOINT);
  if (resolverBaseURL != null) {
    service.putExtra(SensorbergService.MSG_SET_RESOLVER_ENDPOINT_ENDPOINT_URL,resolverBaseURL);
  }
  context.startService(service);
}

Fixed version (ground truth):
public void setResolverBaseURL(URL resolverBaseURL){
  Intent service=new Intent(context,SensorbergService.class);
  service.putExtra(SensorbergService.EXTRA_GENERIC_TYPE,SensorbergService.MSG_TYPE_SET_RESOLVER_ENDPOINT);
  if (resolverBaseURL != null) {
    service.putExtra(SensorbergService.MSG_SET_RESOLVER_ENDPOINT_ENDPOINT_URL,resolverBaseURL);
  }
  context.startService(service);
}
Program: 13643
Project: 13643
Buggy source:
@Override public void setUp() throws Exception {
  super.setUp();
  plattform=spy(new AndroidPlatform(getContext()));
  when(plattform.useSyncClient()).thenReturn(true);
  transport=new OkHttpClientTransport(plattform,null);
  startWebserver();
}

Fixed version (ground truth):
@Override public void setUp() throws Exception {
  super.setUp();
  plattform=spy(new TestPlatform());
  plattform.setContext(getContext());
  when(plattform.useSyncClient()).thenReturn(true);
  transport=new OkHttpClientTransport(plattform,null);
  startWebserver();
}