nus-yam/ex-repair huggingface dataset:
Program: 152931
Project: 152931
Buggy source:
/** 
 * Returns the namespace/resolver invoker plugin. To do that, the Spring-DM core classes will be used assuming that its infrastructure is being used.
 * @return the invoking bundle
 */
private Bundle getInvokingBundle(){
  ClassLoader coreClassLoader=OsgiStringUtils.class.getClassLoader();
  try {
    Class cacheClass=coreClassLoader.loadClass(CACHE_CLASS);
    Field field=cacheClass.getField(FIELD_NAME);
    return (Bundle)((ThreadLocal)field.get(null)).get();
  }
 catch (  Exception ex) {
    log.trace("String_Node_Str",ex);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns the namespace/resolver invoker plugin. To do that, the Spring-DM core classes will be used assuming that its infrastructure is being used.
 * @return the invoking bundle
 */
private Bundle getInvokingBundle(){
  ClassLoader coreClassLoader=OsgiStringUtils.class.getClassLoader();
  try {
    Class cacheClass=coreClassLoader.loadClass(CACHE_CLASS);
    Field field=cacheClass.getField(FIELD_NAME);
    ReflectionUtils.makeAccessible(field);
    return (Bundle)((ThreadLocal)field.get(null)).get();
  }
 catch (  Exception ex) {
    log.trace("String_Node_Str",ex);
    return null;
  }
}
Program: 152933
Project: 152933
Buggy source:
public ServiceWrapper(ServiceReference ref,BundleContext bundleContext){
  Assert.notNull(ref,"String_Node_Str");
  Assert.notNull(bundleContext,"String_Node_Str");
  reference=ref;
  this.context=bundleContext;
  serviceId=OsgiServiceReferenceUtils.getServiceId(ref);
  serviceRanking=OsgiServiceReferenceUtils.getServiceRanking(ref);
  toString="String_Node_Str" + serviceId + "String_Node_Str"+ reference+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Constructs a new <code>ServiceWrapper</code> instance. Clone-like constructor.
 * @param wrapper
 */
public ServiceWrapper(ServiceWrapper wrapper){
  Assert.notNull(wrapper);
  this.reference=wrapper.reference;
  this.serviceId=wrapper.serviceId;
  this.serviceRanking=wrapper.serviceRanking;
  this.toString=wrapper.toString;
  this.context=wrapper.context;
}
Program: 152934
Project: 152934
Buggy source:
public static void callListenersUnbind(BundleContext context,Object serviceProxy,ServiceReference reference,OsgiServiceLifecycleListener[] listeners){
  if (!ObjectUtils.isEmpty(listeners)) {
    boolean debug=log.isDebugEnabled();
    Dictionary properties=OsgiServiceReferenceUtils.getServicePropertiesSnapshot(reference);
    for (int i=0; i < listeners.length; i++) {
      if (debug)       log.debug("String_Node_Str" + listeners[i] + "String_Node_Str"+ reference);
      try {
        listeners[i].unbind(serviceProxy,(Map)properties);
      }
 catch (      Exception ex) {
        log.warn("String_Node_Str" + listeners[i] + "String_Node_Str",ex);
      }
    }
  }
}

Fixed version (ground truth):
public static void callListenersUnbind(BundleContext context,Object serviceProxy,ServiceReference reference,OsgiServiceLifecycleListener[] listeners){
  if (!ObjectUtils.isEmpty(listeners)) {
    boolean debug=log.isDebugEnabled();
    Dictionary properties=OsgiServiceReferenceUtils.getServicePropertiesSnapshot(reference);
    for (int i=0; i < listeners.length; i++) {
      if (debug)       log.debug("String_Node_Str" + listeners[i] + "String_Node_Str"+ reference);
      try {
        listeners[i].unbind(serviceProxy,(Map)properties);
      }
 catch (      Exception ex) {
        log.warn("String_Node_Str" + listeners[i] + "String_Node_Str",ex);
      }
      if (debug)       log.debug("String_Node_Str" + listeners[i] + "String_Node_Str"+ reference);
    }
  }
}
Program: 152935
Project: 152935
Buggy source:
public static void callListenersBind(BundleContext context,Object serviceProxy,ServiceReference reference,OsgiServiceLifecycleListener[] listeners){
  if (!ObjectUtils.isEmpty(listeners)) {
    boolean debug=log.isDebugEnabled();
    Dictionary properties=OsgiServiceReferenceUtils.getServicePropertiesSnapshot(reference);
    for (int i=0; i < listeners.length; i++) {
      if (debug)       log.debug("String_Node_Str" + listeners[i] + "String_Node_Str"+ reference);
      try {
        listeners[i].bind(serviceProxy,(Map)properties);
      }
 catch (      Exception ex) {
        log.warn("String_Node_Str" + listeners[i] + "String_Node_Str",ex);
      }
    }
  }
}

Fixed version (ground truth):
public static void callListenersBind(BundleContext context,Object serviceProxy,ServiceReference reference,OsgiServiceLifecycleListener[] listeners){
  if (!ObjectUtils.isEmpty(listeners)) {
    boolean debug=log.isDebugEnabled();
    Dictionary properties=OsgiServiceReferenceUtils.getServicePropertiesSnapshot(reference);
    for (int i=0; i < listeners.length; i++) {
      if (debug)       log.debug("String_Node_Str" + listeners[i] + "String_Node_Str"+ reference);
      try {
        listeners[i].bind(serviceProxy,(Map)properties);
      }
 catch (      Exception ex) {
        log.warn("String_Node_Str" + listeners[i] + "String_Node_Str",ex);
      }
      if (debug)       log.debug("String_Node_Str" + listeners[i] + "String_Node_Str"+ reference);
    }
  }
}
Program: 152936
Project: 152936
Buggy source:
protected String[] getTestBundlesNames(){
  return new String[]{"String_Node_Str" + getSpringOsgiVersion(),"String_Node_Str" + getSpringOsgiVersion()};
}

Fixed version (ground truth):
protected String[] getTestBundlesNames(){
  return new String[]{"String_Node_Str" + getSpringDMVersion(),"String_Node_Str" + getSpringDMVersion()};
}
Program: 152937
Project: 152937
Buggy source:
public void testCallGetResourceOnADifferentBundle() throws Exception {
  Bundle[] bundles=bundleContext.getBundles();
  for (int i=1; i < bundles.length; i++) {
    Bundle bundle=bundles[i];
    logger.debug("String_Node_Str" + OsgiStringUtils.nullSafeNameAndSymName(bundle));
    URL url=bundle.getResource(LOCATION);
  }
}

Fixed version (ground truth):
public void testCallGetResourceOnADifferentBundle() throws Exception {
  Bundle[] bundles=bundleContext.getBundles();
  for (int i=1; i < bundles.length; i++) {
    Bundle bundle=bundles[i];
    logger.debug("String_Node_Str" + OsgiStringUtils.nullSafeNameAndSymName(bundle));
    URL url=bundle.getResource(LOCATION);
    if (!OsgiBundleUtils.isFragment(bundle))     assertNotNull(url);
  }
}
Program: 152938
Project: 152938
Buggy source:
public void testGetResourceThroughSpringResourceAbstraction() throws Exception {
  Bundle[] bundles=bundleContext.getBundles();
  for (int i=1; i < bundles.length; i++) {
    Bundle bundle=bundles[i];
    Resource res=new OsgiBundleResource(bundle,ResourceLoader.CLASSPATH_URL_PREFIX + LOCATION);
    System.out.println(res.exists());
  }
}

Fixed version (ground truth):
public void testGetResourceThroughSpringResourceAbstraction() throws Exception {
  Bundle[] bundles=bundleContext.getBundles();
  for (int i=1; i < bundles.length; i++) {
    Bundle bundle=bundles[i];
    Resource res=new OsgiBundleResource(bundle,ResourceLoader.CLASSPATH_URL_PREFIX + LOCATION);
    if (!OsgiBundleUtils.isFragment(bundle))     assertTrue(res.exists());
  }
}
Program: 152939
Project: 152939
Buggy source:
public void testCallGetResourcesOnADifferentBundle() throws Exception {
  Bundle[] bundles=bundleContext.getBundles();
  for (int i=1; i < bundles.length; i++) {
    Bundle bundle=bundles[i];
    logger.debug("String_Node_Str" + OsgiStringUtils.nullSafeNameAndSymName(bundle));
    Enumeration enm=bundle.getResources(LOCATION);
  }
}

Fixed version (ground truth):
public void testCallGetResourcesOnADifferentBundle() throws Exception {
  Bundle[] bundles=bundleContext.getBundles();
  for (int i=1; i < bundles.length; i++) {
    Bundle bundle=bundles[i];
    logger.debug("String_Node_Str" + OsgiStringUtils.nullSafeNameAndSymName(bundle));
    Enumeration enm=bundle.getResources(LOCATION);
    if (!OsgiBundleUtils.isFragment(bundle))     assertNotNull(enm);
  }
}
Program: 152940
Project: 152940
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
  this.serviceFactoryBean=new OsgiMultiServiceProxyFactoryBean();
  ref=new MockServiceReference(new String[]{Serializable.class.getName()});
  bundleContext=new MockBundleContext(){
    private final String filter_Serializable=OsgiFilterUtils.unifyFilter(Serializable.class,null);
    public ServiceReference[] getServiceReferences(    String clazz,    String filter) throws InvalidSyntaxException {
      if (this.filter_Serializable.equals(filter))       return new ServiceReference[]{ref};
      return new ServiceReference[0];
    }
  }
;
  serviceFactoryBean.setBundleContext(this.bundleContext);
  serviceFactoryBean.setBeanClassLoader(getClass().getClassLoader());
  serviceFactoryBean.setInterface(new Class[]{TestCase.class});
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  super.setUp();
  this.serviceFactoryBean=new OsgiMultiServiceProxyFactoryBean();
  ref=new MockServiceReference(new String[]{Serializable.class.getName()});
  bundleContext=new MockBundleContext(){
    private final String filter_Serializable=OsgiFilterUtils.unifyFilter(Serializable.class,null);
    public ServiceReference[] getServiceReferences(    String clazz,    String filter) throws InvalidSyntaxException {
      if (this.filter_Serializable.equalsIgnoreCase(filter))       return new ServiceReference[]{ref};
      return new ServiceReference[0];
    }
  }
;
  serviceFactoryBean.setBundleContext(this.bundleContext);
  serviceFactoryBean.setBeanClassLoader(getClass().getClassLoader());
  serviceFactoryBean.setInterface(new Class[]{TestCase.class});
}
Program: 152941
Project: 152941
Buggy source:
public ServiceReference[] getServiceReferences(String clazz,String filter) throws InvalidSyntaxException {
  if (this.filter_Serializable.equals(filter))   return new ServiceReference[]{ref};
  return new ServiceReference[0];
}

Fixed version (ground truth):
public ServiceReference[] getServiceReferences(String clazz,String filter) throws InvalidSyntaxException {
  if (this.filter_Serializable.equalsIgnoreCase(filter))   return new ServiceReference[]{ref};
  return new ServiceReference[0];
}
Program: 152942
Project: 152942
Buggy source:
public void testBundleWithHeaderAndNoMetaInfResourcesIsSpringPowered(){
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(null);
  aBundle.setEntryReturnOnNextCallToGetEntry("String_Node_Str");
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
}

Fixed version (ground truth):
public void testBundleWithHeaderAndNoMetaInfResourcesIsSpringPowered() throws Exception {
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(null);
  aBundle.setEntryReturnOnNextCallToGetEntry(new URL("String_Node_Str"));
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
}
Program: 152943
Project: 152943
Buggy source:
public void tstEmptyConfigLocationsInMetaInf(){
  System.out.println("String_Node_Str");
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(META_INF_SPRING_CONTENT[0]);
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",1,configFiles.length);
  assertEquals(ConfigUtils.SPRING_CONTEXT_FILES,configFiles[0]);
}

Fixed version (ground truth):
public void tstEmptyConfigLocationsInMetaInf() throws Exception {
  System.out.println("String_Node_Str");
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(new URL(META_INF_SPRING_CONTENT[0]));
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",1,configFiles.length);
  assertEquals(ConfigUtils.SPRING_CONTEXT_FILES,configFiles[0]);
}
Program: 152944
Project: 152944
Buggy source:
public void testCreateAsynchronouslyDefaultTrue(){
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(META_INF_SPRING_CONTENT[0]);
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertTrue("String_Node_Str",config.isCreateAsynchronously());
}

Fixed version (ground truth):
public void testCreateAsynchronouslyDefaultTrue() throws Exception {
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(new URL(META_INF_SPRING_CONTENT[0]));
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertTrue("String_Node_Str",config.isCreateAsynchronously());
}
Program: 152945
Project: 152945
Buggy source:
public void tstConfigLocationsInMetaInfWithWildcardHeader(){
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(META_INF_SPRING_CONTENT[0]);
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",1,configFiles.length);
  assertEquals(ConfigUtils.SPRING_CONTEXT_FILES,configFiles[0]);
}

Fixed version (ground truth):
public void tstConfigLocationsInMetaInfWithWildcardHeader() throws Exception {
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(new URL(META_INF_SPRING_CONTENT[0]));
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",1,configFiles.length);
  assertEquals(ConfigUtils.SPRING_CONTEXT_FILES,configFiles[0]);
}
Program: 152946
Project: 152946
Buggy source:
public void testSetCreateAsynchronouslyFalse(){
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(META_INF_SPRING_CONTENT[0]);
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertFalse("String_Node_Str",config.isCreateAsynchronously());
}

Fixed version (ground truth):
public void testSetCreateAsynchronouslyFalse() throws Exception {
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(new URL(META_INF_SPRING_CONTENT[0]));
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertFalse("String_Node_Str",config.isCreateAsynchronously());
}
Program: 152947
Project: 152947
Buggy source:
public void tstConfigLocationsInMetaInfWithHeaderAndDependencies(){
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(META_INF_SPRING_CONTENT[0]);
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",1,configFiles.length);
  assertEquals("String_Node_Str",configFiles[0]);
}

Fixed version (ground truth):
public void tstConfigLocationsInMetaInfWithHeaderAndDependencies() throws Exception {
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(new URL(META_INF_SPRING_CONTENT[0]));
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",1,configFiles.length);
  assertEquals("String_Node_Str",configFiles[0]);
}
Program: 152948
Project: 152948
Buggy source:
public void tstHeaderWithBadEntry(){
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setEntryReturnOnNextCallToGetEntry("String_Node_Str");
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertFalse("String_Node_Str",config.isSpringPoweredBundle());
  String[] configFiles=config.getConfigurationLocations();
  assertEquals("String_Node_Str",0,configFiles.length);
}

Fixed version (ground truth):
public void tstHeaderWithBadEntry() throws Exception {
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setEntryReturnOnNextCallToGetEntry(new URL("String_Node_Str"));
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertFalse("String_Node_Str",config.isSpringPoweredBundle());
  String[] configFiles=config.getConfigurationLocations();
  assertEquals("String_Node_Str",0,configFiles.length);
}
Program: 152949
Project: 152949
Buggy source:
public void tstConfigLocationsInMetaInfWithHeader(){
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry("String_Node_Str");
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",configFiles[0]);
}

Fixed version (ground truth):
public void tstConfigLocationsInMetaInfWithHeader() throws Exception {
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(new URL("String_Node_Str"));
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",configFiles[0]);
}
Program: 152950
Project: 152950
Buggy source:
public void tstTaskExecutorCreation() throws Exception {
  MockControl bundleContextControl=MockControl.createNiceControl(BundleContext.class);
  BundleContext context=(BundleContext)bundleContextControl.getMock();
  bundleContextControl.expectAndReturn(context.getBundle(),new MockBundle());
  bundleContextControl.expectAndReturn(context.getBundles(),new Bundle[0]);
  Dictionary headers=new Hashtable();
  headers.put(Constants.BUNDLE_NAME,"String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setEntryReturnOnNextCallToGetEntry(new ClassPathResource("String_Node_Str").getURL().toExternalForm());
  bundleContextControl.expectAndReturn(context.getBundle(),aBundle);
  bundleContextControl.expectAndReturn(context.getBundle(),aBundle);
  bundleContextControl.expectAndReturn(context.getBundle(),aBundle);
  bundleContextControl.replay();
  this.listener.start(context);
  MockBundle eventBundle=new MockBundle();
  eventBundle.setBundleId(1);
  BundleEvent event=new BundleEvent(BundleEvent.STARTED,eventBundle);
  try {
    this.listener.bundleChanged(event);
    fail("String_Node_Str");
  }
 catch (  RuntimeException ex) {
    assertEquals("String_Node_Str",ex.getMessage());
  }
}

Fixed version (ground truth):
public void tstTaskExecutorCreation() throws Exception {
  MockControl bundleContextControl=MockControl.createNiceControl(BundleContext.class);
  BundleContext context=(BundleContext)bundleContextControl.getMock();
  bundleContextControl.expectAndReturn(context.getBundle(),new MockBundle());
  bundleContextControl.expectAndReturn(context.getBundles(),new Bundle[0]);
  Dictionary headers=new Hashtable();
  headers.put(Constants.BUNDLE_NAME,"String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setEntryReturnOnNextCallToGetEntry(new ClassPathResource("String_Node_Str").getURL());
  bundleContextControl.expectAndReturn(context.getBundle(),aBundle);
  bundleContextControl.expectAndReturn(context.getBundle(),aBundle);
  bundleContextControl.expectAndReturn(context.getBundle(),aBundle);
  bundleContextControl.replay();
  this.listener.start(context);
  MockBundle eventBundle=new MockBundle();
  eventBundle.setBundleId(1);
  BundleEvent event=new BundleEvent(BundleEvent.STARTED,eventBundle);
  try {
    this.listener.bundleChanged(event);
    fail("String_Node_Str");
  }
 catch (  RuntimeException ex) {
    assertEquals("String_Node_Str",ex.getMessage());
  }
}
Program: 152951
Project: 152951
Buggy source:
public Object nextElement(){
  return (source[index++]);
}

Fixed version (ground truth):
public Object nextElement(){
  if (hasMoreElements())   return (source[index++]);
 else   throw new NoSuchElementException();
}
Program: 152952
Project: 152952
Buggy source:
public void setEntryReturnOnNextCallToGetEntry(String entry){
  this.nextEntryResult=entry;
}

Fixed version (ground truth):
public void setEntryReturnOnNextCallToGetEntry(URL entry){
  this.nextEntryResult=entry;
}
Program: 152953
Project: 152953
Buggy source:
public URL getEntry(String name){
  if (this.nextEntryResult != null) {
    try {
      URL result=new URL(this.nextEntryResult);
      this.nextEntryResult=null;
      return result;
    }
 catch (    MalformedURLException ex) {
    }
    this.nextEntryResult=null;
    return null;
  }
 else {
    return super.getEntry(name);
  }
}

Fixed version (ground truth):
public URL getEntry(String name){
  if (this.nextEntryResult != null) {
    URL result=this.nextEntryResult;
    this.nextEntryResult=null;
    return result;
  }
 else {
    return super.getEntry(name);
  }
}
Program: 152954
Project: 152954
Buggy source:
/** 
 * Delegates to the classloader. Identical to classLoader.getResources(path + filePattern);
 * @see org.osgi.framework.Bundle#findEntries(java.lang.String,java.lang.String,boolean)
 */
public Enumeration findEntries(String path,String filePattern,boolean recurse){
  Enumeration enm=null;
  try {
    enm=loader.getResources(path + "String_Node_Str" + filePattern);
  }
 catch (  Exception ex) {
  }
  return (enm == null ? new EmptyEnumeration() : enm);
}

Fixed version (ground truth):
/** 
 * Delegates to the classloader. Identical to classLoader.getResources(path + filePattern);
 * @see org.osgi.framework.Bundle#findEntries(java.lang.String,java.lang.String,boolean)
 */
public Enumeration findEntries(String path,String filePattern,boolean recurse){
  Enumeration enm=null;
  try {
    enm=loader.getResources(path + "String_Node_Str" + filePattern);
  }
 catch (  IOException ex) {
    System.err.println("String_Node_Str" + ex);
  }
  return (enm == null ? new EmptyEnumeration() : enm);
}
Program: 152955
Project: 152955
Buggy source:
/** 
 * If the Spring-Context header is present the resource files defined there will be used, otherwise all xml files in META-INF/spring will be treated as application context configuration files.
 */
private void initialise(){
  Dictionary headers=bundle.getHeaders();
  this.isSpringPoweredBundle=ConfigUtils.isSpringOsgiPoweredBundle(bundle);
  if (isSpringPoweredBundle) {
    String springContextHeader=ConfigUtils.getSpringContextHeader(headers);
    if (StringUtils.hasText(springContextHeader)) {
      this.timeout=ConfigUtils.getTimeOut(headers);
      this.publishContextAsService=ConfigUtils.getPublishContext(headers);
      this.asyncCreation=ConfigUtils.getCreateAsync(headers);
      try {
        this.configurationLocations=ConfigUtils.getConfigLocations(headers,bundle);
      }
 catch (      MissingConfiguration e) {
        this.configurationLocations=new String[0];
        this.isSpringPoweredBundle=false;
      }
      if (this.configurationLocations.length == 0) {
        this.isSpringPoweredBundle=false;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * If the Spring-Context header is present the resource files defined there will be used, otherwise all xml files in META-INF/spring will be treated as application context configuration files.
 */
private void initialise(){
  Dictionary headers=bundle.getHeaders();
  this.isSpringPoweredBundle=ConfigUtils.isSpringOsgiPoweredBundle(bundle);
  if (isSpringPoweredBundle) {
    String springContextHeader=ConfigUtils.getSpringContextHeader(headers);
    if (StringUtils.hasText(springContextHeader)) {
      this.timeout=ConfigUtils.getTimeOut(headers);
      this.publishContextAsService=ConfigUtils.getPublishContext(headers);
      this.asyncCreation=ConfigUtils.getCreateAsync(headers);
      try {
        this.configurationLocations=ConfigUtils.getConfigLocations(headers,bundle);
      }
 catch (      MissingConfiguration e) {
        log.error("String_Node_Str" + e.getMissingResource() + "String_Node_Str"+ toString,e);
        this.configurationLocations=new String[0];
        this.isSpringPoweredBundle=false;
      }
      if (this.configurationLocations.length == 0) {
        log.error("String_Node_Str" + toString);
        this.isSpringPoweredBundle=false;
      }
    }
  }
}
Program: 152956
Project: 152956
Buggy source:
/** 
 * Return the config locations from the Spring-Context header. The returned Strings can be sent to a  {@link org.springframework.core.io.ResourceLoader} for loading theconfigurations.
 * @param headers
 * @return
 */
public static String[] getConfigLocations(Dictionary headers,Bundle bundle) throws MissingConfiguration {
  String header=getSpringContextHeader(headers);
  if (StringUtils.hasText(header)) {
    String locations=StringUtils.tokenizeToStringArray(header,DIRECTIVE_SEPARATOR)[0];
    String[] ctxEntries=StringUtils.tokenizeToStringArray(locations,CONTEXT_LOCATION_SEPARATOR);
    ArrayList entries=new ArrayList();
    for (int i=0; i < ctxEntries.length; i++) {
      if (CONFIG_WILDCARD.equals(ctxEntries[i])) {
        Enumeration defaultConfig=bundle.findEntries(CONTEXT_DIR,CONTEXT_FILES,false);
        if (defaultConfig != null) {
          while (defaultConfig.hasMoreElements()) {
            entries.add(defaultConfig.nextElement().toString());
          }
        }
      }
 else {
        if (bundle.getEntry(ctxEntries[i]) == null) {
          throw new MissingConfiguration(ctxEntries[i]);
        }
        String entry=OsgiBundleResource.BUNDLE_URL_PREFIX + ctxEntries[i];
        entries.add(entry);
      }
    }
    ctxEntries=(String[])entries.toArray(new String[entries.size()]);
    return StringUtils.removeDuplicateStrings(ctxEntries);
  }
  return new String[0];
}

Fixed version (ground truth):
/** 
 * Return the config locations from the Spring-Context header. The returned Strings can be sent to a  {@link org.springframework.core.io.ResourceLoader} for loading theconfigurations.
 * @param headers
 * @return
 */
public static String[] getConfigLocations(Dictionary headers,Bundle bundle) throws MissingConfiguration {
  String header=getSpringContextHeader(headers);
  if (StringUtils.hasText(header)) {
    String locations=StringUtils.tokenizeToStringArray(header,DIRECTIVE_SEPARATOR)[0];
    String[] ctxEntries=StringUtils.tokenizeToStringArray(locations,CONTEXT_LOCATION_SEPARATOR);
    ArrayList entries=new ArrayList();
    for (int i=0; i < ctxEntries.length; i++) {
      if (CONFIG_WILDCARD.equals(ctxEntries[i])) {
        Enumeration defaultConfig=bundle.findEntries(CONTEXT_DIR,CONTEXT_FILES,false);
        if (defaultConfig != null) {
          while (defaultConfig.hasMoreElements()) {
            entries.add(defaultConfig.nextElement().toString());
          }
        }
      }
 else {
        if (bundle.getEntry(ctxEntries[i]) == null) {
          MissingConfiguration mc=new MissingConfiguration("String_Node_Str" + ctxEntries[i]);
          mc.setMissingResource(ctxEntries[i]);
          throw mc;
        }
        String entry=OsgiBundleResource.BUNDLE_URL_PREFIX + ctxEntries[i];
        entries.add(entry);
      }
    }
    ctxEntries=(String[])entries.toArray(new String[entries.size()]);
    return StringUtils.removeDuplicateStrings(ctxEntries);
  }
  return new String[0];
}
Program: 152957
Project: 152957
Buggy source:
private void fail(ServiceDependentOsgiBundleXmlApplicationContext applicationContext,Throwable t,Long bundleKey){
  applicationContext.interrupt();
  if (log.isErrorEnabled()) {
    log.error("String_Node_Str" + bundle.getSymbolicName() + "String_Node_Str",t);
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str",creationTrace);
    }
  }
synchronized (this.applicationContextMap) {
synchronized (this.contextsPendingInitializationMap) {
      this.contextsPendingInitializationMap.remove(bundleKey);
      this.applicationContextMap.remove(bundleKey);
    }
  }
  postEvent(BundleEvent.STOPPED);
}

Fixed version (ground truth):
protected void fail(ServiceDependentOsgiBundleXmlApplicationContext applicationContext,Throwable t,Long bundleKey){
  applicationContext.interrupt();
synchronized (this.applicationContextMap) {
synchronized (this.contextsPendingInitializationMap) {
      this.contextsPendingInitializationMap.remove(bundleKey);
      this.applicationContextMap.remove(bundleKey);
    }
  }
  postEvent(BundleEvent.STOPPED);
  StringBuffer buf=new StringBuffer();
  DependencyListener listener=applicationContext.getListener();
  if (listener == null || listener.getUnsatisfiedDependencies().isEmpty()) {
    buf.append("String_Node_Str");
  }
 else {
    for (Iterator dependencies=listener.getUnsatisfiedDependencies().iterator(); dependencies.hasNext(); ) {
      Dependency dependency=(Dependency)dependencies.next();
      buf.append(dependency.toString());
      if (dependencies.hasNext()) {
        buf.append("String_Node_Str");
      }
    }
  }
  if (log.isErrorEnabled()) {
    log.error("String_Node_Str" + bundle.getSymbolicName() + "String_Node_Str"+ buf.toString(),t);
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str" + bundle.getSymbolicName() + "String_Node_Str"+ "String_Node_Str",creationTrace);
    }
  }
}
Program: 152958
Project: 152958
Buggy source:
private void postEvent(int starting){
  mcast.multicastEvent(new SpringBundleEvent(starting,bundle));
}

Fixed version (ground truth):
protected void postEvent(int starting){
  mcast.multicastEvent(new SpringBundleEvent(starting,bundle));
}
Program: 152959
Project: 152959
Buggy source:
/** 
 * If the Spring-Context header is present the resource files defined there will be used, otherwise all xml files in META-INF/spring will be treated as application context configuration files.
 */
private void initialise(){
  Dictionary headers=bundle.getHeaders();
  this.isSpringPoweredBundle=ConfigUtils.isSpringOsgiPoweredBundle(bundle);
  if (isSpringPoweredBundle) {
    String springContextHeader=ConfigUtils.getSpringContextHeader(headers);
    if (StringUtils.hasText(springContextHeader)) {
      this.timeout=ConfigUtils.getTimeOut(headers);
      this.publishContextAsService=ConfigUtils.getPublishContext(headers);
      this.asyncCreation=ConfigUtils.getCreateAsync(headers);
      try {
        this.configurationLocations=ConfigUtils.getConfigLocations(headers,bundle);
      }
 catch (      MissingConfiguration e) {
        log.error("String_Node_Str" + e.getMissingResource() + "String_Node_Str"+ toString,e);
        this.configurationLocations=new String[0];
        this.isSpringPoweredBundle=false;
      }
      if (this.configurationLocations.length == 0) {
        log.error("String_Node_Str" + toString);
        this.isSpringPoweredBundle=false;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * If the Spring-Context header is present the resource files defined there will be used, otherwise all xml files in META-INF/spring will be treated as application context configuration files.
 */
private void initialise(){
  Dictionary headers=bundle.getHeaders();
  this.isSpringPoweredBundle=ConfigUtils.isSpringOsgiPoweredBundle(bundle);
  if (isSpringPoweredBundle) {
    String springContextHeader=ConfigUtils.getSpringContextHeader(headers);
    if (StringUtils.hasText(springContextHeader)) {
      this.timeout=ConfigUtils.getTimeOut(headers);
      this.publishContextAsService=ConfigUtils.getPublishContext(headers);
      this.asyncCreation=ConfigUtils.getCreateAsync(headers);
    }
    try {
      this.configurationLocations=ConfigUtils.getConfigLocations(headers,bundle);
      if (this.configurationLocations.length == 0) {
        log.error("String_Node_Str" + OsgiBundleUtils.getNullSafeSymbolicName(bundle));
        this.isSpringPoweredBundle=false;
      }
    }
 catch (    MissingConfiguration e) {
      log.error("String_Node_Str" + e.getMissingResource() + "String_Node_Str"+ OsgiBundleUtils.getNullSafeSymbolicName(bundle));
      this.configurationLocations=new String[0];
      this.isSpringPoweredBundle=false;
    }
  }
}
Program: 152960
Project: 152960
Buggy source:
/** 
 * Return the config locations from the Spring-Context header. The returned Strings can be sent to a  {@link org.springframework.core.io.ResourceLoader} for loading theconfigurations.
 * @param headers
 * @return
 */
public static String[] getConfigLocations(Dictionary headers,Bundle bundle) throws MissingConfiguration {
  String header=getSpringContextHeader(headers);
  if (StringUtils.hasText(header)) {
    String locations=StringUtils.tokenizeToStringArray(header,DIRECTIVE_SEPARATOR)[0];
    String[] ctxEntries=StringUtils.tokenizeToStringArray(locations,CONTEXT_LOCATION_SEPARATOR);
    ArrayList entries=new ArrayList();
    for (int i=0; i < ctxEntries.length; i++) {
      if (CONFIG_WILDCARD.equals(ctxEntries[i])) {
        Enumeration defaultConfig=bundle.findEntries(CONTEXT_DIR,CONTEXT_FILES,false);
        if (defaultConfig != null) {
          while (defaultConfig.hasMoreElements()) {
            entries.add(defaultConfig.nextElement().toString());
          }
        }
      }
 else {
        if (bundle.getEntry(ctxEntries[i]) == null) {
          MissingConfiguration mc=new MissingConfiguration("String_Node_Str" + ctxEntries[i]);
          mc.setMissingResource(ctxEntries[i]);
          throw mc;
        }
        String entry=OsgiBundleResource.BUNDLE_URL_PREFIX + ctxEntries[i];
        entries.add(entry);
      }
    }
    ctxEntries=(String[])entries.toArray(new String[entries.size()]);
    return StringUtils.removeDuplicateStrings(ctxEntries);
  }
  return new String[0];
}

Fixed version (ground truth):
/** 
 * Return the config locations from the Spring-Context header. The returned Strings can be sent to a  {@link org.springframework.core.io.ResourceLoader} for loading theconfigurations.
 * @param headers
 * @return
 */
public static String[] getConfigLocations(Dictionary headers,Bundle bundle) throws MissingConfiguration {
  String header=getSpringContextHeader(headers);
  String[] ctxEntries;
  if (StringUtils.hasText(header)) {
    String locations=StringUtils.tokenizeToStringArray(header,DIRECTIVE_SEPARATOR)[0];
    ctxEntries=StringUtils.tokenizeToStringArray(locations,CONTEXT_LOCATION_SEPARATOR);
  }
 else {
    ctxEntries=new String[]{SPRING_CONTEXT_DIRECTORY};
  }
  ArrayList entries=new ArrayList();
  for (int i=0; i < ctxEntries.length; i++) {
    if (CONFIG_WILDCARD.equals(ctxEntries[i]) || SPRING_CONTEXT_DIRECTORY.equals(ctxEntries[i])) {
      Enumeration defaultConfig=bundle.findEntries(CONTEXT_DIR,CONTEXT_FILES,false);
      if (defaultConfig != null && defaultConfig.hasMoreElements()) {
        entries.add(SPRING_CONTEXT_DIRECTORY);
      }
    }
 else {
      if (bundle.getEntry(ctxEntries[i]) == null) {
        MissingConfiguration mc=new MissingConfiguration("String_Node_Str" + ctxEntries[i]);
        mc.setMissingResource(ctxEntries[i]);
        throw mc;
      }
 else {
        entries.add(OsgiBundleResource.BUNDLE_URL_PREFIX + ctxEntries[i]);
      }
    }
  }
  ctxEntries=(String[])entries.toArray(new String[entries.size()]);
  return StringUtils.removeDuplicateStrings(ctxEntries);
}
Program: 152961
Project: 152961
Buggy source:
public void testConfigLocationsInMetaInfWithWildcardHeader(){
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(META_INF_SPRING_CONTENT[0]);
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",2,configFiles.length);
  assertEquals("String_Node_Str",configFiles[0]);
  assertEquals("String_Node_Str",configFiles[1]);
}

Fixed version (ground truth):
public void testConfigLocationsInMetaInfWithWildcardHeader(){
  Dictionary headers=new Hashtable();
  headers.put("String_Node_Str","String_Node_Str");
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(headers);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  aBundle.setEntryReturnOnNextCallToGetEntry(META_INF_SPRING_CONTENT[0]);
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  String[] configFiles=config.getConfigurationLocations();
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
  assertEquals("String_Node_Str",1,configFiles.length);
  assertEquals(ConfigUtils.SPRING_CONTEXT_DIRECTORY,configFiles[0]);
}
Program: 152962
Project: 152962
Buggy source:
public void testBundleWithSpringResourcesAndNoHeaderIsSpringPowered(){
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(null);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
}

Fixed version (ground truth):
public void testBundleWithSpringResourcesAndNoHeaderIsSpringPowered(){
  EntryLookupControllingMockBundle aBundle=new RepeatingEntryLookupControllingMockBundle(null);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  ApplicationContextConfiguration config=new ApplicationContextConfiguration(aBundle);
  assertTrue("String_Node_Str",config.isSpringPoweredBundle());
}
Program: 152963
Project: 152963
Buggy source:
public void testCreationFailureEvent(){
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(null);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  MockControl mockListener=MockControl.createControl(ApplicationListener.class);
  ApplicationListener listener=(ApplicationListener)mockListener.getMock();
  mcast.addApplicationListener(listener);
  final ServiceDependentOsgiBundleXmlApplicationContext testContext=new ServiceDependentOsgiBundleXmlApplicationContext(aBundle.getContext(),META_INF_SPRING_CONTENT){
    public void create(    Runnable postAction){
      throw new RuntimeException("String_Node_Str"){
        public synchronized Throwable fillInStackTrace(){
          return null;
        }
      }
;
    }
  }
;
  ApplicationContextCreator creator=new ApplicationContextCreator(aBundle,contextMap,initMap,this.pendingRegistrationTasks,null,new ApplicationContextConfiguration(aBundle),mcast){
    protected ServiceDependentOsgiBundleXmlApplicationContext createApplicationContext(    BundleContext context,    String[] locations){
      return testContext;
    }
  }
;
  listener.onApplicationEvent(new SpringBundleEvent(BundleEvent.STARTING,aBundle));
  listener.onApplicationEvent(new SpringBundleEvent(BundleEvent.STOPPED,aBundle));
  mockListener.replay();
  creator.create(null);
  mockListener.verify();
  mcast.removeAllListeners();
}

Fixed version (ground truth):
public void testCreationFailureEvent(){
  EntryLookupControllingMockBundle aBundle=new RepeatingEntryLookupControllingMockBundle(null);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  MockControl mockListener=MockControl.createControl(ApplicationListener.class);
  ApplicationListener listener=(ApplicationListener)mockListener.getMock();
  mcast.addApplicationListener(listener);
  final ServiceDependentOsgiBundleXmlApplicationContext testContext=new ServiceDependentOsgiBundleXmlApplicationContext(aBundle.getContext(),META_INF_SPRING_CONTENT){
    public void create(    Runnable postAction){
      throw new RuntimeException("String_Node_Str"){
        public synchronized Throwable fillInStackTrace(){
          return null;
        }
      }
;
    }
  }
;
  ApplicationContextCreator creator=new ApplicationContextCreator(aBundle,contextMap,initMap,this.pendingRegistrationTasks,null,new ApplicationContextConfiguration(aBundle),mcast){
    protected ServiceDependentOsgiBundleXmlApplicationContext createApplicationContext(    BundleContext context,    String[] locations){
      return testContext;
    }
  }
;
  listener.onApplicationEvent(new SpringBundleEvent(BundleEvent.STARTING,aBundle));
  listener.onApplicationEvent(new SpringBundleEvent(BundleEvent.STOPPED,aBundle));
  mockListener.replay();
  creator.create(null);
  mockListener.verify();
  mcast.removeAllListeners();
}
Program: 152964
Project: 152964
Buggy source:
public void testContextIsPlacedIntoPendingMapPriorToRefreshAndMovedAfterwards(){
  EntryLookupControllingMockBundle aBundle=new EntryLookupControllingMockBundle(null);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  final MapTestingBundleXmlApplicationContext testingContext=new MapTestingBundleXmlApplicationContext(aBundle.getContext(),META_INF_SPRING_CONTENT);
  ApplicationContextCreator creator=new ApplicationContextCreator(aBundle,contextMap,initMap,this.pendingRegistrationTasks,null,new ApplicationContextConfiguration(aBundle),mcast){
    protected ServiceDependentOsgiBundleXmlApplicationContext createApplicationContext(    BundleContext context,    String[] locations){
      return testingContext;
    }
  }
;
  creator.create(null);
  assertTrue("String_Node_Str",testingContext.isRefreshed);
  Long key=new Long(0);
  assertFalse(initMap.containsKey(key));
  assertTrue(contextMap.containsKey(key));
  assertEquals("String_Node_Str",testingContext,contextMap.get(key));
}

Fixed version (ground truth):
public void testContextIsPlacedIntoPendingMapPriorToRefreshAndMovedAfterwards(){
  EntryLookupControllingMockBundle aBundle=new RepeatingEntryLookupControllingMockBundle(null);
  aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
  final MapTestingBundleXmlApplicationContext testingContext=new MapTestingBundleXmlApplicationContext(aBundle.getContext(),META_INF_SPRING_CONTENT);
  ApplicationContextCreator creator=new ApplicationContextCreator(aBundle,contextMap,initMap,this.pendingRegistrationTasks,null,new ApplicationContextConfiguration(aBundle),mcast){
    protected ServiceDependentOsgiBundleXmlApplicationContext createApplicationContext(    BundleContext context,    String[] locations){
      return testingContext;
    }
  }
;
  creator.create(null);
  assertTrue("String_Node_Str",testingContext.isRefreshed);
  Long key=new Long(0);
  assertFalse(initMap.containsKey(key));
  assertTrue(contextMap.containsKey(key));
  assertEquals("String_Node_Str",testingContext,contextMap.get(key));
}
Program: 152965
Project: 152965
Buggy source:
private Enumeration createEnumerationOver(String[] entries){
  return new ArrayEnumerator(entries);
}

Fixed version (ground truth):
protected Enumeration createEnumerationOver(String[] entries){
  return new ArrayEnumerator(entries);
}
Program: 152966
Project: 152966
Buggy source:
private Version getVersion(String stmt,String packageName){
  if (stmt != null) {
    for (StringTokenizer strok=new StringTokenizer(stmt,"String_Node_Str"); strok.hasMoreTokens(); ) {
      StringTokenizer parts=new StringTokenizer(strok.nextToken(),"String_Node_Str");
      String pkg=parts.nextToken().trim();
      if (pkg.equals(packageName)) {
        Version version=Version.emptyVersion;
        for (; parts.hasMoreTokens(); ) {
          String modifier=parts.nextToken().trim();
          if (modifier.startsWith("String_Node_Str")) {
            String vstr=modifier.substring(modifier.indexOf("String_Node_Str") + 1).trim();
            if (vstr.startsWith("String_Node_Str"))             vstr=vstr.substring(1);
            if (vstr.endsWith("String_Node_Str"))             vstr=vstr.substring(0,vstr.length() - 2);
            version=Version.parseVersion(vstr);
          }
        }
        return version;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private static Version getVersion(String stmt,String packageName){
  if (stmt != null) {
    for (StringTokenizer strok=new StringTokenizer(stmt,"String_Node_Str"); strok.hasMoreTokens(); ) {
      StringTokenizer parts=new StringTokenizer(strok.nextToken(),"String_Node_Str");
      String pkg=parts.nextToken().trim();
      if (pkg.equals(packageName)) {
        Version version=Version.emptyVersion;
        for (; parts.hasMoreTokens(); ) {
          String modifier=parts.nextToken().trim();
          if (modifier.startsWith("String_Node_Str")) {
            String vstr=modifier.substring(modifier.indexOf("String_Node_Str") + 1).trim();
            if (vstr.startsWith("String_Node_Str"))             vstr=vstr.substring(1);
            if (vstr.endsWith("String_Node_Str"))             vstr=vstr.substring(0,vstr.length() - 2);
            version=Version.parseVersion(vstr);
          }
        }
        return version;
      }
    }
  }
  return null;
}