Program: 101632
Project: 101632
Buggy source:
/** 
 * Take a string representation of a verse and parse it into an Array of Strings where each part is likely to be a verse part. The goal is to allow the greatest possible variations in user input. <p>Parts can be separated by pretty much anything. No distinction is made between them. While chapter and verse need to be separated, a separator is assumed between digits and non-digits. Adjacent words, (i.e. sequences of non-digits) are understood to be a book reference. If a number runs up against a book name, it is considered to be either part of the book name (i.e. it is before it) or a chapter number (i.e. it stands after it.)</p> <p>Note: ff and $ are considered to be digits.</p> <p>Note: it is not necessary for this to be a BCV (book, chapter, verse), it may just be BC, B, C, V or CV. No distinction is needed here for a number that stands alone.</p>
 * @param input The string to parse.
 * @return The string array
 * @throws NoSuchVerseException 
 */
public static String[] tokenize(String input) throws NoSuchVerseException {
  String[] args={null,null,null,null,null,null,null,null};
  int length=input.length();
  char[] normalized=new char[length * 2];
  char lastChar='0';
  char curChar=' ';
  int tokenCount=0;
  int normalizedLength=0;
  int startIndex=0;
  String token=null;
  boolean foundBoundary=false;
  for (int i=0; i < length; i++) {
    curChar=input.charAt(i);
    boolean charIsDigit=curChar == '$' || Character.isDigit(curChar) || (curChar == 'f' && (i + 1 < length ? input.charAt(i + 1) : ' ') == 'f');
    if (charIsDigit || Character.isLetter(curChar)) {
      foundBoundary=true;
      boolean charWasDigit=lastChar == '$' || Character.isDigit(lastChar) || (lastChar == 'f' && (i > 2 ? input.charAt(i - 2) : '0') == 'f');
      if (charWasDigit || Character.isLetter(lastChar)) {
        foundBoundary=false;
        if (normalizedLength > 0 && charWasDigit != charIsDigit) {
          foundBoundary=true;
        }
      }
      if (foundBoundary) {
        if (charIsDigit) {
          if (tokenCount >= args.length) {
            throw new NoSuchVerseException(Msg.VERSE_PARTS,new Object[]{input});
          }
          token=new String(normalized,startIndex,normalizedLength - startIndex);
          args[tokenCount++]=token;
          normalizedLength=0;
        }
 else {
          normalized[normalizedLength++]=' ';
        }
      }
      normalized[normalizedLength++]=curChar;
    }
    if (normalizedLength > 0) {
      lastChar=curChar;
    }
  }
  if (tokenCount >= args.length) {
    throw new NoSuchVerseException(Msg.VERSE_PARTS,new Object[]{input});
  }
  token=new String(normalized,startIndex,normalizedLength - startIndex);
  args[tokenCount++]=token;
  String[] results=new String[tokenCount];
  System.arraycopy(args,0,results,0,tokenCount);
  return results;
}

Fixed version (ground truth):
/** 
 * Take a string representation of a verse and parse it into an Array of Strings where each part is likely to be a verse part. The goal is to allow the greatest possible variations in user input. <p>Parts can be separated by pretty much anything. No distinction is made between them. While chapter and verse need to be separated, a separator is assumed between digits and non-digits. Adjacent words, (i.e. sequences of non-digits) are understood to be a book reference. If a number runs up against a book name, it is considered to be either part of the book name (i.e. it is before it) or a chapter number (i.e. it stands after it.)</p> <p>Note: ff and $ are considered to be digits.</p> <p>Note: it is not necessary for this to be a BCV (book, chapter, verse), it may just be BC, B, C, V or CV. No distinction is needed here for a number that stands alone.</p>
 * @param input The string to parse.
 * @return The string array
 * @throws NoSuchVerseException 
 */
public static String[] tokenize(String input) throws NoSuchVerseException {
  String[] args={null,null,null,null,null,null,null,null};
  int length=input.length();
  char[] normalized=new char[length * 2];
  char lastChar='0';
  char curChar=' ';
  int tokenCount=0;
  int normalizedLength=0;
  int startIndex=0;
  String token=null;
  boolean foundBoundary=false;
  for (int i=0; i < length; i++) {
    curChar=input.charAt(i);
    boolean charIsDigit=curChar == '$' || Character.isDigit(curChar) || (curChar == 'f' && (i + 1 < length ? input.charAt(i + 1) : ' ') == 'f' && !Character.isLetter(lastChar));
    if (charIsDigit || Character.isLetter(curChar)) {
      foundBoundary=true;
      boolean charWasDigit=lastChar == '$' || Character.isDigit(lastChar) || (lastChar == 'f' && (i > 2 ? input.charAt(i - 2) : '0') == 'f');
      if (charWasDigit || Character.isLetter(lastChar)) {
        foundBoundary=false;
        if (normalizedLength > 0 && charWasDigit != charIsDigit) {
          foundBoundary=true;
        }
      }
      if (foundBoundary) {
        if (charIsDigit) {
          if (tokenCount >= args.length) {
            throw new NoSuchVerseException(Msg.VERSE_PARTS,new Object[]{input});
          }
          token=new String(normalized,startIndex,normalizedLength - startIndex);
          args[tokenCount++]=token;
          normalizedLength=0;
        }
 else {
          normalized[normalizedLength++]=' ';
        }
      }
      normalized[normalizedLength++]=curChar;
    }
    if (normalizedLength > 0) {
      lastChar=curChar;
    }
  }
  if (tokenCount >= args.length) {
    throw new NoSuchVerseException(Msg.VERSE_PARTS,new Object[]{input});
  }
  token=new String(normalized,startIndex,normalizedLength - startIndex);
  args[tokenCount++]=token;
  String[] results=new String[tokenCount];
  System.arraycopy(args,0,results,0,tokenCount);
  return results;
}