mozilla-metrics/fhr-toolbox — pull request #4 by mreid-moz (2013-05-23 13:10:51+00:00)
Title: Catch JsonMappingException in FHR Consumer

Started seeing errors like this in the FHR Consumer logs:

2013-05-23 12:30:10,998 ERROR com.mozilla.fhr.consumer.FHRConsumer: IO error while storing to data sink
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.fasterxml.jackson.databind.node.ObjectNode out of VALUE_NUMBER_FLOAT token
at [Source: java.io.StringReader@576eeb9; line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:163)
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:588)
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:582)
at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer$ObjectDeserializer.deserialize(JsonNodeDeserializer.java:94)
at com.fasterxml.jackson.databind.deser.std.JsonNodeDeserializer$ObjectDeserializer.deserialize(JsonNodeDeserializer.java:72)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2575)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1805)
at com.mozilla.fhr.consumer.FHRConsumer$FHRConsumerWorker.call(FHRConsumer.java:224)
at com.mozilla.fhr.consumer.FHRConsumer$FHRConsumerWorker.call(FHRConsumer.java:203)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

So added a catch for that Exception, as well as logging the bad payloads at "debug" verbosity.