Program: 152984
Project: 152984
Buggy source:
/** 
 * Retrieves the list of xml resources which compose the application context. <p/> The org.springframework.context manifest header attribute, if present, is parsed to create an ordered list of resource names in the spring context directory for creating the application context <p/> If the org.springframework.context header is not present, the entire list of xml resources in the spring context directory will be returned.
 */
protected String[] getApplicationContextLocations(Bundle bundle){
  Dictionary manifestHeaders=bundle.getHeaders();
  String contextLocationsHeader=(String)manifestHeaders.get(CONTEXT_LOCATION_HEADER);
  if (contextLocationsHeader != null) {
    String[] locs=StringUtils.tokenizeToStringArray(contextLocationsHeader,CONTEXT_LOCATION_DELIMITERS);
    List ret=new ArrayList();
    for (int i=0; i < locs.length; i++) {
      if (bundle.getEntry(locs[i]) != null) {
        ret.add(SPRING_CONTEXT_DIRECTORY + locs[i]);
      }
    }
    if (ret.isEmpty()) {
      return null;
    }
 else {
      return addBundlePrefixTo((String[])ret.toArray());
    }
  }
 else {
    List resourceList=new ArrayList();
    Enumeration resources=bundle.findEntries(SPRING_CONTEXT_DIRECTORY,"String_Node_Str",false);
    if (resources != null) {
      for (; resources.hasMoreElements(); ) {
        resourceList.add(((URL)resources.nextElement()).getFile());
      }
    }
    if (resourceList.isEmpty()) {
      return null;
    }
 else {
      String[] list=new String[resourceList.size()];
      for (int i=0; i < list.length; i++) {
        list[i]=(String)resourceList.get(0);
      }
      return addBundlePrefixTo(list);
    }
  }
}

Fixed version (ground truth):
/** 
 * Retrieves the list of xml resources which compose the application context. <p/> The org.springframework.context manifest header attribute, if present, is parsed to create an ordered list of resource names in the spring context directory for creating the application context <p/> If the org.springframework.context header is not present, the entire list of xml resources in the spring context directory will be returned.
 */
protected String[] getApplicationContextLocations(Bundle bundle){
  Dictionary manifestHeaders=bundle.getHeaders();
  String contextLocationsHeader=(String)manifestHeaders.get(CONTEXT_LOCATION_HEADER);
  if (contextLocationsHeader != null) {
    String[] locs=StringUtils.tokenizeToStringArray(contextLocationsHeader,CONTEXT_LOCATION_DELIMITERS);
    List ret=new ArrayList();
    for (int i=0; i < locs.length; i++) {
      if (bundle.getEntry(locs[i]) != null) {
        ret.add(SPRING_CONTEXT_DIRECTORY + locs[i]);
      }
    }
    if (ret.isEmpty()) {
      return null;
    }
 else {
      return addBundlePrefixTo((String[])ret.toArray());
    }
  }
 else {
    List resourceList=new ArrayList();
    Enumeration resources=bundle.findEntries(SPRING_CONTEXT_DIRECTORY,"String_Node_Str",false);
    if (resources != null) {
      for (; resources.hasMoreElements(); ) {
        resourceList.add(((URL)resources.nextElement()).getFile());
      }
    }
    if (resourceList.isEmpty()) {
      return null;
    }
 else {
      String[] list=new String[resourceList.size()];
      for (int i=0; i < list.length; i++) {
        list[i]=(String)resourceList.get(i);
      }
      return addBundlePrefixTo(list);
    }
  }
}