You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by ume <um...@gomibako.com> on 2003/11/21 10:14:38 UTC
FileUpload NullPointerException Problem
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?
--
ume mailto:umesan@gomibako.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: FileUpload NullPointerException Problem
Posted by ume <um...@gomibako.com>.
Hi.
I am sorry, I did not know Bugzilla!
Then, I search that problem, already reported!!
Bug#: 23822 Opened: 2003-10-14 19:41
I wait to fix it.
Thanks for your kindness.
<20...@minotaur.apache.org> Martin Cooper wrote
>On Tue, 25 Nov 2003, ume wrote:
>
>> Hello.
>>
>> Thanks you for the reply.
>> I understood using DiskFileUpload class.
>> It's OK in my source and test.
>>
>> However, I think that FileUpload class constructer will still be a
>> bug.
>> Because, it is written to the document of FileUpload class
>> constructer as "which uses the default factory".
>
>Thanks. Please file a bug against the documentation, here:
>
>http://nagoya.apache.org/bugzilla/
>
>That way, I won't forget to fix it. ;-)
--
ume mailto:umesan@gomibako.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: FileUpload NullPointerException Problem
Posted by Martin Cooper <ma...@apache.org>.
On Tue, 25 Nov 2003, ume wrote:
> Hello.
>
> Thanks you for the reply.
> I understood using DiskFileUpload class.
> It's OK in my source and test.
>
> However, I think that FileUpload class constructer will still be a
> bug.
> Because, it is written to the document of FileUpload class
> constructer as "which uses the default factory".
Thanks. Please file a bug against the documentation, here:
http://nagoya.apache.org/bugzilla/
That way, I won't forget to fix it. ;-)
--
Martin Cooper
>
> 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();
> }
> --
>
> >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.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: FileUpload NullPointerException Problem
Posted by ume <um...@gomibako.com>.
Hello.
Thanks you for the reply.
I understood using DiskFileUpload class.
It's OK in my source and test.
However, I think that FileUpload class constructer will still be a
bug.
Because, it is written to the document of FileUpload class
constructer as "which uses the default factory".
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();
}
--
>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.
--
ume mailto:umesan@gomibako.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: FileUpload NullPointerException Problem
Posted by Martin Cooper <ma...@apache.org>.
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