You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Simone Tripodi (JIRA)" <ji...@apache.org> on 2013/03/13 11:06:12 UTC

[jira] [Comment Edited] (FILEUPLOAD-229) toLowerCase() is Locale-dependent; should use toLowerCase(Locale.ENGLISH) instead

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

Simone Tripodi edited comment on FILEUPLOAD-229 at 3/13/13 10:04 AM:
---------------------------------------------------------------------

As discussed dev@, about {{ServletFileUpload}}, _RFC-2616 5.1.1 Method_ states that http methods are case-sensitive:

{quote}
    The Method  token indicates the method to be performed on the
    resource identified by the Request-URI. The method is case-sensitive.
{noformat}
        Method         = "OPTIONS"                ; Section 9.2
                       | "GET"                    ; Section 9.3
                       | "HEAD"                   ; Section 9.4
                       | "POST"                   ; Section 9.5
                       | "PUT"                    ; Section 9.6
                       | "DELETE"                 ; Section 9.7
                       | "TRACE"                  ; Section 9.8
                       | "CONNECT"                ; Section 9.9
                       | extension-method
        extension-method = token
{noformat}
{quote}

So there is no need for {{equalsIgnoreCase}} or {{toLowerCase}} at all and {{"POST".equals(...)}} should just do it.
                
      was (Author: simone.tripodi):
    As discussed dev@, about {{ServletFileUpload}}, _RFC-2616 5.1.1 Method_ states that http methods are case-sensitive:

{quote}
    The Method  token indicates the method to be performed on the
    resource identified by the Request-URI. The method is case-sensitive.

        Method         = "OPTIONS"                ; Section 9.2
                       | "GET"                    ; Section 9.3
                       | "HEAD"                   ; Section 9.4
                       | "POST"                   ; Section 9.5
                       | "PUT"                    ; Section 9.6
                       | "DELETE"                 ; Section 9.7
                       | "TRACE"                  ; Section 9.8
                       | "CONNECT"                ; Section 9.9
                       | extension-method
        extension-method = token
{quote}

So there is no need for {{equalsIgnoreCase}} or {{toLowerCase}} at all and {{"POST".equals(...)}} should just do it.
                  
> toLowerCase() is Locale-dependent; should use toLowerCase(Locale.ENGLISH) instead
> ---------------------------------------------------------------------------------
>
>                 Key: FILEUPLOAD-229
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-229
>             Project: Commons FileUpload
>          Issue Type: Bug
>            Reporter: Sebb
>
> toLowerCase() is Locale-dependent - as is toUpperCase().
> For comparisons, can often use equalsIgnoreCase(String) instead.
> If an actual lower/upper case is required, then should use a fixed locale (unless the code is intended to use the default locale, which is quite unusual for Commons)
> A suitable locale is Locale.ENGLISH as that behaves well with ASCII and ISO-8859-1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira