Program: 30339
Project: 30339
Buggy source:
/** 
 * This method will return the list of web fragment in the desired order.
 */
private List<WebFragmentDescriptor> readStandardFragments(WebBundleDescriptor descriptor,ReadableArchive archive) throws IOException {
  List<WebFragmentDescriptor> wfList=new ArrayList<WebFragmentDescriptor>();
  Vector libs=getLibraries(archive);
  if (libs != null && libs.size() > 0) {
    for (int i=0; i < libs.size(); i++) {
      String lib=(String)libs.get(i);
      Archivist wfArchivist=new WebFragmentArchivist();
      wfArchivist.initializeContext(this);
      wfArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation());
      wfArchivist.setRuntimeXMLValidationLevel(this.getRuntimeXMLValidationLevel());
      wfArchivist.setAnnotationProcessingRequested(false);
      WebFragmentDescriptor wfDesc=null;
      ReadableArchive embeddedArchive=archive.getSubArchive(lib);
      try {
        if (embeddedArchive != null && wfArchivist.hasStandardDeploymentDescriptor(embeddedArchive)) {
          try {
            wfDesc=(WebFragmentDescriptor)wfArchivist.open(embeddedArchive);
          }
 catch (          SAXParseException ex) {
            IOException ioex=new IOException();
            ioex.initCause(ex);
            throw ioex;
          }
        }
 else {
          wfDesc=new WebFragmentDescriptor();
        }
      }
  finally {
        if (embeddedArchive != null) {
          embeddedArchive.close();
        }
      }
      wfDesc.setJarName(lib.substring(lib.lastIndexOf('/') + 1));
      wfList.add(wfDesc);
      descriptor.putJarNameWebFragmentNamePair(wfDesc.getJarName(),wfDesc.getName());
    }
    if (descriptor.getAbsoluteOrderingDescriptor() != null) {
      wfList=descriptor.getAbsoluteOrderingDescriptor().order(wfList);
    }
 else {
      OrderingDescriptor.sort(wfList);
    }
    for (    WebFragmentDescriptor wf : wfList) {
      descriptor.addOrderedLib(wf.getJarName());
    }
  }
  return wfList;
}

Fixed version (ground truth):
/** 
 * This method will return the list of web fragment in the desired order.
 */
private List<WebFragmentDescriptor> readStandardFragments(WebBundleDescriptor descriptor,ReadableArchive archive) throws IOException {
  List<WebFragmentDescriptor> wfList=new ArrayList<WebFragmentDescriptor>();
  Vector libs=getLibraries(archive);
  if (libs != null && libs.size() > 0) {
    for (int i=0; i < libs.size(); i++) {
      String lib=(String)libs.get(i);
      Archivist wfArchivist=new WebFragmentArchivist(habitat);
      wfArchivist.initializeContext(this);
      wfArchivist.setRuntimeXMLValidation(this.getRuntimeXMLValidation());
      wfArchivist.setRuntimeXMLValidationLevel(this.getRuntimeXMLValidationLevel());
      wfArchivist.setAnnotationProcessingRequested(false);
      WebFragmentDescriptor wfDesc=null;
      ReadableArchive embeddedArchive=archive.getSubArchive(lib);
      try {
        if (embeddedArchive != null && wfArchivist.hasStandardDeploymentDescriptor(embeddedArchive)) {
          try {
            wfDesc=(WebFragmentDescriptor)wfArchivist.open(embeddedArchive);
          }
 catch (          SAXParseException ex) {
            IOException ioex=new IOException();
            ioex.initCause(ex);
            throw ioex;
          }
        }
 else {
          wfDesc=new WebFragmentDescriptor();
        }
      }
  finally {
        if (embeddedArchive != null) {
          embeddedArchive.close();
        }
      }
      wfDesc.setJarName(lib.substring(lib.lastIndexOf('/') + 1));
      wfList.add(wfDesc);
      descriptor.putJarNameWebFragmentNamePair(wfDesc.getJarName(),wfDesc.getName());
    }
    if (descriptor.getAbsoluteOrderingDescriptor() != null) {
      wfList=descriptor.getAbsoluteOrderingDescriptor().order(wfList);
    }
 else {
      OrderingDescriptor.sort(wfList);
    }
    for (    WebFragmentDescriptor wf : wfList) {
      descriptor.addOrderedLib(wf.getJarName());
    }
  }
  return wfList;
}