Program: 103239
Project: 103239
Buggy source:
public void insertUpdate(DocumentEvent event){
  if (!this.isEnabled)   return;
  try {
    Document doc=event.getDocument();
    String text=doc.getText(0,doc.getLength());
    if (event.getLength() == 1) {
      char changeChar=text.charAt(event.getOffset());
      if (getCaretPosition() == text.length() - 1) {
        if (!Character.isLetter(changeChar)) {
          Word last=Word.getWord(text,text.length() - 1,true);
          format(last);
        }
 else {
          clearUnderlining(event.getOffset(),event.getOffset() + 1);
        }
      }
 else {
        if (Character.isLetter(changeChar)) {
          Word changed;
          int previousIndex=Math.max(0,event.getOffset() - 1);
          if (Character.isLetter(text.charAt(previousIndex)))           changed=Word.getWord(text,event.getOffset(),true);
 else           changed=Word.getWord(text,event.getOffset(),false);
          format(changed);
        }
 else {
          Word firstWord=Word.getWord(text,event.getOffset(),true);
          Word secondWord=Word.getWord(text,event.getOffset() + 1,false);
          format(firstWord);
          format(secondWord);
        }
      }
    }
 else {
      Word changed=Word.getWord(text,event.getOffset(),true);
      int wordStart=changed.getStart();
      while (wordStart < event.getOffset() + event.getLength()) {
        format(changed);
        int end=Math.min(changed.getStart() + changed.getText().length() + 1,text.length());
        changed=Word.getWord(text,end,false);
        wordStart=end;
      }
    }
  }
 catch (  BadLocationException exc) {
    String msg="String_Node_Str";
    logger.error(msg,exc);
  }
  promptRepaint();
}

Fixed version (ground truth):
public void insertUpdate(DocumentEvent event){
  if (!this.isEnabled)   return;
  try {
    Document doc=event.getDocument();
    String text=doc.getText(0,doc.getLength());
    if (event.getLength() == 1) {
      char changeChar=text.charAt(event.getOffset());
      if (getCaretPosition() == text.length() - 1) {
        if (!Character.isLetter(changeChar)) {
          Word last=Word.getWord(text,text.length() - 1,true);
          format(last);
        }
 else {
          clearUnderlining(event.getOffset(),event.getOffset() + 1);
        }
      }
 else {
        if (Character.isLetter(changeChar)) {
          Word changed;
          int previousIndex=Math.max(0,event.getOffset() - 1);
          if (Character.isLetter(text.charAt(previousIndex)))           changed=Word.getWord(text,event.getOffset(),true);
 else           changed=Word.getWord(text,event.getOffset(),false);
          format(changed);
        }
 else {
          Word firstWord=Word.getWord(text,event.getOffset(),true);
          Word secondWord=Word.getWord(text,event.getOffset() + 1,false);
          format(firstWord);
          format(secondWord);
        }
      }
    }
 else {
      Word changed=Word.getWord(text,event.getOffset(),true);
      int wordStart=changed.getStart();
      while (wordStart < event.getOffset() + event.getLength()) {
        format(changed);
        int end=Math.min(changed.getStart() + changed.getText().length() + 1,text.length());
        changed=Word.getWord(text,end,false);
        wordStart=end;
      }
    }
  }
 catch (  BadLocationException exc) {
    String msg="String_Node_Str";
    logger.error(msg,exc);
  }
catch (  Throwable exc) {
    logger.error("String_Node_Str",exc);
  }
  promptRepaint();
}