commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mart...@apache.org>
Subject Re: FileUpload NullPointerException Problem
Date Fri, 21 Nov 2003 14:50:01 GMT
Your English is *much* better than my Japanese. ;-)

Please refer to the FileUpload usage documentation, here:

http://jakarta.apache.org/commons/fileupload/using.html

As you will see, you should be using the DiskFileUpload class, instead of
the FileUpload class, if you want the default disk-based implementation.
You should use the FileUpload class itself only if you need more control
over the way in which FileItem instances are created.

--
Martin Cooper


On Fri, 21 Nov 2003, ume wrote:

> How do you do.
>
> I am a Japanese. Name is Ume.
> I am sorry that I am not good at English.
> This mail post first time at English.
>
> I met the following exception using commons-FileUpload.
> (I found same Problem ,
> http://www.mail-archive.com/commons-user@jakarta.apache.org/msg03431.html)
>
> I found the solution method.
>
> Problem
> ---
> java.lang.NullPointerException
> 	at org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:507)
> 	at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:390)
> 	at HogeSrv.doPost(HogeSrv.java:65)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> ...
>
> HogeSrv.java
> 63:	FileUpload fu = new FileUpload();
> 64:	fu.setSizeMax(1000000);
> 65:	List fileItems = fu.parseRequest(req);
> ---
>
> It was OK, when I add
> fu.setFileItemFactory(new DefaultFileItemFactory());
> before 65 line.
>
> I see source
>
> FileUpload.java 1.24
>
>     /**
>      * Constructs an instance of this class which uses the default factory to
>      * create <code>FileItem</code> instances.
>      *
>      * @see #FileUpload(FileItemFactory)
>      */
>     public FileUpload()
>     {
>         super();
>     }
>
> and
>
> DiskFileUpload.java 1.4
>     /**
>      * Constructs an instance of this class which uses the default factory to
>      * create <code>FileItem</code> instances.
>      *
>      * @see #DiskFileUpload(DefaultFileItemFactory fileItemFactory)
>      */
>     public DiskFileUpload()
>     {
>         super();
>         this.fileItemFactory = new DefaultFileItemFactory();
>     }
>
> therefore
>
> FileUpload.java
>
>     /**
>      * Constructs an instance of this class which uses the default factory to
>      * create <code>FileItem</code> instances.
>      *
>      * @see #FileUpload(FileItemFactory)
>      */
>     public FileUpload()
>     {
>         super();
> 		// add line
>         this.fileItemFactory = new DefaultFileItemFactory();
>     }
>
> It seems OK, this Source.
> Is it solution method?
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message