if (text == null || text.length() == 0) return; DefaultDocumentEvent event = new DefaultDocumentEvent(offset, text.length(), DocumentEvent.EventType.INSERT);  try { writeLock(); UndoableEdit undo = content.insertString(offset, text); if (undo != null) event.addEdit(undo);  insertUpdate(event, attributes);  fireInsertUpdate(event); if (undo != null) fireUndoableEditUpdate(new UndoableEditEvent(this, undo));
if (documentFilter != null) documentFilter.insertString(getBypass(), offset, text, attributes); else insertStringImpl(offset, text, attributes);
  public void insertString(int offset, String text, AttributeSet attributes)    throws BadLocationException  {    // Just return when no text to insert was given.    if (text == null || text.length() == 0)      return;    DefaultDocumentEvent event =      new DefaultDocumentEvent(offset, text.length(),			       DocumentEvent.EventType.INSERT);        try      {    writeLock();    UndoableEdit undo = content.insertString(offset, text);    if (undo != null)      event.addEdit(undo);    insertUpdate(event, attributes);    fireInsertUpdate(event);    if (undo != null)      fireUndoableEditUpdate(new UndoableEditEvent(this, undo));  }    finally      {        writeUnlock();      }  }