t0xa / gelfj

Graylog Extended Log Format (GELF) implementation in Java and log4j appender without any dependencies.
https://github.com/t0xa/gelfj/wiki
Other
186 stars 116 forks source link

GelfMessage#setAdditionalFields() modifies original map #79

Closed bernd closed 10 years ago

bernd commented 10 years ago

The setAdditionalFields() method stores the original map in this.additionalFields and the addField() method (and others) modifies that map later. This can lead to concurrency problems and breaks if an immutable map is passed as parameter.

    public void setAdditonalFields(Map<String, Object> additonalFields) {
        this.additonalFields = additonalFields;
    }

    public GelfMessage addField(String key, String value) {
        getAdditonalFields().put(key, value);
        return this;
    }
t0xa commented 10 years ago

Hello Bernd,

Thanks for reporting. I've added fix and added test. Could you please do a peer review.

Thx, Antoine

bernd commented 10 years ago

Looks good to me! Thank you! :grinning:

t0xa commented 10 years ago

Do you need me to release version with this fix?

On Thu, Aug 14, 2014 at 2:57 PM, Bernd Ahlers notifications@github.com wrote:

Looks good to me! Thank you! [image: :grinning:]

— Reply to this email directly or view it on GitHub https://github.com/t0xa/gelfj/issues/79#issuecomment-52186125.

Vriendelijke groeten, Anton Yakimov

bernd commented 10 years ago

No, it's not urgent. Thanks for asking though! :)