You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "David Evans (JIRA)" <ji...@apache.org> on 2006/04/24 22:40:10 UTC

[jira] Closed: (STR-1935) Encountering "java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax(I)V" Error Message After Clicking Submit When Using the tag

     [ http://issues.apache.org/struts/browse/STR-1935?page=all ]
     
David Evans closed STR-1935:
----------------------------

    Resolution: Fixed

> Encountering "java.lang.NoSuchMethodError: org.apache.commons.fileupload.FileUpload.setSizeMax(I)V" Error Message After Clicking Submit When Using the <html:file> tag
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: STR-1935
>          URL: http://issues.apache.org/struts/browse/STR-1935
>      Project: Struts Action 1
>         Type: Bug

>   Components: Action
>     Versions: Nightly Build
>  Environment: Operating System: other
> Platform: All
>     Reporter: Charles Chen
>     Assignee: David Evans
>      Fix For: 1.2 Family

>
> I encountered following error when clicking the Submit button:
> exception 
> javax.servlet.ServletException: Servlet execution threw an exception
> root cause 
> java.lang.NoSuchMethodError: 
> org.apache.commons.fileupload.FileUpload.setSizeMax(I)V
> 	org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest
> (CommonsMultipartRequestHandler.java:220)
> 	org.apache.struts.util.RequestUtils.populate(RequestUtils.java:934)
> 	org.apache.struts.action.RequestProcessor.processPopulate
> (RequestProcessor.java:779)
> 	org.apache.struts.action.RequestProcessor.process
> (RequestProcessor.java:246)
> 	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
> 	org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
> 	javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> In the org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest() 
> method, it creates a DiskFileUpload object and calls the setSizeMax() method 
> with a type casting to int:
>     public void handleRequest(HttpServletRequest request)
>             throws ServletException {
>         // Get the app config for the current request.
>         ModuleConfig ac = (ModuleConfig) request.getAttribute(
>                 Globals.MODULE_KEY);
>         // Create and configure a DIskFileUpload instance.
>         DiskFileUpload upload = new DiskFileUpload();
>         // Set the maximum size before a FileUploadException will be thrown.
>         upload.setSizeMax((int) getSizeMax(ac));
> However, the setSizeMax is not found in the 
> org.apache.commons.fileupload.DiskFileUpload class.  The setSizeMax method is 
> defined in the superclass FileUploadBase but it expects a long method:
>     public void setSizeMax(long sizeMax)
>     {
>         this.sizeMax = sizeMax;
>     }
> Either the DiskFileUpload class needs to override the default setSizeMax 
> method or the CommonsMultipartRequestHandler.request method needs to pass in a 
> long value to set the max size.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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