harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject Re: [jira] Commented: (HARMONY-482) Some code compares Strings with == operator
Date Tue, 23 May 2006 09:53:33 GMT
Hi, Mikhail,

I found some code looks strange in the patch, such as
 c.method = pos + t;
 c.method = ge+ t;

Is there any reason to write in such way?

Thanks!


On 5/22/06, Mikhail Loenko (JIRA) <jira@apache.org> wrote:
>
>    [
> http://issues.apache.org/jira/browse/HARMONY-482?page=comments#action_12412723]
>
> Mikhail Loenko commented on HARMONY-482:
> ----------------------------------------
>
> If the code remains unmodified, this works fine.
> I think the best way is to develop a unit test that would prevent
> undesired modifications in the code
>
> > Some code compares Strings with == operator
> > -------------------------------------------
> >
> >          Key: HARMONY-482
> >          URL: http://issues.apache.org/jira/browse/HARMONY-482
> >      Project: Harmony
> >         Type: Bug
>
> >   Components: Classlib
> >     Reporter: Mikhail Fursov
> >     Assignee: Mikhail Loenko
> >     Priority: Trivial
>
> >
> > Some classes  (e.g.
> org.apache.harmony.luni.internal.net.www.protocol.http.HttpUrlConnection)
> use string comparison by reference instead of comparison by value.
> > Such optimization is legal but can lead to problems with compatibility
> and bugs when part of the code refactored.
> >         if (method == "GET")
> >             setRequestMethod("POST");
> >         // If the request method is neither PUT or POST, then you're not
> writing
> >         if (method != "PUT" && method != "POST")
> >             throw new ProtocolException(Msg.getString("K008f", method));
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>   http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>   http://www.atlassian.com/software/jira
>
>


-- 
Andrew Zhang
China Software Development Lab, IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message