Bug 59075

Summary: JMS Publisher: NumberFormatException is thrown is priority or expiration fields are empty
Product: JMeter - Now in Github Reporter: mchassagneux
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: major CC: p.mouawad
Priority: P2    
Version: 2.13   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Add default value to mandatory fields
Example
Test plan

Description mchassagneux 2016-02-26 11:35:43 UTC
Created attachment 33598 [details]
Add default value to mandatory fields

As this 2 fields ( expiration & priority ) are mandatory, I modify their init value by default value.
Comment 1 Sebb 2016-02-26 15:53:59 UTC
Thanks for the patch.

What is the rationale for choosing these particular default values?

If there is not particular best choice it's not a good idea to provide defaults; the user should be forced to choose.


Note: the documentation should ideally also be updated.
Comment 2 mchassagneux 2016-02-26 17:28:42 UTC
It's not my point of view, a default value is not absolutely the best value... but if you really want the user choose is own value, it's could be interresting to indicate which field are mandatory in the GUI (like a * or a comment), or may be indicate a better error when you forget to fill this properties. Because :impossible de cast "" as Integer is not rly user friendly.
Comment 3 Philippe Mouawad 2016-02-26 21:04:08 UTC
(In reply to maxime.chassagneux from comment #2)
> It's not my point of view, a default value is not absolutely the best
> value... but if you really want the user choose is own value, it's could be
> interresting to indicate which field are mandatory in the GUI (like a * or a
> comment), 
That would be an other enhancement proposal. Patches are welcome although work is huge.

or may be indicate a better error when you forget to fill this
> properties. Because :impossible de cast "" as Integer is not rly user
> friendly.

In what case do you get this exception ?
Could you provide jmeter.log file ?

As per code:
https://github.com/apache/jmeter/blob/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java#L519
https://github.com/apache/jmeter/blob/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java#L523

For me default values are set when there is an empty value.


PS : When you submit a patch, either provide a Github PR or a fully fledged patch file that can be applied using :
 patch -p1 < patchfile.patch
Comment 4 mchassagneux 2016-02-29 09:22:46 UTC
Created attachment 33612 [details]
Example
Comment 5 mchassagneux 2016-02-29 09:24:20 UTC

This is the problem, no stack trace, no error in the jmeter.log to help the user to find which field is missing.
Just this :

Nom d'unité : Send 1-1
Date début échantillon : 2016-02-29 10:17:09 CET
Temps de réponse : 0
Temps établissement connexion : 0
Latence : 0
Taille en octets : 0
Taille de l'entête en octets : 0
Taille du corps en octets : 0
Compteur échantillon : 1
Compteur erreur: 1
Type de données ("text"|"bin"|""): 
Code de retour : 000
Message de retour : java.lang.NumberFormatException: For input string: ""
Comment 6 UbikLoadPack support 2016-02-29 09:27:11 UTC
Hi,
But it is strange as when the fields are empty, numerical default values are sent.
Are you sure they are empty here ?
Can you attach the test plan ?

Are you sure the NumberFormatException concerns priority and expiration ?
Thanks
Comment 7 mchassagneux 2016-02-29 09:28:58 UTC
Created attachment 33613 [details]
Test plan
Comment 8 mchassagneux 2016-02-29 09:31:56 UTC
Yes I'm sure there are empty ( and it's the case for a new default sampler)
And yes it's concern these fields, when I put values, it's OK.
Comment 9 UbikLoadPack support 2016-02-29 09:34:47 UTC
Ok, I see the problem.
I will submit a patch this day.
Regards
Comment 10 Philippe Mouawad 2016-02-29 12:18:50 UTC
Author: pmouawad
Date: Mon Feb 29 12:16:39 2016
New Revision: 1732882

URL: http://svn.apache.org/viewvc?rev=1732882&view=rev
Log:
Bug 59075 - JMS Publisher: NumberFormatException is thrown is priority or expiration fields are empty
Bugzilla Id: 59075

Modified:
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
    jmeter/trunk/xdocs/changes.xml
Comment 11 Philippe Mouawad 2016-02-29 12:20:10 UTC
Hi Maxime,
Could you get in few minutes last nightly build (which is now ready to use as is since yesterday), it is currently being generated.


If bug is fixed please leave a comment, if not reopen the bug.
Thanks
Comment 12 mchassagneux 2016-03-01 08:49:32 UTC
I just merged the last git branch and this bug is now fix. 

Tanks again !!!!
Comment 13 The ASF infrastructure team 2022-09-24 20:38:02 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/3858