String word = null; try { word = document.getText(currentWordPos, currentWordEnd-currentWordPos); } catch (BadLocationException ex) {
wordCount++;  first = false;  if (nextWordPos == -1)
  public String nextWord() {    if (!first) {      currentWordPos = nextWordPos;      currentWordEnd = getNextWordEnd(text, currentWordPos);      nextWordPos = getNextWordStart(text, currentWordEnd+1);      int current = sentanceIterator.current();      if (current == currentWordPos)        startsSentance = true;      else {        startsSentance = false;        if (currentWordEnd > current)          sentanceIterator.next();      }    }    //The nextWordPos has already been populated    String word = null;    try {      word = document.getText(currentWordPos, currentWordEnd-currentWordPos);    } catch (BadLocationException ex) {      moreTokens = false;    }    wordCount++;    first = false;    if (nextWordPos == -1)      moreTokens = false;    return word;  }