4 Replies Latest reply on Jan 9, 2008 7:41 PM by Shane Bryzak

    fileUpload component - Strange behavior

    John Tsimikas Newbie

      I am experiencing some strange behavior with s:fileUpload.

      The upload itself works fine, however I am noticing some unusual
      behavior which happens "sporadically."

      <h:form id="insertForm" enctype="multipart/form-data">
      ....
      <s:fileUpload id="attachment"
      data="#{plasticsInsertForm.insertDocument}"
      fileName="#{plasticsInsertForm.insertDocumentName}"/>

      ....
      <h:commandButton value=" Apply Changes " id="submitButton"
      styleClass='submitButton' action="#{plasticsInsert.validateForm}"/>
      ......


      The method validateForm() which should always be executed on every button click "sometimes" does not get executed when the fileUpload component is utilized. Once the fileUpload component is removed, the action method is called on every click as normal.


      Is this a bug.. a timing issue of some kind... any ideas?

        • 1. Re: fileUpload component - Strange behavior
          Carl Abramsson Newbie

          We are having some strange and sporadic errors with the fileupload component in 1.2.0 and 1.2.1 GA too. We loose the viewstate sometimes on some of the pages.

          After some debugging, it seems like the problem is with the class that parses the multipart-request and not the UI-component. We noticed this after first removing the UI-compoent from the page, still errors, and then removing the enctype="multipart/form-data" from the form tag. After this, the error never occurs.
          Most of the time no exception is thrown, the multipart parser just don't return ANY params at all. Sometimes it only omits the viewstate param. Sometimes it works. Sometimes this expection is thrown:

          18:13:08,233 ERROR [ExceptionFilter] exception root cause
          java.lang.ArrayIndexOutOfBoundsException: 2048
           at org.jboss.seam.web.MultipartRequest.checkSequence(MultipartRequest.java:466)
           at org.jboss.seam.web.MultipartRequest.parseRequest(MultipartRequest.java:333)
           at org.jboss.seam.web.MultipartRequest.getParam(MultipartRequest.java:507)
           at org.jboss.seam.web.MultipartRequest.getParameterValues(MultipartRequest.java:579)
           at javax.servlet.ServletRequestWrapper.getParameterValues(ServletRequestWrapper.java:188)
          [clipped]
          

          (2048 is the size of the buffer in MultipartRequest, fishy...)

          So it's very hard to reproduce as it seems like the error only occurs when the size of the post request is at a specific size and contains a specific number of parameters or something. But I have one view/entity that the error occurs on every time, this eases the debugging...

          You are probably seeing the same error, the missing validateForm() could be a result of the viewstate-param not being parsed.

          I'm going to use the MultipartRequest-class from Seam 2.0 since it's changed a bit and see if the problem goes away.

          (Using Myfaces 1.1.5, Seam 1.2.1GA, Latest stable JBoss RichFaces/Ajax4JSF, removed tomahawk, put the seam-filter first)

          • 2. Re: fileUpload component - Strange behavior
            Shane Bryzak Master

            There were some file upload bugs that were fixed for 2.0.0, both in MultipartRequest and in the JSF control. I suggest trying this new version, and if these issues persist please let me know.

            • 3. Re: fileUpload component - Strange behavior
              super man Newbie

              hi,

              i would be very grateful if anyone could tell me if they found a workaround for that problem coz i'm experiencing the same thing and don't have a clue how to solve it.
              thanks in advance.

              • 4. Re: fileUpload component - Strange behavior
                Shane Bryzak Master

                 

                "kal-el" wrote:
                hi,

                i would be very grateful if anyone could tell me if they found a workaround for that problem coz i'm experiencing the same thing and don't have a clue how to solve it.
                thanks in advance.


                Which version of Seam are you using?