[ 
https://issues.apache.org/jira/browse/WICKET-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695753#action_12695753
 ] 

Juergen Donnerstag commented on WICKET-2208:
--------------------------------------------

Added an error log entry to indicate at least to the admin that something went 
wrong.

> MalformedStreamException is silently ignored
> --------------------------------------------
>
>                 Key: WICKET-2208
>                 URL: https://issues.apache.org/jira/browse/WICKET-2208
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-RC2
>            Reporter: Juergen Donnerstag
>
> If a FileUpload fails because of a MalformedStreamException, the exception is 
> swallowed and Wicket continues as if no data (filenames) have been provided. 
> No error message, no exception.
> Copied from WICKET-2015:
> I found back the line where this case seems to create the problem.
> If you debug your stuff (without having the file upload set), the code will 
> get an exception in MultiPartFormInputStream, method "skipPreamble":
> It ends up in the MalformedStreamException, which is swallowed and "false" is 
> returned.
> Maybe this finished the submission and nothing happens.
> public boolean skipPreamble() throws IOException
> {
> // First delimiter may be not preceeded with a CRLF.
> System.arraycopy(boundary, 2, boundary, 0, boundary.length - 2);
> boundaryLength = boundary.length - 2;
> try
> {
> // Discard all data up to the delimiter.
> discardBodyData();
> // Read boundary - if succeeded, the stream contains an
> // encapsulation.
> return readBoundary();
> }
> catch (MalformedStreamException e)
> {
> return false;
> }
> finally
> {
> // Restore delimiter.
> System.arraycopy(boundary, 0, boundary, 2, boundary.length - 2);
> boundaryLength = boundary.length;
> boundary[0] = CR;
> boundary[1] = LF;
> }
> }
> The exception has as cause: MalformedStreamException: Stream ended 
> unexpectedly
> I looked further and the debugger showd that this methods throws the 
> exception : discardBodyData()
> By assigning a value to the fileUploadComponent the code does not throw any 
> exception at that point.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to