Program: 28174
Project: 28174
Buggy source:
/** 
 * This method will return the list of web fragment in the desired order.
 */
private List<WebFragmentDescriptor> readStandardFragments(WebBundleDescriptorImpl 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(this,habitat);
      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 (((WebBundleDescriptorImpl)descriptor).getAbsoluteOrderingDescriptor() != null) {
      wfList=((WebBundleDescriptorImpl)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(WebBundleDescriptorImpl 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(this,habitat);
      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();
          wfDesc.setExists(false);
        }
      }
  finally {
        if (embeddedArchive != null) {
          embeddedArchive.close();
        }
      }
      wfDesc.setJarName(lib.substring(lib.lastIndexOf('/') + 1));
      wfList.add(wfDesc);
      descriptor.putJarNameWebFragmentNamePair(wfDesc.getJarName(),wfDesc.getName());
    }
    if (((WebBundleDescriptorImpl)descriptor).getAbsoluteOrderingDescriptor() != null) {
      wfList=((WebBundleDescriptorImpl)descriptor).getAbsoluteOrderingDescriptor().order(wfList);
    }
 else {
      OrderingDescriptor.sort(wfList);
    }
    for (    WebFragmentDescriptor wf : wfList) {
      descriptor.addOrderedLib(wf.getJarName());
    }
  }
  return wfList;
}