You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2001/11/07 17:16:39 UTC

DO NOT REPLY [Bug 4701] New: - NullPointerException in MultipartIterator

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4701>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4701

NullPointerException in MultipartIterator

           Summary: NullPointerException in MultipartIterator
           Product: Struts
           Version: Nightly Build
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: File Upload
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: roland@tichny.org


In branch STRUTS_1_0_BRANCH, MultipartIterator will allways throw a
NullPointerException in createLocalFile() at the end of InputStream:

                         lineBuffer = inputStream.readLine();
                         bytesRead = lineBuffer.length;

since BufferedMultipartInputStream.readLine() will allways return null at EOF.
Solution change it e.g. to 
                         bytesRead = (lineBuffer == null ? -1:
                                      lineBuffer.length);

to avoid the exception or even better change semantic of outer loop.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>