commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1455456 - /commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java
Date Tue, 12 Mar 2013 16:44:34 GMT
On 12 March 2013 09:05,  <simonetripodi@apache.org> wrote:
> Author: simonetripodi
> Date: Tue Mar 12 09:05:06 2013
> New Revision: 1455456
>
> URL: http://svn.apache.org/r1455456
> Log:
> trivial: extracted POST string constant
>
> Modified:
>     commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java
>
> Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java
> URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java?rev=1455456&r1=1455455&r2=1455456&view=diff
> ==============================================================================
> --- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java
(original)
> +++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/servlet/ServletFileUpload.java
Tue Mar 12 09:05:06 2013
> @@ -45,6 +45,8 @@ import org.apache.commons.fileupload.Fil
>   */
>  public class ServletFileUpload extends FileUpload {
>
> +    private static final String POST_METHOD = "post";
> +
>      // ---------------------------------------------------------- Class methods
>
>      /**
> @@ -58,7 +60,7 @@ public class ServletFileUpload extends F
>       */
>      public static final boolean isMultipartContent(
>              HttpServletRequest request) {
> -        if (!"post".equals(request.getMethod().toLowerCase())) {
> +        if (!POST_METHOD.equals(request.getMethod().toLowerCase())) {

It would be safer to use equalsIgnoreCase(), for two reasons:
- POST_METHOD case is then irrelevant (methods are usually shown as uppercase)
- toLowerCase() is Locale-dependent.

[Note: this is not a criticism of the commit itself which does not
change the original behaviour]

>              return false;
>          }
>          String contentType = request.getContentType();
>
>

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


Mime
View raw message