Program: 45131
Project: 45131
Buggy source:
/** 
 * Returns the specified command's tokens after replacing keywords by the corresponding values from the specified files.
 * @param files file from which to retrieve keyword substitution values.
 * @return the specified command's tokens after replacing keywords by the corresponding values from the specified files.
 */
public static String[] getTokens(String command,AbstractFile[] files){
  Vector tokens;
  char[] buffer;
  StringBuffer currentToken;
  boolean isInQuotes;
  tokens=new Vector();
  command=command.trim();
  currentToken=new StringBuffer(command.length());
  buffer=command.toCharArray();
  isInQuotes=false;
  for (int i=0; i < command.length(); i++) {
    if (buffer[i] == '\"') {
      currentToken.append(buffer[i]);
      isInQuotes=!isInQuotes;
    }
 else     if (buffer[i] == '\\') {
      if (i + 1 != command.length())       currentToken.append(buffer[++i]);
    }
 else     if (buffer[i] == ' ' && !isInQuotes) {
      while (i + 1 < command.length() && buffer[i + 1] == ' ')       i++;
      tokens.add(currentToken.toString());
      currentToken.setLength(0);
    }
 else     if (buffer[i] == KEYWORD_HEADER) {
      if (files == null)       currentToken.append(KEYWORD_HEADER);
 else       if (++i == buffer.length)       currentToken.append(KEYWORD_HEADER);
 else       if (isLegalKeyword(buffer[i])) {
        currentToken.append(getKeywordReplacement(buffer[i],files[0]));
        if (buffer[i] != KEYWORD_VM_PATH) {
          if (!isInQuotes && files.length != 1) {
            tokens.add(currentToken.toString());
            currentToken.setLength(0);
          }
          for (int j=1; j < files.length; j++) {
            if (isInQuotes) {
              currentToken.append(' ');
              currentToken.append(getKeywordReplacement(buffer[i],files[j]));
            }
 else             if (j != files.length - 1)             tokens.add(getKeywordReplacement(buffer[i],files[j]));
 else             currentToken.append(getKeywordReplacement(buffer[i],files[j]));
          }
        }
      }
 else {
        currentToken.append(KEYWORD_HEADER);
        currentToken.append(buffer[i]);
      }
    }
 else     currentToken.append(buffer[i]);
  }
  if (currentToken.length() != 0)   tokens.add(currentToken.toString());
  if (tokens.size() == 0)   return new String[]{"String_Node_Str"};
  return (String[])tokens.toArray(new String[tokens.size()]);
}

Fixed version (ground truth):
/** 
 * Returns the specified command's tokens after replacing keywords by the corresponding values from the specified files.
 * @param command command to tokenize.
 * @param files   file from which to retrieve keyword substitution values.
 * @return         the specified command's tokens after replacing keywords by the corresponding values from the specified files.
 */
public static String[] getTokens(String command,AbstractFile[] files){
  Vector tokens;
  char[] buffer;
  StringBuffer currentToken;
  boolean isInQuotes;
  tokens=new Vector();
  command=command.trim();
  currentToken=new StringBuffer(command.length());
  buffer=command.toCharArray();
  isInQuotes=false;
  for (int i=0; i < command.length(); i++) {
    if (buffer[i] == '\"') {
      currentToken.append(buffer[i]);
      isInQuotes=!isInQuotes;
    }
 else     if (buffer[i] == '\\') {
      if (i + 1 != command.length())       currentToken.append(buffer[++i]);
    }
 else     if (buffer[i] == ' ' && !isInQuotes) {
      while (i + 1 < command.length() && buffer[i + 1] == ' ')       i++;
      tokens.add(currentToken.toString());
      currentToken.setLength(0);
    }
 else     if (buffer[i] == KEYWORD_HEADER) {
      if (files == null)       currentToken.append(KEYWORD_HEADER);
 else       if (++i == buffer.length)       currentToken.append(KEYWORD_HEADER);
 else       if (isLegalKeyword(buffer[i])) {
        currentToken.append(getKeywordReplacement(buffer[i],files[0]));
        if (buffer[i] != KEYWORD_VM_PATH) {
          if (!isInQuotes && files.length != 1) {
            tokens.add(currentToken.toString());
            currentToken.setLength(0);
          }
          for (int j=1; j < files.length; j++) {
            if (isInQuotes) {
              currentToken.append(' ');
              currentToken.append(getKeywordReplacement(buffer[i],files[j]));
            }
 else             if (j != files.length - 1)             tokens.add(getKeywordReplacement(buffer[i],files[j]));
 else             currentToken.append(getKeywordReplacement(buffer[i],files[j]));
          }
        }
      }
 else {
        currentToken.append(KEYWORD_HEADER);
        currentToken.append(buffer[i]);
      }
    }
 else     currentToken.append(buffer[i]);
  }
  if (currentToken.length() != 0)   tokens.add(currentToken.toString());
  if (tokens.size() == 0)   return new String[]{"String_Node_Str"};
  return (String[])tokens.toArray(new String[tokens.size()]);
}