[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated ZOOKEEPER-4380:
--------------------------------------
    Labels: pull-request-available  (was: )

> 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
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to