Uploaded image for project: 'Commons FileUpload'
  1. Commons FileUpload
  2. FILEUPLOAD-123

NullPointerException in FileUploadBase.createItem(FileUploadBase.java:500) when no factory was set in FileUpload

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.1.1
    • 1.2
    • None

    Description

      The following code produces a NPE, a more descriptive exception (and exception message) would be helpful.

      ServletFileUpload upload = new ServletFileUpload();
      try {
      List<FileItem> items = upload.parseRequest(request);
      /* ... */
      } catch (Exception e) {
      e.printStackTrace();
      }

      The exception is:
      java.lang.NullPointerException
      at org.apache.commons.fileupload.FileUploadBase.createItem(FileUploadBase.java:500)
      at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:367)
      at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
      ...

      Attachments

        Activity

          People

            Unassigned Unassigned
            struppi David Tanzer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: