Wenjun Ruan created ZOOKEEPER-4380: -------------------------------------- Summary: Avoid NPE in RateLogger#rateLimitLog Key: ZOOKEEPER-4380 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4380 Project: ZooKeeper Issue Type: Improvement Reporter: Wenjun Ruan
The newMsg may cause NPE {code:java} /** * In addition to the message, it also takes a value. */ public void rateLimitLog(String newMsg, String value) { long now = Time.currentElapsedTime(); if (newMsg.equals(msg)) { ++count; this.value = value; if (now - timestamp >= LOG_INTERVAL) { flush(); msg = newMsg; timestamp = now; this.value = value; } } else { flush(); msg = newMsg; this.value = value; timestamp = now; LOG.warn("Message:{} Value:{}", msg, value); } } {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)