Index: javax/swing/JTextArea.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/JTextArea.java,v retrieving revision 1.5 diff -u -r1.5 JTextArea.java --- javax/swing/JTextArea.java 27 Sep 2004 07:11:04 -0000 1.5 +++ javax/swing/JTextArea.java 27 Sep 2004 13:00:28 -0000 @@ -436,25 +436,25 @@ */ public void insert(String string, int position) { - // Retrieve the document model. - Document document = getDocument(); - - // Check the model and string for validity. - if (document == null - || string == null - || string.length() == 0) - return; + // Retrieve the document model. + Document doc = getDocument(); - // Insert the text into the model. - try - { - document.insertString(position, string, null); - } - catch (BadLocationException exception) - { - throw new IllegalArgumentException("The supplied position, " - + position + ", was invalid."); - } + // Check the model and string for validity. + if (doc == null + || string == null + || string.length() == 0) + return; + + // Insert the text into the model. + try + { + doc.insertString(position, string, null); + } + catch (BadLocationException e) + { + throw new IllegalArgumentException("The supplied position, " + + position + ", was invalid."); + } } public void replaceRange(String text, int start, int end)