codahale/dropwizard — pull request #128 by asinger (2012-07-03 22:02:23+00:00)
Title: Don't throw NPE for anonymous HealthChecks

This would fail:

```java

/** Anyonymous Healthchecks don't work because dropwizard
tries to add it's null canonical class name to Immutable list for
debug logging */

environment.addHealthCheck(new HealthCheck("Foo") {
@Override protected Result check() throws Exception {
final int status = jerseyClient.resource(resource).path(myPath).post(ClientResponse.class).getStatus();
if (status != 200) {
return Result.unhealthy("Foo should have returned 200");
}
return Result.healthy();
}
});
```

These are put into an ImmutableList for debug logging.

1. Only do the list building stuff for logResources, logProviders, etc
if LOG.isDebugEnabled()

2. Handle null canonical names by logging this instead:

com.yammer.metrics.core.HealthCheck("Foo")

With the name of the healtcheck in parens.