jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emilianbold <...@git.apache.org>
Subject [GitHub] jmeter issue #293: Prevent use of the same array in CollectionProperty (clos...
Date Thu, 27 Apr 2017 12:25:40 GMT
Github user emilianbold commented on the issue:

    https://github.com/apache/jmeter/pull/293
  
    Like I've said, I wanted my patch to be low-impact. Ideally normalizeList should be something
like this:
    
    ```java
        protected Collection<JMeterProperty> normalizeList(Collection<?> coll)
{
            return coll.stream()
                    .map(this::convertObject)
                    .collect(Collectors.toCollection(ArrayList::new));
        }
    ```
    
    Then normalizeMap should be like this:
    
    ```java
        protected Map<String, JMeterProperty> normalizeMap(Map<?,?> coll) {
            return coll.entrySet()
                    .stream()
                    .collect(Collectors.toMap(entry -> {
                        Object key = entry.getKey();
    
                        if (key == null) {
                            return null;
                        } else {
                            if (!(key instanceof String)) {
                                log.error("Expected key type String, found: {}", key.getClass());
                            }
                            return key.toString();
                        }
                    }, entry -> convertObject(entry.getValue())));
        }
    ```
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message