Skip to content

Commit

Permalink
Patches a potentiell NullPointer when creating the BigDecimal from th…
Browse files Browse the repository at this point in the history
…e BigInteger while writing the metric.
  • Loading branch information
stefansiegl committed Dec 6, 2017
1 parent 7abc67a commit 7c64260
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,17 +696,16 @@ private List<JsonNode> getQueues(ArrayNode queues, String nodeName) {

public void printMetric(String metricName, BigInteger metricValue, String metricType) {

String value;
if (metricValue != null) {
value = metricValue.toString();
} else {
value = "0";
BigInteger metricValueNonNull = metricValue;
if (metricValue == null) {
metricValueNonNull = new BigInteger("0");
}

if (logger.isDebugEnabled()) {
logger.debug("Sending ["
+ "] metric = " + metricPrefix + metricName + " = " + value);
+ "] metric = " + metricPrefix + metricName + " = " + metricValueNonNull.toString());
}
this.configuration.getMetricWriter().printMetric(metricPrefix + metricName, new BigDecimal(metricValue),metricType);
this.configuration.getMetricWriter().printMetric(metricPrefix + metricName, new BigDecimal(metricValueNonNull),metricType);

}

Expand Down

0 comments on commit 7c64260

Please sign in to comment.