# Empty object returned by the asProperties method of class StormSetting

**URL:** <https://discuss.elastic.co/t/empty-object-returned-by-the-asproperties-method-of-class-stormsetting/46707>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [April 7, 2016, 3:15pm UTC](https://discuss.elastic.co/t/empty-object-returned-by-the-asproperties-method-of-class-stormsetting/46707 "2016-04-07T15:15:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hibernatexj](https://avatars.discourse-cdn.com/v4/letter/h/35a633/32.png) [@hibernatexj](https://discuss.elastic.co/u/hibernatexj)\
**Post date:** [April 7, 2016, 3:15pm UTC](https://discuss.elastic.co/t/empty-object-returned-by-the-asproperties-method-of-class-stormsetting/46707/1 "2016-04-07T15:15:15Z")

</div>

Hi ,  
The code of asProperties method of class StormSettings in elasticsearch-hadoop-2.2.0 seems has bug (Please see the following code), I guest the purpose of this method is copy the items in Map cfg to temporary object props and returned it. so in this loop , the code "props.entrySet()" should be replaced as "cfg.entrySet()" . now this method always return empty collection.  
---------------- CODE -----------------------  
@Override  
public Properties asProperties() {  
Properties props = new Properties();

```
    if (cfg != null) {
        for (Entry<Object, Object> entry : props.entrySet()) {
            if (entry.getKey() instanceof String) {
                props.put(entry.getKey().toString(), entry.getValue().toString());
            }
        }
    }
    return props;
}
```

---

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [April 7, 2016, 8:52pm UTC](https://discuss.elastic.co/t/empty-object-returned-by-the-asproperties-method-of-class-stormsetting/46707/2 "2016-04-07T20:52:37Z")

</div>

Thanks.

Raised an issue for it:

> <https://github.com/elastic/elasticsearch-hadoop/issues/733>

  
and pushed a fix in master.

Cheers,

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:25pm UTC](https://discuss.elastic.co/t/empty-object-returned-by-the-asproperties-method-of-class-stormsetting/46707/3 "2017-07-06T13:25:17Z")

</div>


