nus-yam/ex-repair huggingface dataset:
Program: 93877
Project: 93877
Buggy source:
/** 
 * Lists all bundles that contain a class
 */
@Descriptor("String_Node_Str") public void clhas(@Descriptor("String_Node_Str") String className){
  if (extractPackage(className) == null) {
    return;
  }
  className=ClassLoadingHelper.convertToResourcePath(className);
  Map<Bundle,List<String>> foundBundles=ClassLoadingHelper.getBundlesContainingResource(bundleContext,className);
  if (foundBundles.size() == 0) {
    System.out.println("String_Node_Str" + className + "String_Node_Str");
    return;
  }
  outputBundlesAndResources("String_Node_Str" + className + "String_Node_Str",foundBundles);
}

Fixed version (ground truth):
/** 
 * Lists all bundles that contain a class
 */
@Descriptor("String_Node_Str") public void clhas(@Descriptor("String_Node_Str") String className){
  className=ClassLoadingHelper.convertToResourcePath(className);
  Map<Bundle,List<String>> foundBundles=ClassLoadingHelper.getBundlesContainingResource(bundleContext,className);
  if (foundBundles.size() == 0) {
    System.out.println("String_Node_Str" + className + "String_Node_Str");
    return;
  }
  outputBundlesAndResources("String_Node_Str" + className + "String_Node_Str",foundBundles);
}
Program: 93878
Project: 93878
Buggy source:
private String extractPackage(String className){
  String classPackage=null;
  int index=className.lastIndexOf("String_Node_Str");
  if (index == -1) {
    System.out.println("String_Node_Str" + className + "String_Node_Str");
  }
 else {
    classPackage=className.substring(0,index);
  }
  return classPackage;
}

Fixed version (ground truth):
private String extractPackage(String className){
  int index=className.lastIndexOf("String_Node_Str");
  return index == -1 ? null : className.substring(0,index);
}
Program: 93879
Project: 93879
Buggy source:
private void doClload(String className,String bundle){
  if (extractPackage(className) == null) {
    return;
  }
  Map<Bundle,Bundle> foundBundles;
  if (bundle == null) {
    foundBundles=ClassLoadingHelper.getBundlesLoadingClass(bundleContext,className);
  }
 else {
    foundBundles=ClassLoadingHelper.getBundlesLoadingClass(bundleContext,className,bundle);
  }
  if (foundBundles.size() == 0) {
    if (bundle == null) {
      System.out.println("String_Node_Str" + className + "String_Node_Str");
    }
 else {
      System.out.println("String_Node_Str" + bundle + "String_Node_Str"+ className+ "String_Node_Str");
    }
    return;
  }
  outputFoundBundlesAndRelations("String_Node_Str" + className + "String_Node_Str"+ ((bundle != null) ? "String_Node_Str" : "String_Node_Str"),foundBundles,"String_Node_Str");
}

Fixed version (ground truth):
private void doClload(String className,String bundle){
  if (extractPackage(className) == null) {
    System.out.println("String_Node_Str" + className + "String_Node_Str");
  }
  Map<Bundle,Bundle> foundBundles;
  if (bundle == null) {
    foundBundles=ClassLoadingHelper.getBundlesLoadingClass(bundleContext,className);
  }
 else {
    foundBundles=ClassLoadingHelper.getBundlesLoadingClass(bundleContext,className,bundle);
  }
  if (foundBundles.size() == 0) {
    if (bundle == null) {
      System.out.println("String_Node_Str" + className + "String_Node_Str");
    }
 else {
      System.out.println("String_Node_Str" + bundle + "String_Node_Str"+ className+ "String_Node_Str");
    }
    return;
  }
  outputFoundBundlesAndRelations("String_Node_Str" + className + "String_Node_Str"+ ((bundle != null) ? "String_Node_Str" : "String_Node_Str"),foundBundles,"String_Node_Str");
}
Program: 93880
Project: 93880
Buggy source:
/** 
 * Returns the scope name of the given   {@link InstallArtifact} or <code>null</code> if the given InstallArtifactdoes not belong to a scope.
 * @param installArtifact the <code>InstallArtiface</code> whose scope name is required
 * @return the scope name or <code>null</code> if the given InstallArtifact does not belong to a scope
 */
