You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Nisala Nanayakkara <ni...@gmail.com> on 2017/02/27 06:55:06 UTC

Need a clarification on logic inside RequestInfo class in Tomcat 7.0.75

Hi all,

I have gone through the the jira[1] and find out that the corresponding fix
as given here[2]. But in the jira it says that "make sure the start time
isn't zero before doing the subtraction". But in the logic it is
implemented as follows ,

long startTime = req.getStartTime();
if (getStage() == org.apache.coyote.Constants.STAGE_ENDED || startTime < 0)
{
      return 0;
} else {
      return (System.currentTimeMillis() - startTime);
}

According to this implementation, it does the subtraction even the
startTime is 0. Is it a bug ?? Am I missed something here ?

[1] - https://bz.apache.org/bugzilla/show_bug.cgi?id=60123
[2] -
https://github.com/apache/tomcat70/blob/TOMCAT_7_0_75/java/org/apache/coyote/RequestInfo.java#L129

Thanks,
Nisala

-- 

*Best Regards,Nisala Niroshana Nanayakkara,*
*Bsc. Eng Graduate | Department of Computer Science & Engineering |
University of Moratuwa | Sri Lanka*
*Software Engineer | WSO2 Lanka(pvt) Ltd *
*Mobile | +94717600022*

Re: Need a clarification on logic inside RequestInfo class in Tomcat 7.0.75

Posted by Mark Thomas <ma...@apache.org>.
On 27/02/17 06:55, Nisala Nanayakkara wrote:
> Hi all,
> 
> I have gone through the the jira[1] and find out that the corresponding fix
> as given here[2]. But in the jira it says that "make sure the start time
> isn't zero before doing the subtraction". But in the logic it is
> implemented as follows ,
> 
> long startTime = req.getStartTime();
> if (getStage() == org.apache.coyote.Constants.STAGE_ENDED || startTime < 0)
> {
>       return 0;
> } else {
>       return (System.currentTimeMillis() - startTime);
> }
> 
> According to this implementation, it does the subtraction even the
> startTime is 0. Is it a bug ?? Am I missed something here ?

Yes.

Take a closer look at the possible values for startTime.

Mark

> 
> [1] - https://bz.apache.org/bugzilla/show_bug.cgi?id=60123
> [2] -
> https://github.com/apache/tomcat70/blob/TOMCAT_7_0_75/java/org/apache/coyote/RequestInfo.java#L129
> 
> Thanks,
> Nisala
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org