Bug 56059

Summary: Older TestBeans incompatible with 2.11 when using TextAreaEditor
Product: JMeter Reporter: real_thuri
Component: MainAssignee: JMeter issues mailing list <issues>
Severity: normal    
Priority: P2    
Version: 2.11   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: Zip containing the stacktrace and both potential patches

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
Older TestBeans incompatible with 2.11 when using TextAreaEditor
Bugzilla Id: 56059

    jmeter/trunk/test/src/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java   (with props)