+ MessageManager.getString("exception.application_test_npe"));
+ }
+ }
+
+ private void appendToTextArea(final String input)
+ {
+ if (updateConsole == false)
+ {
+ // do nothing;
+ return;
+ }
+ long time = System.nanoTime();
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ displayPipe.append(input); // change to stringBuffer
+ // displayPipe.flush();
+
+ }
+ });
+ // stderr.println("Time taken to Spawnappend:\t" + (System.nanoTime() -
+ // time)
+ // + " ns");
+ }
+
+ private String header = null;
+
+ private boolean updateConsole = false;
+
+ private synchronized void trimBuffer(boolean clear)
+ {
+ if (header == null && textArea.getLineCount() > 5)
+ {
+ try
+ {
+ header = textArea.getText(0, textArea.getLineStartOffset(5))
+ + "\nTruncated...\n";
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ // trim the buffer
+ int tlength = textArea.getDocument().getLength();
+ if (header != null)
+ {
+ if (clear || (tlength > byteslim))
+ {
+ try
+ {
+ if (!clear)
+ {
+ long time = System.nanoTime();
+ textArea.replaceRange(header, 0, tlength - bytescut);
+ // stderr.println("Time taken to cut:\t"
+ // + (System.nanoTime() - time) + " ns");
+ }
+ else
+ {
+ textArea.setText(header);
+ }
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ // lines = textArea.getLineCount();
+ }