tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: Inconsistency in AprEndpoint.java and JIoEndpoint.java
Date Wed, 29 Feb 2012 08:15:47 GMT
On 29/02/2012 04:51, Ken Cheung wrote:
> Because both of them are performing the same function. However, one
> of them (AprEndpoint.java:1057:1058) you typecast "SocketWrapper" to
> "Long" and check if "socket.async" is true while another one
> (JloEndpoint.java) you just typecast it to "Socket" and execute the
> same piece of codes. The checking of "socket.async" is missing here
> and therefore it could be a bug.

Oh dear. Where to start...?

Some things to consider:
- The code being different is no basis (on its own) for there being a
bug. The code snippets are supporting different Endpoint implementations
with different properties so it is entirely possible that the
implementations are different.
- Typecast? No. Not even close. You need to go and read up on generics
in Java.
- You assume that the check is missing in JIoEndpoint. Surely it is
equally possible that the check is unnecessary in AprEndpoint. You don't
appear to have considered that possibility.
- Before stating there is a bug, you need to understand what the code is
doing and have a credible explanation as to what might go wrong. You
don't have that. All you have is a statement that the code is different.

For the record, the code is correct and there is no bug but for the
benefit of the OP I'd like to see them work out why this is the case
rather than me spoon feeding them the explanation.

Mark

> 
> On 29 Feb, 2012, at 2:45 AM, Mark Thomas wrote:
> 
>> On 28/02/2012 16:40, Ken Cheung wrote:
>>> I observed some code clones in Tomcat and found inconsistent
>>> code. Could anyone explain why this is not a bug?
>> 
>> Yes.
>> 
>> Perhaps you'd like to explain your basis for assuming it is a bug.
>> 
>> Mark
>> 
>> ---------------------------------------------------------------------
>>
>> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
>
> 
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Mime
View raw message