jmeter-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 62281] Cannot Load MapProperty - java.lang.NullPointerException
Date Tue, 10 Apr 2018 21:29:22 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=62281

belugabehr <dam6923@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #3 from belugabehr <dam6923@gmail.com> ---
Thank you for the quick response.

I am working on a custom component that spits out MapProperty objects.

https://github.com/apache/jmeter/blob/f2e65bc2f264d4bd7da83279dbdcf236da6edfe3/src/core/org/apache/jmeter/save/converters/MultiPropertyConverter.java#L64-L76


#####
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext
context) {
        MultiProperty prop = (MultiProperty)
createCollection(context.getRequiredType());
       
prop.setName(ConversionHelp.decode(reader.getAttribute(ConversionHelp.ATT_NAME)));
        while (reader.hasMoreChildren()) {
            reader.moveDown();
            JMeterProperty subProp = (JMeterProperty) readItem(reader, context,
prop);
            if (subProp != null) { // could be null if it has been deleted via
NameUpdater
                prop.addProperty(subProp);
            }
            reader.moveUp();
        }
        return prop;
    }

#####

The MultiProperty is created, almost certainly with the default constructor,
which does not create a default internal data structure for MapProperty.  It
then calls "addProperty" which triggers the NPE.

The unit test would be to simply create the MapProperty with the default
constructor, then call "addProperty" method on it.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Mime
View raw message