On 12 March 2013 09:05,  <[email protected]> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to