Program: 42856
Project: 42856
Buggy source:
private synchronized void init(Context context){
  String agencyProviderMetaData=getAgencyProviderMetaData(context);
  String agencyProviderTypeMetaData=context.getString(R.string.agency_provider_type);
  String rtsProviderMetaData=context.getString(R.string.rts_provider);
  String scheduleProviderMetaData=getScheduleProviderMetaData(context);
  String statusProviderMetaData=getStatusProviderMetaData(context);
  String serviceUpdateProviderMetaData=getServiceUpdateProviderMetaData(context);
  String newsProviderMetaData=getNewsProviderMetaData(context);
  String statusProviderTargetMetaData=context.getString(R.string.status_provider_target);
  String scheduleProviderTargetMetaData=context.getString(R.string.schedule_provider_target);
  String serviceUpdateProviderTargetMetaData=context.getString(R.string.service_update_provider_target);
  String newsProviderTargetMetaData=context.getString(R.string.news_provider_target);
  PackageManager pm=context.getPackageManager();
  for (  PackageInfo packageInfo : pm.getInstalledPackages(PackageManager.GET_PROVIDERS | PackageManager.GET_META_DATA)) {
    ProviderInfo[] providers=packageInfo.providers;
    if (providers != null) {
      for (      ProviderInfo provider : providers) {
        if (provider.metaData != null) {
          if (agencyProviderMetaData.equals(provider.metaData.getString(agencyProviderMetaData))) {
            int agencyTypeId=provider.metaData.getInt(agencyProviderTypeMetaData,-1);
            if (agencyTypeId >= 0) {
              DataSourceType newAgencyType=DataSourceType.parseId(agencyTypeId);
              if (newAgencyType != null) {
                if (!this.allAgencyTypes.contains(newAgencyType)) {
                  this.allAgencyTypes.add(newAgencyType);
                }
              }
              this.agenciesAuthorityTypeId.put(provider.authority,agencyTypeId);
            }
            boolean isRTS=rtsProviderMetaData.equals(provider.metaData.getString(rtsProviderMetaData));
            this.agenciesAuthorityIsRts.put(provider.authority,isRTS);
            this.allAgenciesAuthority.add(provider.authority);
          }
          if (statusProviderMetaData.equals(provider.metaData.getString(statusProviderMetaData))) {
            String targetAuthority=provider.metaData.getString(statusProviderTargetMetaData);
            StatusProviderProperties newStatusProvider=new StatusProviderProperties(provider.authority,targetAuthority);
            addNewStatusProvider(newStatusProvider);
          }
          if (scheduleProviderMetaData.equals(provider.metaData.getString(scheduleProviderMetaData))) {
            String targetAuthority=provider.metaData.getString(scheduleProviderTargetMetaData);
            ScheduleProviderProperties newScheduleProvider=new ScheduleProviderProperties(provider.authority,targetAuthority);
            addNewScheduleProvider(newScheduleProvider);
          }
          if (serviceUpdateProviderMetaData.equals(provider.metaData.getString(serviceUpdateProviderMetaData))) {
            String targetAuthority=provider.metaData.getString(serviceUpdateProviderTargetMetaData);
            ServiceUpdateProviderProperties newServiceUpdateProvider=new ServiceUpdateProviderProperties(provider.authority,targetAuthority);
            addNewServiceUpdateProvider(newServiceUpdateProvider);
          }
          if (newsProviderMetaData.equals(provider.metaData.getString(newsProviderMetaData))) {
            String targetAuthority=provider.metaData.getString(newsProviderTargetMetaData);
            NewsProviderProperties newNewsProvider=new NewsProviderProperties(provider.authority,targetAuthority);
            addNewNewsProvider(newNewsProvider);
          }
        }
      }
    }
  }
  CollectionUtils.sort(this.allAgencyTypes,new DataSourceType.DataSourceTypeShortNameComparator(context));
}

