Program: 28319
Project: 28319
Buggy source:
/** 
 * Recursively find all files represented by path with wild-card character 
 * @param pathPattern path with wild-card character ASTERISK
 * @return List<File> all files whose paths match the pattern 
 */
public List<File> getFiles(String pathPattern){
  List<File> retrievedFiles=new LinkedList<File>();
  int asteriskIndex=pathPattern.indexOf(ASTERISK);
  if (asteriskIndex < 0) {
    return getAllChildFiles(new File(pathPattern));
  }
  int numTries=0;
  while (numTries < 2) {
    String head=pathPattern.substring(0,asteriskIndex);
    String tail=(asteriskIndex < pathPattern.length() - 1 ? pathPattern.substring(asteriskIndex + 1) : "String_Node_Str");
    File parent=(new File(head + "String_Node_Str")).getParentFile();
    if (parent == null) {
      if (_log.isLoggable(Level.FINEST)) {
        _log.log(Level.FINEST,_strings.get("String_Node_Str"));
      }
      parent=(new File(head + "String_Node_Str").getAbsoluteFile()).getParentFile();
    }
    String pattern=pathPattern;
    int nextSeparator=-1;
    if (tail.length() > 0) {
      nextSeparator=pathPattern.indexOf(File.separator,asteriskIndex + 1);
    }
    if (nextSeparator > asteriskIndex) {
      pattern=pathPattern.substring(0,nextSeparator);
    }
    WildCardFilenameFilter filter=new WildCardFilenameFilter(pattern);
    String childFileNames[]=parent.list(filter);
    if (childFileNames != null) {
      for (      String childName : childFileNames) {
        String path=parent.getAbsolutePath() + File.separator + childName;
        File file=new File(path);
        if (nextSeparator < asteriskIndex) {
          if (file.isFile()) {
            retrievedFiles.add(file);
          }
        }
 else {
          if (file.isDirectory()) {
            if (nextSeparator == pathPattern.length() - 1) {
              retrievedFiles.addAll(getAllChildFiles(file));
            }
 else {
              String newpattern=path + File.separator + pathPattern.substring(nextSeparator + 1);
              retrievedFiles.addAll(getFiles(newpattern));
            }
          }
        }
      }
    }
    if (!retrievedFiles.isEmpty()) {
      break;
    }
 else     if (File.separator.equals("String_Node_Str") && pathPattern.contains("String_Node_Str")) {
      pathPattern=pathPattern.replace("String_Node_Str",File.separator);
      if (_log.isLoggable(Level.FINEST)) {
        _log.log(Level.FINEST,"String_Node_Str");
      }
      numTries++;
    }
 else {
      break;
    }
  }
  return retrievedFiles;
}

Fixed version (ground truth):
/** 
 * Recursively find all files represented by path with wild-card character 
 * @param pathPattern path with wild-card character ASTERISK
 * @return List<File> all files whose paths match the pattern 
 */
public List<File> getFiles(String pathPattern){
  int asteriskIndex=pathPattern.indexOf(ASTERISK);
  if (asteriskIndex < 0) {
    return getAllChildFiles(new File(pathPattern));
  }
  List<File> retrievedFiles=new LinkedList<File>();
  int numTries=0;
  while (numTries < 2) {
    String head=pathPattern.substring(0,asteriskIndex);
    String tail=(asteriskIndex < pathPattern.length() - 1 ? pathPattern.substring(asteriskIndex + 1) : "String_Node_Str");
    File parent=(new File(head + "String_Node_Str")).getParentFile();
    if (parent == null) {
      if (_log.isLoggable(Level.FINEST)) {
        _log.log(Level.FINEST,_strings.get("String_Node_Str"));
      }
      parent=(new File(head + "String_Node_Str").getAbsoluteFile()).getParentFile();
    }
    String pattern=pathPattern;
    int nextSeparator=-1;
    if (tail.length() > 0) {
      nextSeparator=pathPattern.indexOf(File.separator,asteriskIndex + 1);
    }
    if (nextSeparator > asteriskIndex) {
      pattern=pathPattern.substring(0,nextSeparator);
    }
    WildCardFilenameFilter filter=new WildCardFilenameFilter(pattern);
    String childFileNames[]=parent.list(filter);
    if (childFileNames != null) {
      for (      String childName : childFileNames) {
        String path=parent.getAbsolutePath() + File.separator + childName;
        File file=new File(path);
        if (nextSeparator < asteriskIndex) {
          if (file.isFile()) {
            retrievedFiles.add(file);
          }
        }
 else {
          if (file.isDirectory()) {
            if (nextSeparator == pathPattern.length() - 1) {
              retrievedFiles.addAll(getAllChildFiles(file));
            }
 else {
              String newpattern=path + File.separator + pathPattern.substring(nextSeparator + 1);
              retrievedFiles.addAll(getFiles(newpattern));
            }
          }
        }
      }
    }
    if (!retrievedFiles.isEmpty()) {
      break;
    }
 else     if (File.separator.equals("String_Node_Str") && pathPattern.contains("String_Node_Str")) {
      pathPattern=pathPattern.replace("String_Node_Str",File.separator);
      if (_log.isLoggable(Level.FINEST)) {
        _log.log(Level.FINEST,"String_Node_Str");
      }
      numTries++;
    }
 else {
      break;
    }
  }
  return retrievedFiles;
}