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

Damien Diederen resolved ZOOKEEPER-4380.
----------------------------------------
    Fix Version/s: 3.7.1
                   3.8.0
       Resolution: Fixed

Issue resolved by pull request 1758
[https://github.com/apache/zookeeper/pull/1758]

> 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
>             Fix For: 3.8.0, 3.7.1
>
>          Time Spent: 0.5h
>  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