Fixed version (ground truth):
private synchronized void init(Context context){
  try {
    String agencyProviderMetaData=getAgencyProviderMetaData(context);
    String agencyProviderTypeMetaData=context.getString(R.string.agency_provider_type);
    String rtsProviderMetaData=context.getString(R.string.rts_provider);
    String scheduleProviderMetaData=getScheduleProviderMetaData(context);
    String statusProviderMetaData=getStatusProviderMetaData(context);
    String serviceUpdateProviderMetaData=getServiceUpdateProviderMetaData(context);
    String newsProviderMetaData=getNewsProviderMetaData(context);
    String statusProviderTargetMetaData=context.getString(R.string.status_provider_target);
    String scheduleProviderTargetMetaData=context.getString(R.string.schedule_provider_target);
    String serviceUpdateProviderTargetMetaData=context.getString(R.string.service_update_provider_target);
    String newsProviderTargetMetaData=context.getString(R.string.news_provider_target);
    PackageManager pm=context.getPackageManager();
    for (    PackageInfo packageInfo : pm.getInstalledPackages(PackageManager.GET_PROVIDERS | PackageManager.GET_META_DATA)) {
      ProviderInfo[] providers=packageInfo.providers;
      if (providers != null) {
        for (        ProviderInfo provider : providers) {
          if (provider.metaData != null) {
            if (agencyProviderMetaData.equals(provider.metaData.getString(agencyProviderMetaData))) {
              int agencyTypeId=provider.metaData.getInt(agencyProviderTypeMetaData,-1);
              if (agencyTypeId >= 0) {
                DataSourceType newAgencyType=DataSourceType.parseId(agencyTypeId);
                if (newAgencyType != null) {
                  if (!this.allAgencyTypes.contains(newAgencyType)) {
                    this.allAgencyTypes.add(newAgencyType);
                  }
                }
                this.agenciesAuthorityTypeId.put(provider.authority,agencyTypeId);
              }
              boolean isRTS=rtsProviderMetaData.equals(provider.metaData.getString(rtsProviderMetaData));
              this.agenciesAuthorityIsRts.put(provider.authority,isRTS);
              this.allAgenciesAuthority.add(provider.authority);
            }
            if (statusProviderMetaData.equals(provider.metaData.getString(statusProviderMetaData))) {
              String targetAuthority=provider.metaData.getString(statusProviderTargetMetaData);
              StatusProviderProperties newStatusProvider=new StatusProviderProperties(provider.authority,targetAuthority);
              addNewStatusProvider(newStatusProvider);
            }
            if (scheduleProviderMetaData.equals(provider.metaData.getString(scheduleProviderMetaData))) {
              String targetAuthority=provider.metaData.getString(scheduleProviderTargetMetaData);
              ScheduleProviderProperties newScheduleProvider=new ScheduleProviderProperties(provider.authority,targetAuthority);
              addNewScheduleProvider(newScheduleProvider);
            }
            if (serviceUpdateProviderMetaData.equals(provider.metaData.getString(serviceUpdateProviderMetaData))) {
              String targetAuthority=provider.metaData.getString(serviceUpdateProviderTargetMetaData);
              ServiceUpdateProviderProperties newServiceUpdateProvider=new ServiceUpdateProviderProperties(provider.authority,targetAuthority);
              addNewServiceUpdateProvider(newServiceUpdateProvider);
            }
            if (newsProviderMetaData.equals(provider.metaData.getString(newsProviderMetaData))) {
              String targetAuthority=provider.metaData.getString(newsProviderTargetMetaData);
              NewsProviderProperties newNewsProvider=new NewsProviderProperties(provider.authority,targetAuthority);
              addNewNewsProvider(newNewsProvider);
            }
          }
        }
      }
    }
    CollectionUtils.sort(this.allAgencyTypes,new DataSourceType.DataSourceTypeShortNameComparator(context));
  }
 catch (  Exception e) {
    MTLog.w(this,e,"String_Node_Str");
    destroy();
  }
}