Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IllegalArgumentException for File properties wich allow null value #394

wants to merge 1 commit into from


Copy link

@Mingun Mingun commented Aug 2, 2018


This fix the IllegalArgumentException when TestBean class contains nullable File field (in my case field has name vendorSKPath):

2018-08-02 11:42:54,940 DEBUG o.a.j.t.g.GenericTestBeanCustomizer: Property vendorSKPath has editor class null
2018-08-02 11:42:54,941 DEBUG o.a.j.t.g.WrapperEditor: <-java.lang.String:
2018-08-02 11:42:54,941 DEBUG o.a.j.t.g.WrapperEditor: ->""
2018-08-02 11:42:54,941 DEBUG o.a.j.t.g.GenericTestBeanCustomizer: Property vendorSKPath has property editor org.apache.jmeter.testbeans.gui.FileEditor@1f236f6d
2018-08-02 11:42:54,941 DEBUG o.a.j.t.g.WrapperEditor: <-NULL:null
2018-08-02 11:42:54,941 WARN o.a.j.g.a.Load: Unexpected error. java.lang.IllegalArgumentException
java.lang.IllegalArgumentException: null
	at org.apache.jmeter.testbeans.gui.FieldStringEditor.setValue( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.testbeans.gui.WrapperEditor.setValue( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.testbeans.gui.FileEditor.setValue( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.setEditorValue( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.<init>( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.testbeans.gui.TestBeanGUI.init( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.testbeans.gui.TestBeanGUI.configure( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.tree.JMeterTreeModel.addComponent( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.tree.JMeterTreeModel.addSubTree( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.GuiPackage.addSubTree( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.action.Load.insertLoadedTree( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.action.Load.loadProjectFile( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.action.Load.loadProjectFile( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.action.LoadRecentProject.doActionAfterCheck( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.action.AbstractActionWithNoRunningTest.doAction( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.action.ActionRouter.performAction( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0( ~[ApacheJMeter_core.jar:4.1-SNAPSHOT.20180802]
	at java.awt.event.InvocationEvent.dispatch( [?:1.8.0_181]
	at java.awt.EventQueue.dispatchEventImpl( [?:1.8.0_181]
	at java.awt.EventQueue.access$500( [?:1.8.0_181]
	at java.awt.EventQueue$ [?:1.8.0_181]
	at java.awt.EventQueue$ [?:1.8.0_181]
	at Method) [?:1.8.0_181]
	at$JavaSecurityAccessImpl.doIntersectionPrivilege( [?:1.8.0_181]
	at java.awt.EventQueue.dispatchEvent( [?:1.8.0_181]
	at java.awt.EventDispatchThread.pumpOneEventForFilters( [?:1.8.0_181]
	at java.awt.EventDispatchThread.pumpEventsForFilter( [?:1.8.0_181]
	at java.awt.EventDispatchThread.pumpEventsForHierarchy( [?:1.8.0_181]
	at java.awt.EventDispatchThread.pumpEvents( [?:1.8.0_181]
	at java.awt.EventDispatchThread.pumpEvents( [?:1.8.0_181]
	at [?:1.8.0_181]
public class WithFile implements TestBean {
    File file;
    public void setFile(File file) { this.file = file; }
    public File getFile() { return file; }

public class WithFileBeanInfo extends BeanInfoSupport {
    public WithFileBeanInfo() {

Motivation and Context

Though in the comment to the class FieldStringEditor it is told that it processes only non-null strings:

* This class implements a property editor for non-null String properties that
* supports custom editing (i.e.: provides a GUI component) based on a text
* field.
* <p>
* The provided GUI is a simple text field.
class FieldStringEditor extends PropertyEditorSupport implements ActionListener, FocusListener {

the class WrappedEditor can call setValue with null:

if (value == null) {
if (!acceptsNull) {
throw new IllegalArgumentException("Null is not allowed");
text = null;
} else if (acceptsExpressions && isExpression(value)) {
text = (String) value;
} else {
// Not an expression (isn't or can't be), not null.
typeEditor.setValue(value); // may throw IllegalArgumentExc.
text = fixGetAsTextBug(typeEditor.getAsText());
if (!acceptsOther && !isATag(text)) {
throw new IllegalArgumentException("Value not allowed: '" + text + "' is not in " + Arrays.toString(getTags()));

So I think that comment also need to be updated, but I am not sure. It is possible that this class as envisioned shall not allow null and it is necessary to do fix in other place, but in case of my testing this fix works fine.

How Has This Been Tested?

Create plugin with any TestBean class with nullable File field as show above

Types of changes

  • Bug fix (non-breaking change which fixes an issue)


  • My code follows the code style of this project.
  • I have updated the documentation accordingly.

Copy link

Mingun commented Aug 7, 2018

Any news?

Copy link

Thanks for your contribution and the detailed description.
Is there any reason, that you don't want to specify a default value for a property that can be undefined? Look for example at
Other than that it seems OK to include the patch, as there is a code path into FieldStringEditor that would allow null values.

Copy link

Mingun commented Aug 8, 2018

In my plugin it is filepath that enable optional feature, so when it is undefined the feature is off.

In the next 2 weeks I will not be able to work on PR since I am on vacation, therefore if any additional work are required, then be not surprised that I will answer not soon.

Copy link

Mingun commented Sep 17, 2018

Now its ready to merge. Travis fail is unrelated to this changes

Copy link

I have modified your code slightly where I think it helps readability. It should contain no functional difference to your code. It would be nice, if you could test the next nightly or current trunk.

Thanks again for your contribution.

@asfgit asfgit closed this in 413bab2 Sep 23, 2018
Copy link

Mingun commented Sep 27, 2018


I was tested with 2c82bf3 (trunk branch). The exception does not arise any more though to set Undefined value for File property is impossible now, even though the flag {{NOT_UNDEFINED}} is not set for property. I attach 2 screenshots showing behavior of the same plugin file in versions 3.1 and 5.1:
jmeter 3 x
jmeter 5 x

Therefore this fix so far not really helps me

asfgit pushed a commit that referenced this pull request Sep 28, 2018
Copy link

OK, so we really have to explicitly allow null to help you there, right? Does the last change help you?

Copy link

Mingun commented Oct 1, 2018

Does the last change help you?

No. Actually, the problem isn't connected with this task any more, the editor has changed as a result of the сommit fc4781d which is linked to bug 61625, at first sight absolutely not relating to it

After reverting this change editor look as I expect:

@pmouawad, can you look at this? Change that you made is necessary? What strange behavior that you talk about? In my opinion, combobox works as expected and I don't represent at all how it can influence perfomance

@Mingun Mingun deleted the fix-null-in-field branch October 1, 2018 06:09
StorDm pushed a commit to etnetera/jmeter that referenced this pull request Jan 7, 2021
Based on patch by Mingun (alexander_sergey at
Closes apache#394

git-svn-id: 13f79535-47bb-0310-9956-ffa450edef68

Former-commit-id: 413bab2
StorDm pushed a commit to etnetera/jmeter that referenced this pull request Jan 7, 2021
Relates to apache#394 on github.

git-svn-id: 13f79535-47bb-0310-9956-ffa450edef68

Former-commit-id: 4f2b6d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants