harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Fursov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-482) Some code compares Strings with == operator
Date Tue, 23 May 2006 09:52:30 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-482?page=comments#action_12412903 ] 

Mikhail Fursov commented on HARMONY-482:

I checked the patch and found no errors in it.

BTW may be we should come to an agreement do not use in Harmony "magic numbers" or "magic
strings" in code at all and deal with constants only?

> 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
>  Attachments: patch.txt
> 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:
For more information on JIRA, see:

View raw message