Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Adding a non-string value to the MDC can cause the app to hang #96

Open
afoerster opened this issue Feb 6, 2019 · 0 comments
Open

Adding a non-string value to the MDC can cause the app to hang #96

afoerster opened this issue Feb 6, 2019 · 0 comments

Comments

@afoerster
Copy link
Contributor

When using the HttpAppender adding a non-string value to the MDC can cause the app to hang.

The error:

Exception in thread "HTTP appender dispatcher" java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
	at io.phdata.pulse.log.HttpAppender$Dispatcher.flush(HttpAppender.java:357)
	at io.phdata.pulse.log.HttpAppender$Dispatcher.run(HttpAppender.java:341)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
	at io.phdata.pulse.log.JsonParser.marshallEventInternal(JsonParser.java:68)
	at io.phdata.pulse.log.JsonParser.marshallArray(JsonParser.java:24)
	at io.phdata.pulse.log.HttpAppender$Dispatcher.flush(HttpAppender.java:355)

The location:

      for (Map.Entry<String, String> entry : props) {
        jg.writeStringField(entry.getKey(), entry.getValue());
      }

I think the easy fix is to just call toString on the entry.getValue(), I don't see any downsides to this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant