Bug 56059 - Older TestBeans incompatible with 2.11 when using TextAreaEditor
Summary: Older TestBeans incompatible with 2.11 when using TextAreaEditor
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.11
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-24 08:42 UTC by real_thuri
Modified: 2014-01-24 20:15 UTC (History)
0 users



Attachments
Zip containing the stacktrace and both potential patches (2.46 KB, application/zip)
2014-01-24 08:42 UTC, real_thuri
Details

Note You need to log in before you can comment on or make changes to this bug.
Description real_thuri 2014-01-24 08:42:23 UTC
Created attachment 31250 [details]
Zip containing the stacktrace and both potential patches

When using an JMeter Plugin in 2.11 that is based on the TestBean concept and defines a Property in its BeanInfo class using 
    p = property("text", TypeEditor.TextAreaEditor);
a NullPointer Exception is thrown when loading a Testplan in GUI mode that makes use of the plugin. (see StackTrace in the attachment)

The Problem seems to be that 
org.apache.jmeter.gui.util.JSyntaxTextArea#setLanguage(String language) 
is called with a null value as argument.

That originates from a missing 
    p.setValue(TEXT_LANGUAGE, <some string>)
in the BeanInfo class.

There are two potential solutions to this.
1.) throw an IllegalArgumentException in setLanguage if the provided argument is null specifying a detailed error message so the plugin developers can check their code an get it done quickly (see exception.patch in attachment)

2.) use the same default value as for the case that the map lookup returns no value. This would prevent breaking existing Testplans but the problem won't be noticed by anyone (see default.patch in attachment)
Comment 1 Sebb 2014-01-24 18:59:52 UTC
I think it would be best to allow the test to continue, but ideally to log a warning if the value has not been set.

Unfortunately the code that detects the problem does not have access to the details of the caller. It looks to be very difficult to work round this.
Comment 2 Sebb 2014-01-24 20:15:21 UTC
Thanks; patch applied with minor tweaks:

URL: http://svn.apache.org/r1561134
Log:
Older TestBeans incompatible with 2.11 when using TextAreaEditor
Bugzilla Id: 56059

Added:
    jmeter/trunk/test/src/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java   (with props)
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/JSyntaxTextArea.java
    jmeter/trunk/xdocs/changes.xml
Comment 3 The ASF infrastructure team 2022-09-24 20:37:56 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3308