Skip to content
Permalink
Browse files
Setup GUI in Swing thread
This seems to be the right thing to do and it fixes an exception, that happens
on startup after the code for Bug 63620 has been incorporated.

The exception was:

ERROR o.a.j.g.u.JSyntaxTextArea: Dubious problem while setting text to SOMETHING
java.lang.NullPointerException: null
        at org.fife.ui.rsyntaxtextarea.WrappedSyntaxView.updateMetrics(WrappedSyntaxView.java:1081) ~[rsyntaxtextarea-3.1.3.jar:3.1.3]
        at org.fife.ui.rsyntaxtextarea.WrappedSyntaxView.getPreferredSpan(WrappedSyntaxView.java:618) ~[rsyntaxtextarea-3.1.3.jar:3.1.3]
        at org.fife.ui.rsyntaxtextarea.WrappedSyntaxView.calculateBreakPosition(WrappedSyntaxView.java:114) ~[rsyntaxtextarea-3.1.3.jar:3.1.3]
        at org.fife.ui.rsyntaxtextarea.WrappedSyntaxView$WrappedLine.calculateLineCount(WrappedSyntaxView.java:1191) ~[rsyntaxtextarea-3.1.3.jar:3.1.3]
        at org.fife.ui.rsyntaxtextarea.WrappedSyntaxView$WrappedLine.handleDocumentEvent(WrappedSyntaxView.java:1440) ~[rsyntaxtextarea-3.1.3.jar:3.1.3]
        at org.fife.ui.rsyntaxtextarea.WrappedSyntaxView$WrappedLine.insertUpdate(WrappedSyntaxView.java:1464) ~[rsyntaxtextarea-3.1.3.jar:3.1.3]
        at org.fife.ui.rsyntaxtextarea.WrappedSyntaxView.insertUpdate(WrappedSyntaxView.java:705) ~[rsyntaxtextarea-3.1.3.jar:3.1.3]
        at javax.swing.plaf.basic.BasicTextUI$RootView.insertUpdate(BasicTextUI.java:1706) ~[?:?]
        at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.insertUpdate(BasicTextUI.java:1965) ~[?:?]
        at javax.swing.text.AbstractDocument.fireInsertUpdate(AbstractDocument.java:203) ~[?:?]
        at org.fife.ui.rsyntaxtextarea.RSyntaxDocument.fireInsertUpdate(RSyntaxDocument.java:187) ~[rsyntaxtextarea-3.1.3.jar:3.1.3]
        at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:757) ~[?:?]
        at javax.swing.text.AbstractDocument.insertString(AbstractDocument.java:716) ~[?:?]
        at javax.swing.text.PlainDocument.insertString(PlainDocument.java:131) ~[?:?]
        at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:675) ~[?:?]
        at javax.swing.text.JTextComponent.setText(JTextComponent.java:1729) ~[?:?]
        at org.apache.jmeter.gui.util.JSyntaxTextArea.setInitialText(JSyntaxTextArea.java:296) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.testbeans.gui.TextAreaEditor.setValue(TextAreaEditor.java:112) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.setEditorValue(GenericTestBeanCustomizer.java:479) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.setObject(GenericTestBeanCustomizer.java:511) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.testbeans.gui.TestBeanGUI.setValues(TestBeanGUI.java:323) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.testbeans.gui.TestBeanGUI.configure(TestBeanGUI.java:307) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.gui.tree.JMeterTreeModel.addComponent(JMeterTreeModel.java:162) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:131) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree(JMeterTreeModel.java:123) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.gui.GuiPackage.addSubTree(GuiPackage.java:554) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.gui.action.Load.insertLoadedTree(Load.java:199) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.gui.action.Load.insertLoadedTree(Load.java:235) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.JMeter.startGui(JMeter.java:431) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at org.apache.jmeter.JMeter.start(JMeter.java:566) [ApacheJMeter_core.jar:5.5-SNAPSHOT]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
        at org.apache.jmeter.NewDriver.main(NewDriver.java:257)

Which seemed to happen on the main thread.

Part of [Bug 63620] Fix GUI freeze when viewing response body with long lines

Bugzilla Id: 63620
  • Loading branch information
FSchumacher committed Feb 19, 2022
1 parent bc0d31d commit c2f29ccfd1e2619ae2960c96bd54e76e2ba0e03b
Showing 1 changed file with 3 additions and 1 deletion.
@@ -54,6 +54,7 @@
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.tree.TreePath;

import org.apache.commons.cli.avalon.CLArgsParser;
@@ -563,7 +564,8 @@ public void start(String[] args) {
ReportGenerator generator = new ReportGenerator(reportFile, null);
generator.generate();
} else if (parser.getArgumentById(NONGUI_OPT) == null) { // not non-GUI => GUI
startGui(testFile);
String initialTestFile = testFile;
SwingUtilities.invokeAndWait(() -> startGui(initialTestFile));
startOptionalServers();
} else { // NON-GUI must be true
extractAndSetReportOutputFolder(parser, deleteResultFile);

0 comments on commit c2f29cc

Please sign in to comment.