Bug 57389 - Potential NPE in converters
Summary: Potential NPE in converters
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.12
Hardware: All All
: P2 trivial (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-22 18:27 UTC by Felix Schumacher
Modified: 2014-12-22 18:35 UTC (History)
0 users



Attachments
Fix potential NPE in converters (5.89 KB, patch)
2014-12-22 18:27 UTC, Felix Schumacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Schumacher 2014-12-22 18:27:48 UTC
Created attachment 32320 [details]
Fix potential NPE in converters

in the converters in org.apache.jmeter.save.converters there are a few possible NPE. In the method canConvert(Class) often the implementation looks like

 "return arg0.equals(SomeClass.class)"

without arg0 being checked for non-null.

I would reverse the logic to

 "return SomeClass.class.equals(arg0)"

This is null safe and should return the same values (apart from possible NPE).
Comment 1 Felix Schumacher 2014-12-22 18:35:54 UTC
Date: Mon Dec 22 18:33:59 2014
New Revision: 1647367

URL: http://svn.apache.org/r1647367
Log:
Bug 57389: Fix potential NPE in org.apache.jmeter.save.converters
Bugzilla Id: 57389

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/BooleanPropertyConverter.java
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/IntegerPropertyConverter.java
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/LongPropertyConverter.java
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/MultiPropertyConverter.java
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/SampleSaveConfigurationConverter.java
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/TestElementPropertyConverter.java
    jmeter/trunk/src/core/org/apache/jmeter/save/converters/TestResultWrapperConverter.java
    jmeter/trunk/xdocs/changes.xml