myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Wessendorf" <mat...@apache.org>
Subject [TRINIDAD] ISSUE 607 (inputFile related)
Date Mon, 14 Apr 2008 16:23:24 GMT
Hi,

the bug in [1] is pretty annoying.

Currently UploadedFileImpl.loadFile(....) throws an EOFException when
we hit the limits of the upload facility.
(like file is larger than allowed).

You won't see a FacesMessage for the not happened upload,
but a error page (default or a configured custom one)
To fix this, we may perhaps do the following.

add a try/catch block around the UploadedFileImpl.loadFile(....),
which happens inside UploadedFileProcessorImpl.processFile().
like
...
    try
    {
      file.loadFile(tempFile,
                    _maxMemory - info.totalBytesInMemory,
                    _maxDiskSpace - info.totalBytesOnDisk,
                    _tempDir);
    }
    catch(EOFException ioe)
    {
      //LOG THE EXCEPTION.....
      return new ErrorFile();
    }
...

The ErrorFile class is a very simple implementation of the
UploadedFile interface and it's getLength() returns -1.
That way we ensure the lifecycle continues.... (currently not the case).

Inside the renderer (SimpleInputFileRenderer.getConvertedValue()) we
could throw a ConverterException when the
length is -1, to signal that there was an issue when doing that upload...

That way we avoid the nasty error page and we can show a FacesMessage
for the inputFile in question.

Any feedback?

[1] http://issues.apache.org/jira/browse/TRINIDAD-607

-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Mime
View raw message