commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Cook <>
Subject Re: fileUpload NullPointerException
Date Fri, 11 Jul 2003 18:34:20 GMT

I am guessing the instance you described with three file upload fields 
falls into one of the following

	o All three file input fields have the same name. Which would return 
only one file name.

	o There is some scripting on the client side to account for it.

	o You have a test at some point in your code to skip the file upload if 
the form does not return a file name to the servlet.

	o The servlet does not actually write the file to disk so the 
fileItem.write(fileName) method is not actually called.

Other possibilities include that I may just be completely wrong in my 
understanding of the conditions that throw exceptions.  And or that I am 
implementing  Jakarta.Commons.FileUpload incorrectly.  It has been a 
while since I have stumbled thought the API docs for it.  If I get a 
change I will go over them again to day.

Has far as I know .parseRequest() will throw, or cause the following 

	o NullPointerException - For me this usually means I failed to set the 
input type to "multipart/form-data"
	o FileUploadException - The data is not in a form that FileItem can 
parse, and or it is unable to write to disk.

Again these are assumptions I am making based on observations made by 
myself and some others.  I would be very interested in hearing differing 
ideas or thoughts any one may have.

View raw message