0 Replies Latest reply on Mar 11, 2008 12:58 PM by Natalia Ponomareva

    s:fileUpload strange behaviour for some files

    Natalia Ponomareva Newbie

      Hello guys! i wonder if anyone can explain what is going on with s:fileUpload. Short story-we used to have seam 1.2 application with richfaces 3.0. After migrating to 3.1.4 richfaces, s:fileUpload started behaving strange. Here is the thing- we have a conversation scoped main bean that holds some objects during conversation. There is method in this main bean (getAdditionalObjects) that  returns list of objects based on the objects stored in mainbean.
      This is the xhml code


      <h:form enctype="multipart/form-data">
                <s:fileUpload                    data="#{mainBean.documentData}"               contentType="#{mainBean.documentContentType}"
                          fileName="#{mainBean.documentFileName}"/>
                <h:commandButton
                          action="#{mainBean.fileUpload.addDocument}"
                          value="Upload"/>
      </h:form>
      
      <h:form>
                <h:panelGroup rendered="#{not empty mainBean.additionalObjects}">...
                </h:panelGroup>
      </h:form>
      


      This all worked perfectly fine with 3.0 richfaces. However users started to report that clicking the button to upload now throghs exception, further investigation showed that
      a) exception is thrown cause no objects that are supposed to be in the main bean are found
      b) that happens with only some files, in particular outlook item templates
      c) exception is thrown only in IE, firefox works ok most of the times.
      Messing around with s:fileupload, i tried changing h:commandButton to h:commandLink and that seems to fix the problem.
      So for certain documents if you click the add button, the framework will return from the restoreView phase, detached from the current conversation, and a NPE will result when mainbean.getAdditionalObejcts is called to render the view.
      Wondering why and what may caused conversation to be unaccesable for some files?