private String getArtifactScopeName(InstallArtifact installArtifact){
  if (installArtifact instanceof PlanInstallArtifact) {
    PlanInstallArtifact planInstallArtifact=(PlanInstallArtifact)installArtifact;
    boolean scoped=planInstallArtifact.isScoped();
    if (scoped) {
      return planInstallArtifact.getName() + SCOPE_SEPARATOR + versionToShortString(planInstallArtifact.getVersion());
    }
  }
  Tree<InstallArtifact> tree=installArtifact.getTree();
  Tree<InstallArtifact> parent=tree.getParent();
  if (parent != null) {
    return getArtifactScopeName(parent.getValue());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the scope name of the given   {@link InstallArtifact} or <code>null</code> if the given InstallArtifactdoes not belong to a scope.
 * @param installArtifact the <code>InstallArtiface</code> whose scope name is required
 * @return the scope name or <code>null</code> if the given InstallArtifact does not belong to a scope
 */
private String getArtifactScopeName(InstallArtifact installArtifact){
  if (installArtifact instanceof PlanInstallArtifact) {
    PlanInstallArtifact planInstallArtifact=(PlanInstallArtifact)installArtifact;
    boolean scoped=planInstallArtifact.isScoped();
    if (scoped) {
      return planInstallArtifact.getName() + SCOPE_SEPARATOR + versionToShortString(planInstallArtifact.getVersion());
    }
  }
  return installArtifact.getScopeName();
}
Program: 93881
Project: 93881
Buggy source:
private void serviceUnregistering(ServiceReference<?> serviceReference){
synchronized (this.monitor) {
    List<CommandDescriptor> commandDescriptorsForService=this.commandDescriptorsByService.remove(serviceReference);
    this.commandDescriptors.removeAll(commandDescriptorsForService);
  }
}

Fixed version (ground truth):
private void serviceUnregistering(ServiceReference<?> serviceReference){
synchronized (this.monitor) {
    List<CommandDescriptor> commandDescriptorsForService=this.commandDescriptorsByService.remove(serviceReference);
    if (commandDescriptorsForService != null) {
      this.commandDescriptors.removeAll(commandDescriptorsForService);
    }
  }
}
Program: 93882
Project: 93882
Buggy source:
@Override public boolean equals(Object obj){
  return getId().equals(((ArtifactHolder)obj).getId());
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  return obj instanceof ArtifactHolder && getId().equals(((ArtifactHolder)obj).getId());
}
Program: 93883
Project: 93883
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public List<QuasiLiveService> getAllServices(File source){
  List<QuasiLiveService> quasiLiveServices=new ArrayList<QuasiLiveService>();
  if (source == null) {
    SortedMap<Long,QuasiLiveService> services=getServicesSortedMap(this.getQuasiFramework(source));
    for (    Entry<Long,QuasiLiveService> serviceEntry : services.entrySet()) {
      quasiLiveServices.add(serviceEntry.getValue());
    }
  }
  return quasiLiveServices;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public List<QuasiLiveService> getAllServices(File source){
  List<QuasiLiveService> quasiLiveServices=new ArrayList<QuasiLiveService>();
  if (source == null) {
    SortedMap<Long,QuasiLiveService> services=getServicesSortedMap(this.getQuasiFramework());
    for (    Entry<Long,QuasiLiveService> serviceEntry : services.entrySet()) {
      quasiLiveServices.add(serviceEntry.getValue());
    }
  }
  return quasiLiveServices;
}
Program: 93884
Project: 93884
Buggy source:
private QuasiFramework getQuasiFramework(File source){
  if (source == null) {
    return new StandardQuasiLiveFramework(this.quasiFrameworkFactory.create(),this.bundleContext);
  }
 else {
    try {
      return this.quasiFrameworkFactory.create(source);
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private QuasiFramework getQuasiFramework(File source){
  if (source == null) {
    return getQuasiFramework();
  }
 else {
    try {
      return this.quasiFrameworkFactory.create(source);
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}
Program: 93885
Project: 93885
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public QuasiLiveService getService(File source,long serviceId){
  if (source == null) {
    SortedMap<Long,QuasiLiveService> services=getServicesSortedMap(this.getQuasiFramework(source));
    return services.get(serviceId);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public QuasiLiveService getService(File source,long serviceId){
  if (source == null) {
    SortedMap<Long,QuasiLiveService> services=getServicesSortedMap(this.getQuasiFramework());
    return services.get(serviceId);
  }
  return null;
}
Program: 93886
Project: 93886
Buggy source:
/** 
 * Pre-condition: this must only be used on the live framework. 
 */
private SortedMap<Long,QuasiLiveService> getServicesSortedMap(QuasiFramework quasiFramework){
  SortedMap<Long,QuasiLiveService> services=new TreeMap<Long,QuasiLiveService>();
  ServiceReference<?>[] allServiceReferences=null;
  try {
    allServiceReferences=this.bundleContext.getAllServiceReferences(null,null);
  }
 catch (  InvalidSyntaxException e) {
  }
  for (  ServiceReference<?> serviceReference : allServiceReferences) {
    QuasiLiveService service=new StandardQuasiLiveService(quasiFramework,serviceReference);
    services.put(service.getServiceId(),service);
  }
  return services;
}

Fixed version (ground truth):
/** 
 * Pre-condition: this must only be used on the live framework. 
 */
private SortedMap<Long,QuasiLiveService> getServicesSortedMap(QuasiFramework quasiFramework){
  SortedMap<Long,QuasiLiveService> services=new TreeMap<Long,QuasiLiveService>();
  ServiceReference<?>[] allServiceReferences=null;
  try {
    allServiceReferences=this.bundleContext.getAllServiceReferences(null,null);
  }
 catch (  InvalidSyntaxException e) {
    return services;
  }
  for (  ServiceReference<?> serviceReference : allServiceReferences) {
    QuasiLiveService service=new StandardQuasiLiveService(quasiFramework,serviceReference);
    services.put(service.getServiceId(),service);
  }
  return services;
}
Program: 93887
Project: 93887
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public List<QuasiResolutionFailure> getResolverReport(File source,long bundleId){
  QuasiFramework framework=this.getQuasiFramework(source);
  return framework.diagnose(bundleId);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public List<QuasiResolutionFailure> getResolverReport(File source,long bundleId){
  QuasiFramework framework=this.getQuasiFramework(source);
  framework.resolve();
  return framework.diagnose(bundleId);
}
Program: 93888
Project: 93888
Buggy source:
StandardQuasiFramework(BundleContext bundleContext,State state,PlatformAdmin platformAdmin,ResolutionFailureDetective detective,Repository repository,TransformedManifestProvidingBundleFileWrapper bundleTransformationHandler,RegionDigraph regionDigraph){
  TOP=regionDigraph.createRegionFilterBuilder().allowAll(RegionFilter.VISIBLE_ALL_NAMESPACE).build();
  this.bundleContext=bundleContext;
  this.state=state;
  this.stateObjectFactory=platformAdmin.getFactory();
  this.detective=detective;
  this.stateHelper=platformAdmin.getStateHelper();
  this.bundleTransformationHandler=bundleTransformationHandler;
  this.regionDigraph=regionDigraph;
  this.userRegion=regionDigraph.getRegion("String_Node_Str");
  setResolverHookFactory();
  this.dependencyCalculator=new DependencyCalculator(platformAdmin.getFactory(),this.detective,repository,this.bundleContext);
}

Fixed version (ground truth):
StandardQuasiFramework(BundleContext bundleContext,State state,PlatformAdmin platformAdmin,ResolutionFailureDetective detective,Repository repository,TransformedManifestProvidingBundleFileWrapper bundleTransformationHandler,RegionDigraph regionDigraph){
  TOP=regionDigraph.createRegionFilterBuilder().allowAll(RegionFilter.VISIBLE_ALL_NAMESPACE).build();
  this.bundleContext=bundleContext;
  this.state=state;
  this.stateObjectFactory=platformAdmin.getFactory();
  this.detective=detective;
  this.stateHelper=platformAdmin.getStateHelper();
  this.bundleTransformationHandler=bundleTransformationHandler;
  this.regionDigraph=regionDigraph;
  this.userRegion=regionDigraph.getRegion("String_Node_Str");
  this.coregion=regionDigraph.getRegion(this.userRegion.getName() + COREGION_SUFFIX);
  setResolverHookFactory();
  this.dependencyCalculator=new DependencyCalculator(platformAdmin.getFactory(),this.detective,repository,this.bundleContext);
}
Program: 93889
Project: 93889
Buggy source:
/** 
 * Gets a specific   {@link Artifact} from this repository. If the artifact is a bundle, it is only returned if thebundle is in the user region.
 * @param type The type of the {@link Artifact} to get
 * @param name The name of the {@link Artifact} to get
 * @param version The {@link Version} of the {@link Artifact} to get
 * @param region The {@link Region} to get the {@link Artifact} from
 * @return The {@link Artifact} represented by this type, name, and version if it is in the repository, otherwise<code>null</code>
 */
Artifact getArtifact(String type,String name,Version version,Region region);

Fixed version (ground truth):
/** 
 * Gets a specific   {@link Artifact} from this repository. 
 * @param type The type of the {@link Artifact} to get
 * @param name The name of the {@link Artifact} to get
 * @param version The {@link Version} of the {@link Artifact} to get
 * @param region The {@link Region} to get the {@link Artifact} from or null if the artifact has no region or the region isn't known
 * @return The {@link Artifact} represented by this type, name, and version if it is in the repository, otherwise<code>null</code>
 */
Artifact getArtifact(String type,String name,Version version,Region region);
Program: 93890
Project: 93890
Buggy source:
/** 
 * {@inheritDoc}
 */
public Set<Artifact> getDependents(Artifact rootArtifact){
  Set<Artifact> artifacts=new HashSet<Artifact>();
  QuasiBundle rootBundle=getBundle(rootArtifact);
  if (rootBundle == null) {
    return Collections.<Artifact>emptySet();
  }
  for (  QuasiImportPackage importPackage : rootBundle.getImportPackages()) {
    QuasiExportPackage provider=importPackage.getProvider();
    if (provider != null) {
      QuasiBundle bundle=provider.getExportingBundle();
      Artifact artifact=artifactRepository.getArtifact(BundleArtifact.TYPE,bundle.getSymbolicName(),bundle.getVersion(),this.regionDigraph.getRegion(bundle.getBundleId()));
      artifacts.add(artifact);
    }
  }
  return artifacts;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public Set<Artifact> getDependents(Artifact rootArtifact){
  if (!rootArtifact.getType().equalsIgnoreCase("String_Node_Str")) {
    return Collections.<Artifact>emptySet();
  }
  QuasiBundle rootBundle=getBundle(rootArtifact);
  if (rootBundle == null) {
    return Collections.<Artifact>emptySet();
  }
  Set<Artifact> artifacts=new HashSet<Artifact>();
  for (  QuasiImportPackage importPackage : rootBundle.getImportPackages()) {
    QuasiExportPackage provider=importPackage.getProvider();
    if (provider != null) {
      QuasiBundle bundle=provider.getExportingBundle();
      Artifact artifact=artifactRepository.getArtifact(BundleArtifact.TYPE,bundle.getSymbolicName(),bundle.getVersion(),this.regionDigraph.getRegion(bundle.getBundleId()));
      artifacts.add(artifact);
    }
  }
  return artifacts;
}
Program: 93891
Project: 93891
Buggy source:
private QuasiBundle getBundle(Artifact artifact){
  QuasiFramework framework=quasiFrameworkFactory.create();
  for (  QuasiBundle bundle : framework.getBundles()) {
    if (artifact.getName().equals(bundle.getSymbolicName()) && artifact.getVersion().equals(bundle.getVersion())) {
      return bundle;
    }
  }
  return null;
}

Fixed version (ground truth):
private QuasiBundle getBundle(Artifact artifact){
  QuasiFramework framework=quasiFrameworkFactory.create();
  for (  QuasiBundle bundle : framework.getBundles()) {
    if (artifact.getName().equals(bundle.getSymbolicName()) && artifact.getVersion().equals(bundle.getVersion()) && artifact.getRegion().equals(this.regionDigraph.getRegion(bundle.getBundleId()))) {
      return bundle;
    }
  }
  return null;
}
Program: 93892
Project: 93892
Buggy source:
private void setResolverHookFactory(){
  if (this.state instanceof StateImpl) {
    ServiceReference<ResolverHookFactory> ref=this.bundleContext.getServiceReference(ResolverHookFactory.class);
    if (ref != null) {
      ResolverHookFactory resolverHookFactory=this.bundleContext.getService(ref);
      ((StateImpl)this.state).setResolverHookFactory(resolverHookFactory);
      this.bundleContext.ungetService(ref);
    }
  }
}

Fixed version (ground truth):
private void setResolverHookFactory(){
  ResolverHookFactory resolverHookFactory=new RegionResolverHookFactory(this.regionDigraph);
  this.state.setResolverHookFactory(resolverHookFactory);
}
Program: 93893
Project: 93893
Buggy source:
private Long getBundleId(BundleRevision bundleRevision){
  Bundle bundle=bundleRevision.getBundle();
  if (bundle != null) {
    return bundle.getBundleId();
  }
  if (bundleRevision instanceof ResolverBundle) {
    ResolverBundle resolverBundle=(ResolverBundle)bundleRevision;
    return resolverBundle.getBundleDescription().getBundleId();
  }
  Assert.isTrue(false,"String_Node_Str",bundleRevision);
  return INVALID_BUNDLE_ID;
}

Fixed version (ground truth):
private Long getBundleId(BundleRevision bundleRevision){
  Bundle bundle=bundleRevision.getBundle();
  if (bundle != null) {
    return bundle.getBundleId();
  }
  if (bundleRevision instanceof BundleDescription) {
    BundleDescription bundleDescription=(BundleDescription)bundleRevision;
    return bundleDescription.getBundleId();
  }
  Assert.isTrue(false,"String_Node_Str",bundleRevision);
  return INVALID_BUNDLE_ID;
}
Program: 93894
Project: 93894
Buggy source:
@Override public boolean isBundleAllowed(String bundleSymbolicName,Version bundleVersion){
synchronized (this.monitor) {
    for (    OrderedPair<String,VersionRange> allowedBundle : this.allowedBundles) {
      if (allowedBundle.getFirst().endsWith(bundleSymbolicName) && allowedBundle.getSecond().includes(bundleVersion)) {
        return true;
      }
    }
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean isBundleAllowed(String bundleSymbolicName,Version bundleVersion){
synchronized (this.monitor) {
    for (    OrderedPair<String,VersionRange> allowedBundle : this.allowedBundles) {
      if (allowedBundle.getFirst().equals(bundleSymbolicName) && allowedBundle.getSecond().includes(bundleVersion)) {
        return true;
      }
    }
    return false;
  }
}
Program: 93895
Project: 93895
Buggy source:
private void checkPlanScoping(TestPlanArtifactInfo parent,Model model){
  if (parent.isScoped()) {
    Artifact parentPlan=getPlan(parent);
    for (    Artifact child : parentPlan.getDependents()) {
      if (PLAN_TYPE.equals(child.getType())) {
        String childPlanName=child.getName();
        String unscopedChildPlanName=parent.getChildPlan().getName();
        String expectedChildPlanName=model.getScopeName() + SCOPE_SEPARATOR + unscopedChildPlanName;
        assertEquals(expectedChildPlanName,childPlanName);
      }
    }
  }
}

Fixed version (ground truth):
private void checkPlanScoping(TestPlanArtifactInfo parent,Model model){
  if (parent.isScoped()) {
    Artifact parentPlan=getPlan(parent);
    Set<Artifact> children=parentPlan.getDependents();
    for (    Artifact child : children) {
      if (PLAN_TYPE.equals(child.getType())) {
        String childPlanName=child.getName();
        String unscopedChildPlanName=parent.getChildPlan().getName();
        String expectedChildPlanName=model.getScopeName() + SCOPE_SEPARATOR + unscopedChildPlanName;
        assertEquals(expectedChildPlanName,childPlanName);
      }
    }
  }
}
Program: 93896
Project: 93896
Buggy source:
public ModelBundleListenerInitializer(@NonNull RuntimeArtifactRepository artifactRepository,@NonNull PackageAdminUtil packageAdminUtil,@NonNull BundleContext kernelBundleContext,@NonNull BundleContext userRegionBundleContext){
  this.artifactRepository=artifactRepository;
  this.packageAdminUtil=packageAdminUtil;
  this.kernelBundleContext=kernelBundleContext;
  this.userRegionBundleContext=userRegionBundleContext;
  this.bundleListener=new ModelBundleListener(kernelBundleContext,artifactRepository,packageAdminUtil);
}

Fixed version (ground truth):
public ModelBundleListenerInitializer(@NonNull RuntimeArtifactRepository artifactRepository,@NonNull PackageAdminUtil packageAdminUtil,@NonNull BundleContext kernelBundleContext,@NonNull BundleContext userRegionBundleContext){
  this.artifactRepository=artifactRepository;
  this.packageAdminUtil=packageAdminUtil;
  this.kernelBundleContext=kernelBundleContext;
  this.userRegionBundleContext=userRegionBundleContext;
  this.systemBundleContext=kernelBundleContext.getBundle(0L).getBundleContext();
  this.bundleListener=new ModelBundleListener(kernelBundleContext,artifactRepository,packageAdminUtil);
}
Program: 93897
Project: 93897
Buggy source:
/** 
 * Unregisters the listener from the OSGi framework
 */
@PreDestroy public void destroy(){
  this.userRegionBundleContext.removeBundleListener(bundleListener);
}

Fixed version (ground truth):
/** 
 * Unregisters the listener from the OSGi framework
 */
@PreDestroy public void destroy(){
  this.systemBundleContext.removeBundleListener(this.bundleListener);
}
Program: 93898
Project: 93898
Buggy source:
/** 
 * Registers a   {@link BundleListener} with the OSGi framework. Enumerates any existing {@link Bundle}s that exist from the OSGi framework.
 */
@PostConstruct public void initialize(){
  this.userRegionBundleContext.addBundleListener(bundleListener);
  for (  Bundle bundle : userRegionBundleContext.getBundles()) {
    try {
      this.artifactRepository.add(new BundleArtifact(kernelBundleContext,packageAdminUtil,bundle));
    }
 catch (    Exception e) {
      logger.error(String.format("String_Node_Str",bundle.getSymbolicName(),bundle.getVersion().toString()),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Registers a   {@link BundleListener} with the OSGi framework. Enumerates any existing {@link Bundle}s that exist from the OSGi framework.
 */
@PostConstruct public void initialize(){
  this.systemBundleContext.addBundleListener(this.bundleListener);
  for (  Bundle bundle : this.userRegionBundleContext.getBundles()) {
    try {
      this.artifactRepository.add(new BundleArtifact(this.kernelBundleContext,this.packageAdminUtil,bundle));
    }
 catch (    Exception e) {
      this.logger.error(String.format("String_Node_Str",bundle.getSymbolicName(),bundle.getVersion().toString()),e);
    }
  }
}
Program: 93899
Project: 93899
Buggy source:
@Test public void destroy() throws IOException, InvalidSyntaxException {
  this.initializer.initialize();
  assertEquals(1,this.bundleContext.getBundleListeners().size());
  this.initializer.destroy();
  assertEquals(0,this.bundleContext.getBundleListeners().size());
}

Fixed version (ground truth):
@Test public void destroy() throws IOException, InvalidSyntaxException {
  this.initializer.initialize();
  assertEquals(1,this.systemBundleContext.getBundleListeners().size());
  this.initializer.destroy();
  assertEquals(0,this.systemBundleContext.getBundleListeners().size());
}
Program: 93900
Project: 93900
Buggy source:
@Test public void initialize() throws IOException, InvalidSyntaxException {
  assertEquals(0,this.bundleContext.getBundleListeners().size());
  this.initializer.initialize();
  assertEquals(1,this.bundleContext.getBundleListeners().size());
  assertEquals(1,this.artifactRepository.getArtifacts().size());
}

Fixed version (ground truth):
@Test public void initialize() throws IOException, InvalidSyntaxException {
  assertEquals(0,this.systemBundleContext.getBundleListeners().size());
  this.initializer.initialize();
  assertEquals(1,this.systemBundleContext.getBundleListeners().size());
  assertEquals(1,this.artifactRepository.getArtifacts().size());
}
Program: 93901
Project: 93901
Buggy source:
/** 
 * {@inheritDoc}
 */
public void activate(ComponentContext context){
  registerSpringDmToBlueprintEventAdapter(context.getBundleContext());
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public void activate(ComponentContext context){
  registerSpringDmToBlueprintEventAdapter(context.getBundleContext());
  context.enableComponent(AGENT_DM_START_TRACKER);
}
Program: 93902
Project: 93902
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void connectRegion(Region tailRegion,RegionFilter filter) throws BundleException {
  this.regionDigraph.connect(this,tailRegion,filter);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void connectRegion(Region tailRegion,RegionFilter filter) throws BundleException {
synchronized (this.updateMonitor) {
    this.regionDigraph.connect(this,tailRegion,filter);
  }
}
Program: 93903
Project: 93903
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void addBundle(Bundle bundle) throws BundleException {
  checkBundleNotAssociatedWithAnotherRegion(bundle);
  String symbolicName=bundle.getSymbolicName();
  Version version=bundle.getVersion();
  checkDuplicateBundleInRegion(bundle,symbolicName,version);
  checkDuplicateBundleViaFilter(bundle,symbolicName,version);
  this.bundleIds.add(bundle.getBundleId());
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void addBundle(Bundle bundle) throws BundleException {
synchronized (this.updateMonitor) {
    checkBundleNotAssociatedWithAnotherRegion(bundle);
    String symbolicName=bundle.getSymbolicName();
    Version version=bundle.getVersion();
    checkDuplicateBundleInRegion(bundle,symbolicName,version);
    checkDuplicateBundleViaFilter(bundle,symbolicName,version);
    this.bundleIds.add(bundle.getBundleId());
  }
}
Program: 93904
Project: 93904
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Bundle installBundle(String location) throws BundleException {
  return null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Bundle installBundle(String location) throws BundleException {
synchronized (this.updateMonitor) {
    return null;
  }
}
Program: 93905
Project: 93905
Buggy source:
Filter getServiceFilter();

Fixed version (ground truth):
/** 
 * Gets the service filter of this filter.
 * @return the service filter or <code>null</code> if this has not been set
 */
Filter getServiceFilter();
Program: 93906
Project: 93906
Buggy source:
@Override public boolean isImported(Region providerRegion,String packageName,Map<String,Object> attributes,Map<String,String> directives){
  return providerRegion == null || this.equals(providerRegion);
}

Fixed version (ground truth):
@Override public boolean isImported(String packageName,Map<String,Object> attributes,Map<String,String> directives){
  return false;
}
Program: 93908
Project: 93908
Buggy source:
/** 
 * Returns <code>true</code> if and only if the package with the specified name exported with the specified attributes and directives is imported into the region.
 * @param providerRegion the region containing the bundle that exports the package
 * @param packageName the name of the package
 * @param attributes the package's export attributes
 * @param directives the package's export directives
 * @return <code>true</code> if and only if the package is imported
 */
boolean isImported(Region providerRegion,String packageName,Map<String,Object> attributes,Map<String,String> directives);

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if and only if the package with the specified name exported with the specified attributes and directives is imported into the region.
 * @param packageName the name of the package
 * @param attributes the package's export attributes
 * @param directives the package's export directives
 * @return <code>true</code> if and only if the package is imported
 */
boolean isImported(String packageName,Map<String,Object> attributes,Map<String,String> directives);
Program: 93909
Project: 93909
Buggy source:
@Override public void filterMatches(BundleRevision requirer,Collection<Capability> candidates){
  Region requirerRegion=getRegion(requirer);
  if (requirerRegion != null) {
    RegionPackageImportPolicy requirerRegionPackageImportPolicy=requirerRegion.getRegionPackageImportPolicy();
    if (!this.kernelRegion.equals(requirerRegion)) {
      Iterator<Capability> i=candidates.iterator();
      while (i.hasNext()) {
        Capability c=i.next();
        if (this.kernelRegion.equals(getRegion(c.getProviderRevision()))) {
          String namespace=c.getNamespace();
          if (Capability.PACKAGE_CAPABILITY.equals(namespace)) {
            if (!requirerRegionPackageImportPolicy.isImported(this.kernelRegion,(String)c.getAttributes().get(Capability.PACKAGE_CAPABILITY),c.getAttributes(),c.getDirectives())) {
              i.remove();
            }
          }
 else {
            i.remove();
          }
        }
      }
    }
 else {
      Iterator<Capability> i=candidates.iterator();
      while (i.hasNext()) {
        Capability c=i.next();
        BundleRevision providerRevision=c.getProviderRevision();
        if (!isSystemBundle(providerRevision) && !this.kernelRegion.equals(getRegion(providerRevision))) {
          i.remove();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void filterMatches(BundleRevision requirer,Collection<Capability> candidates){
  Region requirerRegion=getRegion(requirer);
  if (requirerRegion != null) {
    RegionPackageImportPolicy requirerRegionPackageImportPolicy=requirerRegion.getRegionPackageImportPolicy();
    if (!this.kernelRegion.equals(requirerRegion)) {
      Iterator<Capability> i=candidates.iterator();
      while (i.hasNext()) {
        Capability c=i.next();
        if (this.kernelRegion.equals(getRegion(c.getProviderRevision()))) {
          String namespace=c.getNamespace();
          if (Capability.PACKAGE_CAPABILITY.equals(namespace)) {
            if (requirerRegionPackageImportPolicy.getUserRegion().equals(this.kernelRegion)) {
              i.remove();
            }
 else             if (!requirerRegionPackageImportPolicy.isImported((String)c.getAttributes().get(Capability.PACKAGE_CAPABILITY),c.getAttributes(),c.getDirectives())) {
              i.remove();
            }
          }
 else {
            i.remove();
          }
        }
      }
    }
 else {
      Iterator<Capability> i=candidates.iterator();
      while (i.hasNext()) {
        Capability c=i.next();
        BundleRevision providerRevision=c.getProviderRevision();
        if (!isSystemBundle(providerRevision) && !this.kernelRegion.equals(getRegion(providerRevision))) {
          i.remove();
        }
      }
    }
  }
}
Program: 93910
Project: 93910
Buggy source:
private Long getBundleId(BundleRevision bundleRevision){
  if (bundleRevision instanceof ResolverBundle) {
    ResolverBundle resolverBundle=(ResolverBundle)bundleRevision;
    return resolverBundle.getBundleDescription().getBundleId();
  }
  Assert.isTrue(false,"String_Node_Str",bundleRevision);
  return INVALID_BUNDLE_ID;
}

Fixed version (ground truth):
private Long getBundleId(BundleRevision bundleRevision){
  Bundle bundle=bundleRevision.getBundle();
  if (bundle != null) {
    return bundle.getBundleId();
  }
  if (bundleRevision instanceof ResolverBundle) {
    ResolverBundle resolverBundle=(ResolverBundle)bundleRevision;
    return resolverBundle.getBundleDescription().getBundleId();
  }
  Assert.isTrue(false,"String_Node_Str",bundleRevision);
  return INVALID_BUNDLE_ID;
}
Program: 93911
Project: 93911
Buggy source:
@Test public void testFindTransitive() throws BundleException {
  region(REGION_A).connectRegion(region(REGION_B),createFilter(BUNDLE_C));
  region(REGION_B).connectRegion(region(REGION_C),createFilter(BUNDLE_C));
  region(REGION_C).addBundle(bundle(BUNDLE_X));
  this.candidates.add(bundle(BUNDLE_B));
  this.candidates.add(bundle(BUNDLE_C));
  this.bundleFindHook.find(bundleContext(BUNDLE_A),this.candidates);
  assertTrue(this.candidates.contains(bundle(BUNDLE_C)));
  assertFalse(this.candidates.contains(bundle(BUNDLE_B)));
  assertFalse(this.candidates.contains(bundle(BUNDLE_X)));
}

Fixed version (ground truth):
@Test public void testFindTransitive() throws BundleException {
  region(REGION_A).connectRegion(region(REGION_B),createFilter(BUNDLE_C));
  region(REGION_B).connectRegion(region(REGION_C),createFilter(BUNDLE_C));
  region(REGION_C).addBundle(bundle(BUNDLE_X));
  this.candidates.add(bundle(BUNDLE_B));
  this.candidates.add(bundle(BUNDLE_C));
  this.candidates.add(bundle(BUNDLE_X));
  this.bundleFindHook.find(bundleContext(BUNDLE_A),this.candidates);
  assertTrue(this.candidates.contains(bundle(BUNDLE_C)));
  assertFalse(this.candidates.contains(bundle(BUNDLE_B)));
  assertFalse(this.candidates.contains(bundle(BUNDLE_X)));
}
Program: 93912
Project: 93912
Buggy source:
public StandardStateService(QuasiFrameworkFactory quasiFrameworkFactory,BundleContext bundleContext,RegionMembership regionMembership){
  this.quasiFrameworkFactory=quasiFrameworkFactory;
  this.bundleContext=bundleContext;
  this.regionMembership=regionMembership;
  try {
    this.kernelRegion=regionMembership.getRegion(FrameworkUtil.getBundle(this.getClass()));
  }
 catch (  IndeterminateRegionException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public StandardStateService(QuasiFrameworkFactory quasiFrameworkFactory,BundleContext bundleContext,RegionMembership regionMembership){
  this.quasiFrameworkFactory=quasiFrameworkFactory;
  this.bundleContext=bundleContext;
  this.regionMembership=regionMembership;
  this.kernelRegion=regionMembership.getKernelRegion();
}
Program: 93913
Project: 93913
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@Before public void setUp() throws Exception {
  this.stubBundleContext=new StubBundleContext();
  this.stubQuasiFrameworkFactory=new StubQuasiFrameworkFactory();
  this.mockUserRegion=EasyMock.createMock(Region.class);
  this.mockRegionMembership=EasyMock.createMock(RegionMembership.class);
  this.standardStateService=new StandardStateService(this.stubQuasiFrameworkFactory,this.stubBundleContext,this.mockRegionMembership);
  EasyMock.expect(this.mockRegionMembership.getRegion(EasyMock.anyLong())).andReturn(this.mockUserRegion).anyTimes();
  EasyMock.replay(this.mockUserRegion,this.mockRegionMembership);
}

Fixed version (ground truth):
/** 
 * @throws java.lang.Exception
 */
@Before public void setUp() throws Exception {
  this.stubBundleContext=new StubBundleContext();
  this.stubQuasiFrameworkFactory=new StubQuasiFrameworkFactory();
  this.mockUserRegion=EasyMock.createMock(Region.class);
  this.mockKernelRegion=EasyMock.createMock(Region.class);
  this.mockRegionMembership=EasyMock.createMock(RegionMembership.class);
  EasyMock.expect(this.mockRegionMembership.getRegion(EasyMock.anyLong())).andReturn(this.mockUserRegion).anyTimes();
  EasyMock.expect(this.mockRegionMembership.getKernelRegion()).andReturn(this.mockKernelRegion).anyTimes();
  EasyMock.replay(this.mockUserRegion,this.mockKernelRegion,this.mockRegionMembership);
  this.standardStateService=new StandardStateService(this.stubQuasiFrameworkFactory,this.stubBundleContext,this.mockRegionMembership);
}
Program: 93914
Project: 93914
Buggy source:
@Override public void filterResolvable(Collection<BundleRevision> candidates){
  if (!this.triggerInRegion) {
    Iterator<BundleRevision> i=candidates.iterator();
    while (i.hasNext()) {
      if (isMember(i.next())) {
        i.remove();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void filterResolvable(Collection<BundleRevision> candidates){
  if (!this.triggerInRegion) {
    Iterator<BundleRevision> i=candidates.iterator();
    while (i.hasNext()) {
      BundleRevision nextCandidate=i.next();
      if (isMember(nextCandidate) && !isSystemBundle(nextCandidate)) {
        i.remove();
      }
    }
  }
}
Program: 93915
Project: 93915
Buggy source:
private boolean isMember(BundleRevision bundleRevision){
  Bundle bundle=bundleRevision.getBundle();
  if (bundle != null) {
    return isUserRegionBundle(bundle);
  }
  if (bundleRevision instanceof ResolverBundle) {
    ResolverBundle resolverBundle=(ResolverBundle)bundleRevision;
    return isUserRegionBundle(resolverBundle.getBundleDescription().getBundleId());
  }
  Assert.isTrue(false,"String_Node_Str",bundleRevision);
  return true;
}

Fixed version (ground truth):
private boolean isMember(BundleRevision bundleRevision){
  Bundle bundle=bundleRevision.getBundle();
  if (bundle != null) {
    return isUserRegionBundle(bundle);
  }
  Long bundleId=getBundleId(bundleRevision);
  return isUserRegionBundle(bundleId);
}
Program: 93916
Project: 93916
Buggy source:
@Override public void filterMatches(BundleRevision requirer,Collection<Capability> candidates){
  if (isMember(requirer)) {
    Iterator<Capability> i=candidates.iterator();
    while (i.hasNext()) {
      Capability c=i.next();
      if (!isMember(c.getProviderRevision())) {
        String namespace=c.getNamespace();
        if (Capability.BUNDLE_CAPABILITY.equals(namespace)) {
          i.remove();
        }
        if (Capability.PACKAGE_CAPABILITY.equals(namespace)) {
          if (!imported((String)c.getAttributes().get(Capability.PACKAGE_CAPABILITY),c.getAttributes(),c.getDirectives())) {
            i.remove();
          }
        }
      }
    }
  }
 else {
    Iterator<Capability> i=candidates.iterator();
    while (i.hasNext()) {
      Capability c=i.next();
      if (!isMember(c.getProviderRevision())) {
        i.remove();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void filterMatches(BundleRevision requirer,Collection<Capability> candidates){
  if (isMember(requirer)) {
    Iterator<Capability> i=candidates.iterator();
    while (i.hasNext()) {
      Capability c=i.next();
      if (!isMember(c.getProviderRevision())) {
        String namespace=c.getNamespace();
        if (Capability.BUNDLE_CAPABILITY.equals(namespace)) {
          i.remove();
        }
        if (Capability.PACKAGE_CAPABILITY.equals(namespace)) {
          if (!imported((String)c.getAttributes().get(Capability.PACKAGE_CAPABILITY),c.getAttributes(),c.getDirectives())) {
            i.remove();
          }
        }
      }
    }
  }
 else {
    Iterator<Capability> i=candidates.iterator();
    while (i.hasNext()) {
      Capability c=i.next();
      BundleRevision providerRevision=c.getProviderRevision();
      if (isMember(providerRevision) && !isSystemBundle(providerRevision)) {
        i.remove();
      }
    }
  }
}
Program: 93917
Project: 93917
Buggy source:
@Before public void basicSetUp(){
  this.bundle[0]=new StubBundle(0L,"String_Node_Str",new Version("String_Node_Str"),"String_Node_Str");
  this.bundle[1]=new StubBundle(1L,"String_Node_Str",new Version("String_Node_Str"),"String_Node_Str");
  this.bundle[2]=new StubBundle(2L,"String_Node_Str",new Version("String_Node_Str"),"String_Node_Str");
  regionMembership=new StubRegionMembership(2L);
}

Fixed version (ground truth):
@Before public void basicSetUp(){
  this.bundle[SYSTEM_BUNDLE_INDEX]=new StubBundle(0L,"String_Node_Str",new Version("String_Node_Str"),"String_Node_Str");
  this.bundle[KERNEL_BUNDLE_INDEX]=new StubBundle(1L,"String_Node_Str",new Version("String_Node_Str"),"String_Node_Str");
  this.bundle[USER_REGION_BUNDLE_INDEX]=new StubBundle(2L,"String_Node_Str",new Version("String_Node_Str"),"String_Node_Str");
  regionMembership=new StubRegionMembership(2L);
}
Program: 93918
Project: 93918
Buggy source:
/** 
 * @throws java.lang.Exception
 */
@Before public void basicServiceSetUp() throws Exception {
  for (int i=0; i < 3; i++) {
    StubServiceRegistration<String> reg=new StubServiceRegistration<String>((StubBundleContext)getBundle(i).getBundleContext(),"String_Node_Str");
    serviceReference[i]=new StubServiceReference<String>(reg);
  }
}

Fixed version (ground truth):
/** 
 * @throws java.lang.Exception
 */
@Before public void basicServiceSetUp() throws Exception {
  for (int i=0; i < NUM_BUNDLES; i++) {
    StubServiceRegistration<String> reg=new StubServiceRegistration<String>((StubBundleContext)getBundle(i).getBundleContext(),"String_Node_Str");
    serviceReference[i]=new StubServiceReference<String>(reg);
  }
}
Program: 93919
Project: 93919
Buggy source:
void assertServiceReferencePresent(Collection<ServiceReference<?>> serviceReferences,int[] indices){
  for (  int i : indices) {
    assertTrue(serviceReferences.contains(getServiceReference(i)));
  }
}

Fixed version (ground truth):
void assertServiceReferencePresent(Collection<ServiceReference<?>> serviceReferences,int... indices){
  for (  int i : indices) {
    assertTrue(serviceReferences.contains(getServiceReference(i)));
  }
}
Program: 93920
Project: 93920
Buggy source:
@Test public void testEventFromSystemBundle(){
  BundleEvent event=getBundleEvent(0);
  this.regionBundleEventHook.event(event,this.bundleContexts);
  assertContextPresent(0,1,2);
}

Fixed version (ground truth):
@Test public void testEventFromSystemBundle(){
  BundleEvent event=getBundleEvent(SYSTEM_BUNDLE_INDEX);
  this.regionBundleEventHook.event(event,this.bundleContexts);
  assertContextPresent(SYSTEM_BUNDLE_INDEX,KERNEL_BUNDLE_INDEX,USER_REGION_BUNDLE_INDEX);
}
Program: 93921
Project: 93921
Buggy source:
@Test public void testEventFromKernelRegion(){
  BundleEvent event=getBundleEvent(1);
  this.regionBundleEventHook.event(event,this.bundleContexts);
  assertContextPresent(0,1);
}

Fixed version (ground truth):
@Test public void testEventFromKernelRegion(){
  BundleEvent event=getBundleEvent(KERNEL_BUNDLE_INDEX);
  this.regionBundleEventHook.event(event,this.bundleContexts);
  assertContextPresent(SYSTEM_BUNDLE_INDEX,KERNEL_BUNDLE_INDEX);
}
Program: 93922
Project: 93922
Buggy source:
@Test public void testEventFromUserRegion(){
  BundleEvent event=getBundleEvent(2);
  this.regionBundleEventHook.event(event,this.bundleContexts);
  assertContextPresent(0,2);
}

Fixed version (ground truth):
@Test public void testEventFromUserRegion(){
  BundleEvent event=getBundleEvent(USER_REGION_BUNDLE_INDEX);
  this.regionBundleEventHook.event(event,this.bundleContexts);
  assertContextPresent(SYSTEM_BUNDLE_INDEX,USER_REGION_BUNDLE_INDEX);
}
Program: 93923
Project: 93923
Buggy source:
@Test public void testFindByKernelBundle(){
  this.bundles=getBundles();
  this.regionBundleFindHook.find(getBundleContext(1),this.bundles);
  assertBundlePresent(0,1);
}

Fixed version (ground truth):
@Test public void testFindByKernelBundle(){
  this.bundles=getBundles();
  this.regionBundleFindHook.find(getBundleContext(KERNEL_BUNDLE_INDEX),this.bundles);
  assertBundlePresent(SYSTEM_BUNDLE_INDEX,KERNEL_BUNDLE_INDEX);
}
Program: 93924
Project: 93924
Buggy source:
@Test public void testFindBySystemBundle(){
  this.bundles=getBundles();
  this.regionBundleFindHook.find(getBundleContext(0),this.bundles);
  assertBundlePresent(0,1,2);
}

Fixed version (ground truth):
@Test public void testFindBySystemBundle(){
  this.bundles=getBundles();
  this.regionBundleFindHook.find(getBundleContext(SYSTEM_BUNDLE_INDEX),this.bundles);
  assertBundlePresent(SYSTEM_BUNDLE_INDEX,KERNEL_BUNDLE_INDEX,USER_REGION_BUNDLE_INDEX);
}
Program: 93925
Project: 93925
Buggy source:
@Test public void testFindByUserRegionBundle(){
  this.bundles=getBundles();
  this.regionBundleFindHook.find(getBundleContext(2),this.bundles);
  assertBundlePresent(0,2);
}

Fixed version (ground truth):
@Test public void testFindByUserRegionBundle(){
  this.bundles=getBundles();
  this.regionBundleFindHook.find(getBundleContext(USER_REGION_BUNDLE_INDEX),this.bundles);
  assertBundlePresent(SYSTEM_BUNDLE_INDEX,USER_REGION_BUNDLE_INDEX);
}
Program: 93926
Project: 93926
Buggy source:
@Test public void testIsSystemBundleBundleContext(){
  Assert.assertTrue(RegionHookBase.isSystemBundle(getBundle(0).getBundleContext()));
  Assert.assertFalse(RegionHookBase.isSystemBundle(getBundle(1).getBundleContext()));
}

Fixed version (ground truth):
@Test public void testIsSystemBundleBundleContext(){
  Assert.assertTrue(RegionHookBase.isSystemBundle(getBundleContext(SYSTEM_BUNDLE_INDEX)));
  Assert.assertFalse(RegionHookBase.isSystemBundle(getBundleContext(KERNEL_BUNDLE_INDEX)));
}
Program: 93927
Project: 93927
Buggy source:
@Test public void testIsUserRegionBundleBundle(){
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundle(0)));
  Assert.assertFalse(this.testRegionHook.isUserRegionBundle(getBundle(1)));
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundle(2)));
}

Fixed version (ground truth):
@Test public void testIsUserRegionBundleBundle(){
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundle(SYSTEM_BUNDLE_INDEX)));
  Assert.assertFalse(this.testRegionHook.isUserRegionBundle(getBundle(KERNEL_BUNDLE_INDEX)));
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundle(USER_REGION_BUNDLE_INDEX)));
}
Program: 93928
Project: 93928
Buggy source:
@Test public void testIsUserRegionBundleLong(){
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundle(0).getBundleId()));
  Assert.assertFalse(this.testRegionHook.isUserRegionBundle(getBundle(1).getBundleId()));
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundle(2).getBundleId()));
}

Fixed version (ground truth):
@Test public void testIsUserRegionBundleLong(){
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundleId(SYSTEM_BUNDLE_INDEX)));
  Assert.assertFalse(this.testRegionHook.isUserRegionBundle(getBundleId(KERNEL_BUNDLE_INDEX)));
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundleId(USER_REGION_BUNDLE_INDEX)));
}
Program: 93929
Project: 93929
Buggy source:
@Test public void testIsUserRegionBundleBundleContext(){
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundle(0).getBundleContext()));
  Assert.assertFalse(this.testRegionHook.isUserRegionBundle(getBundle(1).getBundleContext()));
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundle(2).getBundleContext()));
}

Fixed version (ground truth):
@Test public void testIsUserRegionBundleBundleContext(){
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundleContext(SYSTEM_BUNDLE_INDEX)));
  Assert.assertFalse(this.testRegionHook.isUserRegionBundle(getBundleContext(KERNEL_BUNDLE_INDEX)));
  Assert.assertTrue(this.testRegionHook.isUserRegionBundle(getBundleContext(USER_REGION_BUNDLE_INDEX)));
}
Program: 93930
Project: 93930
Buggy source:
@Test public void testIsSystemBundleBundle(){
  Assert.assertTrue(RegionHookBase.isSystemBundle(getBundle(0)));
  Assert.assertFalse(RegionHookBase.isSystemBundle(getBundle(1)));
}

Fixed version (ground truth):
@Test public void testIsSystemBundleBundle(){
  Assert.assertTrue(RegionHookBase.isSystemBundle(getBundle(SYSTEM_BUNDLE_INDEX)));
  Assert.assertFalse(RegionHookBase.isSystemBundle(getBundle(KERNEL_BUNDLE_INDEX)));
}