Re: FileUpload NullPointerException Problem

2003-11-24 Thread ume
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 codeFileItem/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:[EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FileUpload NullPointerException Problem

2003-11-24 Thread Martin Cooper
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 codeFileItem/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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FileUpload NullPointerException Problem

2003-11-21 Thread Martin Cooper
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/[EMAIL PROTECTED]/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(100);
 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 codeFileItem/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 codeFileItem/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 codeFileItem/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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]