3 Replies Latest reply on Jul 11, 2008 4:29 AM by Andrei Markavtsov

    rich:fileUpload does not work in IE6 and IE7 when error occ

    Tao Xiao Newbie

      Hi all,

      I am trying to throw a IOException from the fileUpload backing bean and let the component catch it by handling onerror event. It was working correctly in firefox and safari but not in IE6 and IE7.

      In IE6 and IE7, the fileUpload component displayed "done" message when the backing bean threw exception, and then redirected to the webapp home page with message "The conversation ended, timed out or was processing another request " (the home page is a default page when there is no conversation id specified)

      In firefox and safari, the fileUpload component worked perfectly. it displayed "Transfer error occuried" and then executed the javaScript which is bound to onerror event.

      The following are the richfaces code and backing bean code snippets

      <rich:fileUpload id="signedFileUplaod" listHeight="50"
       fileUploadListener="#{signerManagement.uploadSignedFile}"
       cleanButtonClass="none"
       sizeErrorLabel="#{messages['upload.documents.upload.size.error.message']}"
       clearAllControlLabel="" clearControlLabel=""
       addControlLabel="#{messages['upload.documents.attach.signed.button.label']}"
       onerror="window.alert('something bad happened');">
       <a4j:support event="onuploadcomplete"
       reRender="uploadButtonPanel" />
       <f:facet name="label">
       <h:outputText
       value="#{messages['upload.documents.upload.progress.message']}" />
       </f:facet>
       </rich:fileUpload>


      public void uploadSignedFile(UploadEvent event) throws IOException
       {
       if (event.getUploadItem().getFile() != null)
       {
       getLogger().info("uploaded signed document #0", event.getUploadItem().getFileName());
      
       uploadedSignedDocument = fileService.constructDocumentByUploadItem(event.getUploadItem());
      
       try
       {
       if (!signatureVerificationService.verify(uploadedSignedDocument))
       {
       getLogger().info("The signed document #0 was not correctly signed", uploadedSignedDocument.getDocumentName());
       uploadedSignedDocument = null;
      
       throw new IOException("The signed document was not correctly signed");
       }
       }
       catch (IllegalArgumentException e)
       {
       getFacesMessages().add("The signed document was not correctly signed");
       clear();
      
       throw new IOException(e.getMessage());
       }
      
      
       request.setSignedDocument(uploadedSignedDocument);
       }
      
       }


      I am running richfaces 3.2.1.GA, seam 2.0.2.GA and jboss 4.2.2.GA

      Thanks

        • 2. Re:  rich:fileUpload does not work in IE6 and IE7 when error
          Tao Xiao Newbie

          Thanks for fixing the bug. I tried the 3.2.2 snapshot, it worked in both IE6 and IE7 where i was able to see the popup window generated by onerror event when the backing bean threw exception.

          But there is another issue exists where i am unable to re-submit the file when the backing been keeps throwing exception. The first time when i submited the file, i got the transfer error and a popup window as i expected. but when i re-submited the file in the second time, i got the redirection to the home page with message "The conversation ended, timed out or was processing another request " (the home page is a default page when there is no conversation id specified).

          This issue happens in firefox as well.

          The followings are the code snippets


          <h:panelGrid id="uploadPanel" columns="1">
           <h:outputText value="#{messages['upload.documents.instructions']}"
           id="instructionsOutput" />
           <rich:fileUpload id="signedFileUplaod" listHeight="50"
           fileUploadListener="#{fileUpload.uploadSignedFile}"
           cleanButtonClass="none"
           sizeErrorLabel="#{messages['upload.documents.upload.size.error.message']}"
           clearAllControlLabel="" clearControlLabel=""
           addControlLabel="#{messages['upload.documents.attach.signed.button.label']}"
           onerror="window.alert('something bad happened');">
           </rich:fileUpload>
           </h:panelGrid>
          


          public void uploadSignedFile(UploadEvent event) throws IOException
           {
           if (event.getUploadItem().getFile() != null)
           {
           log.info("uploaded signed document #0", event.getUploadItem().getFileName());
          
           try
           {
           if (true)
           {
           log.info("The signed document #0 was not correctly signed", event.getUploadItem().getFileName());
          
           throw new IOException("The signed document was not correctly signed");
           }
           }
           catch (IllegalArgumentException e)
           {
           throw new IOException(e.getMessage());
           }
           }
          
           }
          


          I also have attached the war binary to the jira
          http://jira.jboss.com/jira/browse/RF-3859

          please deploy the war to jboss and have a look

          thanks

          working environment: richfaces 3.2.1.GA, seam 2.0.2.GA and jboss 4.2.2.GA

          • 3. Re:  rich:fileUpload does not work in IE6 and IE7 when error
            Andrei Markavtsov Apprentice

            Yes. It happens. But this is not RF issue. As I know there many such problems with Seam and Rf integration were posted to seam and our forums.

            I'm not advanced in Seam. But I can suggest to try to switch throwing IOExcepton to your custom not-runtime exception in your listener. Also you can try to do something with upload coversation. Please see Seam doc for more information.