struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10388] New: - ServletException: Multipart data doesn't start with boundary (when calling form.validate() in Action)
Date Tue, 02 Jul 2002 02:59:19 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10388>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10388

ServletException: Multipart data doesn't start with boundary (when calling form.validate()
in Action)

           Summary: ServletException: Multipart data doesn't start with
                    boundary (when calling form.validate() in Action)
           Product: Struts
           Version: 1.1 Beta 1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: File Upload
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: daniel.joshua@gridnode.com


I turn off auto-validation for my forms, and call validate() in the Action. If 
there are no ActionErrors, then I am able to upload my file. However, when 
there is an ActionError, "javax.servlet.ServletException: Multipart data 
doesn't start with boundary" is thrown.

Also, I store the FormFile in the ActionForm if a checkbox on the HTML form is 
ticked when the form is auto-populated.


= My Code =====================================================================

MyActionForm:

  public void setUploadState(String newUploadState)
  {
    _uploadState = newUploadState;

    // Check if uploading
    if(_uploadState.equals("true"))
    {
      MultipartRequestHandler hdlr = getMultipartRequestHandler();
      Hashtable files = hdlr.getFileElements();
      _file = (FormFile)files.get("file");
    }
  }


MyAction:

      ActionErrors errors = form.validate(mapping, request);
      if(errors == null || !errors.empty())
      {
        // Special handling for multipart request
        if(form.getMultipartRequestHandler() != null)
        {
            form.getMultipartRequestHandler().rollback();
        }

        request = ((MultipartRequestWrapper) request).getRequest();
      }
      else
      {
        // no action errors

= The Exception ===============================================================

type Exception report

message Internal Server Error

description The server encountered an internal error (Internal Server Error) 
that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: Multipart data doesn't start with boundary
	at org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest
(DiskMultipartRequestHandler.java:103)
	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:908)
	at org.apache.struts.action.RequestProcessor.processPopulate
(RequestProcessor.java:795)
	at org.apache.struts.action.RequestProcessor.process
(RequestProcessor.java:244)
	at org.apache.struts.action.ActionServlet.process
(ActionServlet.java:1109)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationDispatcher.invoke
(ApplicationDispatcher.java:683)
	at org.apache.catalina.core.ApplicationDispatcher.doForward
(ApplicationDispatcher.java:431)
	at org.apache.catalina.core.ApplicationDispatcher.forward
(ApplicationDispatcher.java:355)
	at org.apache.struts.action.RequestProcessor.doForward
(RequestProcessor.java:972)
	at org.apache.struts.action.RequestProcessor.processActionForward
(RequestProcessor.java:408)
	at org.apache.struts.action.RequestProcessor.process
(RequestProcessor.java:269)
	at org.apache.struts.action.ActionServlet.process
(ActionServlet.java:1109)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:243)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:190)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2347)
	at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:170)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:468)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.connector.http.HttpProcessor.process
(HttpProcessor.java:1017)
	at org.apache.catalina.connector.http.HttpProcessor.run
(HttpProcessor.java:1115)
	at java.lang.Thread.run(Thread.java:484)


root cause 

java.io.IOException: Multipart data doesn't start with boundary
	at 
org.apache.struts.upload.MultipartBoundaryInputStream.readFirstElement
(MultipartBoundaryInputStream.java:348)
	at org.apache.struts.upload.MultipartBoundaryInputStream.setInputStream
(MultipartBoundaryInputStream.java:172)
	at org.apache.struts.upload.MultipartIterator.parseRequest
(MultipartIterator.java:202)
	at org.apache.struts.upload.MultipartIterator.
(MultipartIterator.java:171)
	at org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest
(DiskMultipartRequestHandler.java:75)
	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:908)
	at org.apache.struts.action.RequestProcessor.processPopulate
(RequestProcessor.java:795)
	at org.apache.struts.action.RequestProcessor.process
(RequestProcessor.java:244)
	at org.apache.struts.action.ActionServlet.process
(ActionServlet.java:1109)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationDispatcher.invoke
(ApplicationDispatcher.java:683)
	at org.apache.catalina.core.ApplicationDispatcher.doForward
(ApplicationDispatcher.java:431)
	at org.apache.catalina.core.ApplicationDispatcher.forward
(ApplicationDispatcher.java:355)
	at org.apache.struts.action.RequestProcessor.doForward
(RequestProcessor.java:972)
	at org.apache.struts.action.RequestProcessor.processActionForward
(RequestProcessor.java:408)
	at org.apache.struts.action.RequestProcessor.process
(RequestProcessor.java:269)
	at org.apache.struts.action.ActionServlet.process
(ActionServlet.java:1109)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:470)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:243)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:190)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2347)
	at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:170)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:468)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline.invokeNext
(StandardPipeline.java:566)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.connector.http.HttpProcessor.process
(HttpProcessor.java:1017)
	at org.apache.catalina.connector.http.HttpProcessor.run
(HttpProcessor.java:1115)
	at java.lang.Thread.run(Thread.java:484)

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


Mime
View raw message