This is an automated email from the ASF dual-hosted git repository.
fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git
The following commit(s) were added to refs/heads/master by this push:
new 17cbc7b Catch BadLocationException on setting text
17cbc7b is described below
commit 17cbc7b5b1e20814d5d47742bdcb50bb2866798e
Author: Felix Schumacher <[email protected]>
AuthorDate: Tue Aug 17 10:48:21 2021 +0200
Catch BadLocationException on setting text
This exception is not expected here, but reported in bug 65494.
Let us catch it and see, if the problem described in that bug vanishes.
Bugzilla Id: 65494
---
.../main/java/org/apache/jmeter/gui/util/JSyntaxTextArea.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git
a/src/core/src/main/java/org/apache/jmeter/gui/util/JSyntaxTextArea.java
b/src/core/src/main/java/org/apache/jmeter/gui/util/JSyntaxTextArea.java
index 6cf9d28..12436cb 100644
--- a/src/core/src/main/java/org/apache/jmeter/gui/util/JSyntaxTextArea.java
+++ b/src/core/src/main/java/org/apache/jmeter/gui/util/JSyntaxTextArea.java
@@ -27,6 +27,7 @@ import java.util.Properties;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
+import javax.swing.text.BadLocationException;
import org.apache.commons.lang3.StringUtils;
import org.apache.jmeter.gui.action.LookAndFeelCommand;
@@ -290,7 +291,13 @@ public class JSyntaxTextArea extends RSyntaxTextArea {
* The initial text to be set
*/
public void setInitialText(String string) {
- setText(StringUtils.defaultString(string, ""));
+ try {
+ setText(StringUtils.defaultString(string, ""));
+ } catch (Exception e) {
+ if (e instanceof BadLocationException) {
+ log.error("Dubious problem while setting text to {}", string,
e);
+ }
+ }
discardAllEdits();
}