[ 
https://issues.apache.org/jira/browse/ROCKETMQ-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15887149#comment-15887149
 ] 

ASF GitHub Bot commented on ROCKETMQ-111:
-----------------------------------------

Github user Jaskey commented on the issue:

    https://github.com/apache/incubator-rocketmq/pull/69
  
    From java doc, 0 of `HOUR` is representing noon or midnight. 
    
    So this problem exists if we call the method after 12:am, the HOUR will 
becomes 12 RATHER than 0, which may result in problems.
    
    Good catch and nice job.
    
    FYI:
    
    you could try with different system clock, which will give you different 
result.
    
            Calendar cal = Calendar.getInstance();
            cal.set(Calendar.DAY_OF_MONTH, 1);
            cal.set(Calendar.HOUR, 0);
            cal.set(Calendar.MINUTE, 0);
            cal.set(Calendar.SECOND, 0);
            cal.set(Calendar.MILLISECOND, 0);
    
            System.out.println(new Date(cal.getTimeInMillis()));
            System.out.println(cal.get(Calendar.AM_PM));



> fix possible MQClientException when query message before today
> --------------------------------------------------------------
>
>                 Key: ROCKETMQ-111
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-111
>             Project: Apache RocketMQ
>          Issue Type: Bug
>          Components: rocketmq-commons
>    Affects Versions: 4.0.0-incubating
>            Reporter: Yiling Feng
>            Assignee: Jixiang Jin
>              Labels: build
>             Fix For: 4.0.0-incubating
>
>
> Using "cal.set(Calendar.HOUR,0);" when query message before today which may 
> result in :
> "org.apache.rocketmq.client.exception.MQClientException: CODE: 208 DESC: 
> query message by key finished, but no message. "
> "HOUR" is used for the 12-hour clock.This will cause the start time of the 
> query message to be greater than the creation time of the message.
> Implemenations:
> Using "HOUR_OF_DAY" instead of "HOUR"."HOUR_OF_DAY" is used for the 24-hour 
> clock.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to