Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-1420

uploadThresholdSize seems to be ignored

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.1.8
    • 1.1.9
    • File Upload
    • None
    • MyFaces Tomahawk, JSF 1.2 - SUN RI on JBoss 5.01 / integrated Tomcat

    Description

      uploadThresholdSize seems to be ignored. I set it to 0 to get all files saved to disk for further processing in EJB. I also tried with 1 and 1k - but the result stayed the same. I got OutOfMemoryError when uploading huge files as HtmlFileUploadRenderer after line 180 always creeated an instance of UploadedFileDefaultMemoryImpl.

      String implementation = ((HtmlInputFileUpload) uiComponent).getStorage();
      if( implementation == null || ("memory").equals( implementation ) )
      upFile = new UploadedFileDefaultMemoryImpl( fileItem );
      else
      upFile = new UploadedFileDefaultFileImpl( fileItem );

      So something seems to be wrong with HtmlInputFileUpload.getStorage() - which uses an EL Expression to get the implementation.But I'm not sure how this is handled in myFaces. The expression just reads:

      ValueExpression vb = getValueExpression("storage");

      I'm not sure if that is put correctly in the FacesContext. It only works when I use fileUpload's storage attribute to hardcode the strategy to disk in JSF.

      UploadedFileDefaultMemoryImpl always will load the complete file into memory (line 42) - no matter what FileItem / ThresholdingOutputStream is used!

      int sizeInBytes = (int)fileItem.getSize();
      bytes = new byte[sizeInBytes];
      fileItem.getInputStream().read(bytes);

      I guess that this is causing my memory issues.

      Attachments

        1. TOMAHAWK-1420.patch
          3 kB
          Leonardo Uribe

        Issue Links

          Activity

            People

              lu4242 Leonardo Uribe
              jochen.reinhardt Jochen Reinhardt
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 24h
                  24h
                  Remaining:
                  Remaining Estimate - 24h
                  24h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified