Program: 45035
Project: 45035
Buggy source:
/** 
 * Creates and returns an instance of AbstractFile for the given FileURL and uses the specified parent file (if any) as the created file's parent. <p>Specifying the file parent if an instance already exists allows to recycle the AbstractFile instance instead of creating a new one when the parent file is requested.
 * @param fileURL the file URL representing the file to be created
 * @param parent the parent AbstractFile to use as the created file's parent, can be <code>null</code>
 * @throws java.io.IOException if something went wrong during file creation.
 */
public static AbstractFile getFile(FileURL fileURL,AbstractFile parent) throws IOException {
  PathTokenizer pt=new PathTokenizer(fileURL.getPath(),fileURL.getPathSeparator(),false);
  AbstractFile currentFile=null;
  boolean lastFileResolved=false;
  while (pt.hasMoreFilenames()) {
    if (isArchiveFilename(pt.nextFilename())) {
      String currentPath=FileToolkit.removeTrailingSeparator(pt.getCurrentPath());
      if (currentFile == null || !(currentFile instanceof AbstractArchiveFile)) {
        FileURL clonedURL=(FileURL)fileURL.clone();
        clonedURL.setPath(currentPath);
        currentFile=wrapArchive(createRawFile(clonedURL));
        lastFileResolved=true;
      }
 else {
        AbstractFile tempEntryFile=((AbstractArchiveFile)currentFile).getArchiveEntryFile(FileToolkit.removeLeadingSeparator(currentPath.substring(currentFile.getURL().getPath().length(),currentPath.length())));
        if (tempEntryFile instanceof AbstractArchiveFile) {
          currentFile=tempEntryFile;
          lastFileResolved=true;
        }
 else {
          lastFileResolved=false;
        }
      }
    }
 else {
      lastFileResolved=false;
    }
  }
  if (!lastFileResolved) {
    String currentPath=pt.getCurrentPath();
    if (currentFile == null || !(currentFile instanceof AbstractArchiveFile)) {
      FileURL clonedURL=(FileURL)fileURL.clone();
      clonedURL.setPath(currentPath);
      currentFile=createRawFile(clonedURL);
    }
 else {
      currentFile=((AbstractArchiveFile)currentFile).getArchiveEntryFile(FileToolkit.removeLeadingSeparator(currentPath.substring(currentFile.getURL().getPath().length(),currentPath.length())));
    }
  }
  if (parent != null)   currentFile.setParent(parent);
  return currentFile;
}

Fixed version (ground truth):
/** 
 * Creates and returns an instance of AbstractFile for the given FileURL and uses the specified parent file (if any) as the created file's parent. <p>Specifying the file parent if an instance already exists allows to recycle the AbstractFile instance instead of creating a new one when the parent file is requested.
 * @param fileURL the file URL representing the file to be created
 * @param parent the parent AbstractFile to use as the created file's parent, can be <code>null</code>
 * @return an instance of {@link AbstractFile} for the given {@link FileURL}.
 * @throws java.io.IOException if something went wrong during file creation.
 */
public static AbstractFile getFile(FileURL fileURL,AbstractFile parent) throws IOException {
  PathTokenizer pt=new PathTokenizer(fileURL.getPath(),fileURL.getPathSeparator(),false);
  AbstractFile currentFile=null;
  boolean lastFileResolved=false;
  while (pt.hasMoreFilenames()) {
    if (isArchiveFilename(pt.nextFilename())) {
      String currentPath=FileToolkit.removeTrailingSeparator(pt.getCurrentPath());
      if (currentFile == null || !(currentFile instanceof AbstractArchiveFile)) {
        FileURL clonedURL=(FileURL)fileURL.clone();
        clonedURL.setPath(currentPath);
        currentFile=wrapArchive(createRawFile(clonedURL));
        lastFileResolved=true;
      }
 else {
        AbstractFile tempEntryFile=((AbstractArchiveFile)currentFile).getArchiveEntryFile(FileToolkit.removeLeadingSeparator(currentPath.substring(currentFile.getURL().getPath().length(),currentPath.length())));
        if (tempEntryFile instanceof AbstractArchiveFile) {
          currentFile=tempEntryFile;
          lastFileResolved=true;
        }
 else {
          lastFileResolved=false;
        }
      }
    }
 else {
      lastFileResolved=false;
    }
  }
  if (!lastFileResolved) {
    String currentPath=pt.getCurrentPath();
    if (currentFile == null || !(currentFile instanceof AbstractArchiveFile)) {
      FileURL clonedURL=(FileURL)fileURL.clone();
      clonedURL.setPath(currentPath);
      currentFile=createRawFile(clonedURL);
    }
 else {
      currentFile=((AbstractArchiveFile)currentFile).getArchiveEntryFile(FileToolkit.removeLeadingSeparator(currentPath.substring(currentFile.getURL().getPath().length(),currentPath.length())));
    }
  }
  if (parent != null)   currentFile.setParent(parent);
  return currentFile;
}