Hello Felix, Thanks for handling this PR. I was not sure about the side effect of this development. Does your analysis makes you confident about it ?
Also shouldn't we lazily init this map or at least set a capacity lower than defaults ? Regards On Sun, Jun 3, 2018 at 3:44 PM, <[email protected]> wrote: > Author: fschumacher > Date: Sun Jun 3 13:44:15 2018 > New Revision: 1832768 > > URL: http://svn.apache.org/viewvc?rev=1832768&view=rev > Log: > Prevent NPE in MapProperty. > > Initialize the backing Map when no Map was passed into constructor. > Patch by belugabehr (dam6923 at gmail.com) > > Bugzilla Id: 62281 > > Added: > > jmeter/trunk/test/src/org/apache/jmeter/testelement/property/MapPropertyTest.java > (with props) > Modified: > jmeter/trunk/src/core/org/apache/jmeter/testelement/ > property/MapProperty.java > jmeter/trunk/xdocs/changes.xml > > Modified: jmeter/trunk/src/core/org/apache/jmeter/testelement/ > property/MapProperty.java > URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/ > apache/jmeter/testelement/property/MapProperty.java?rev= > 1832768&r1=1832767&r2=1832768&view=diff > ============================================================ > ================== > --- > jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MapProperty.java > (original) > +++ > jmeter/trunk/src/core/org/apache/jmeter/testelement/property/MapProperty.java > Sun Jun 3 13:44:15 2018 > @@ -18,6 +18,7 @@ > > package org.apache.jmeter.testelement.property; > > +import java.util.HashMap; > import java.util.Map; > > import org.apache.jmeter.testelement.TestElement; > @@ -39,6 +40,7 @@ public class MapProperty extends MultiPr > > public MapProperty() { > super(); > + value = new HashMap<>(); > } > > /** {@inheritDoc} */ > > Added: jmeter/trunk/test/src/org/apache/jmeter/testelement/ > property/MapPropertyTest.java > URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/ > apache/jmeter/testelement/property/MapPropertyTest.java? > rev=1832768&view=auto > ============================================================ > ================== > --- > jmeter/trunk/test/src/org/apache/jmeter/testelement/property/MapPropertyTest.java > (added) > +++ > jmeter/trunk/test/src/org/apache/jmeter/testelement/property/MapPropertyTest.java > Sun Jun 3 13:44:15 2018 > @@ -0,0 +1,13 @@ > +package org.apache.jmeter.testelement.property; > + > +import org.junit.Test; > + > +public class MapPropertyTest { > + > + @Test > + public void testBug62281MapProperty() { > + MapProperty props = new MapProperty(); > + props.addProperty("Foo", new BooleanProperty()); > + } > + > +} > > Propchange: jmeter/trunk/test/src/org/apache/jmeter/testelement/ > property/MapPropertyTest.java > ------------------------------------------------------------ > ------------------ > svn:eol-style = native > > Modified: jmeter/trunk/xdocs/changes.xml > URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes. > xml?rev=1832768&r1=1832767&r2=1832768&view=diff > ============================================================ > ================== > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original) > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Jun 3 13:44:15 2018 > @@ -229,6 +229,7 @@ this behaviour, set <code>httpclient.res > <li><bug>62240</bug>If SampleMonitor implementation is a TestBean if > will not be initialized correctly</li> > <li><bug>62295</bug>Correct order of elements when duplicating a > selection of multiple elements.</li> > <li><bug>62397</bug>Don't break lines at commata when using JSON Path > Tester</li> > + <li><bug>62281</bug>Prevent NPE in MapProperty. Patch by belugabehr > (dam6923 at gmail.com)</li> > </ul> > > <!-- =================== Thanks =================== --> > @@ -251,6 +252,7 @@ this behaviour, set <code>httpclient.res > <li>Perze Ababa (perze.ababa at gmail.com)</li> > <li>Martha Laks (laks.martha at gmail.com)</li> > <li>Logan Mauzaize (t524467 at airfrance.fr)</li> > + <li>belugabehr (dam6923 at gmail.com)</li> > </ul> > <p>We also thank bug reporters who helped us improve JMeter.</p> > <p> > > > -- Cordialement. Philippe Mouawad.
