[jira] [Created] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
FileNotFoundException thrown by DiskFileItem.write
--------------------------------------------------

                 Key: FILEUPLOAD-193
                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
             Project: Commons FileUpload
          Issue Type: Bug
    Affects Versions: 1.2.2
         Environment: Ubuntu 10.10

java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
            Reporter: Dan Washusen
            Priority: Critical


Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails...

A little digging seems to suggest that the following code is back to front:
{code}in = new BufferedInputStream(
    new FileInputStream(outputFile));
out = new BufferedOutputStream(
        new FileOutputStream(file));
IOUtils.copy(in, out);{code}

It seems to be trying to copy the outputFile (which doesn't exist yet) to the input file.

{code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
        at upload.UploadController.handle(UploadController.java:90){code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)

     [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Washusen updated FILEUPLOAD-193:
------------------------------------

    Description:
Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.

{code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
        at upload.UploadController.handle(UploadController.java:90)
        ...{code}

I can't see any obvious reason why the source file (outputFile) wouldn't exist...

  was:
Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails...

A little digging seems to suggest that the following code is back to front:
{code}in = new BufferedInputStream(
    new FileInputStream(outputFile));
out = new BufferedOutputStream(
        new FileOutputStream(file));
IOUtils.copy(in, out);{code}

It seems to be trying to copy the outputFile (which doesn't exist yet) to the input file.

{code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
        at upload.UploadController.handle(UploadController.java:90){code}


Updated description to remove incorrect description of issue.

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057131#comment-13057131 ]

jagub zhang commented on FILEUPLOAD-193:
----------------------------------------

did you use DiskFileItem#write twice?
or you register a FileCleaningTracker in your DiskFileItemFactory.


> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060560#comment-13060560 ]

Julien Vey commented on FILEUPLOAD-193:
---------------------------------------

I have the same issue under some undetermined conditions.

Have you found any workaround to avoid this issue ?

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Issue Comment Edited] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060560#comment-13060560 ]

Julien Vey edited comment on FILEUPLOAD-193 at 7/6/11 1:22 PM:
---------------------------------------------------------------

I have the same issue under some undetermined conditions.

Have you found any workaround to avoid this issue ?

(with version 1.2.1)

      was (Author: veyjul):
    I have the same issue under some undetermined conditions.

Have you found any workaround to avoid this issue ?
 

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060897#comment-13060897 ]

Dan Washusen commented on FILEUPLOAD-193:
-----------------------------------------

I haven't noticed this issue since reporting it (no changes to my code).

Jagub, to answer your questions...

No I'm not calling DiskFileItem#write twice.  I call this method while iterating over the list of FileItems returned from ServletFileUpload#parseRequest.  Each request contains several form fields and a single file.

Yes, I have a FileCleaningTracker registered with the DiskFileItemFactory.  However, I call the write method almost immediately after calling ServletFileUpload#parseRequest (so I wouldn't have thought the FileCleaningTracker would have had a chance to do anything yet).

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13061772#comment-13061772 ]

jagub zhang commented on FILEUPLOAD-193:
----------------------------------------

Try remove your FileCleaningTracker. in fact, uploaded file always be removed by DiskFileItem#finalize

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13266611#comment-13266611 ]

Eli Segev commented on FILEUPLOAD-193:
--------------------------------------

I can reproduce this problem when the file name has 50 multi-byte characters, like あいうえおかきくけこはひふへほなにぬねのぁりるれろあいうえおかきくけこはひふへほなにぬねのぁりるれろあいうえおかきくけこはひふへほなにぬねのぁりるれろあいうえおかきくけこはひふへほなにぬねのぁりるれろ.docx.  If the file name is shortened, no exception takes place.  The stack trace is:
java.io.FileNotFoundException: D:\staging\%E3%81%82%E3%81%84%E3%
81%86%E3%81%88%E3%81%8A%E3%81%8B%E3%81%8D%E3%81%8F%E3%81%91%E3%81%93%E3%81%AF%E3%81%B2%E3%81%B5%E3%81%B8%E3%81%BB%E3%81%AA%E
3%81%AB%E3%81%AC%E3%81%AD%E3%81%AE%E3%81%81%E3%82%8A%E3%82%8B%E3%82%8C%E3%82%8D%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A
%E3%81%8B%E3%81%8D%E3%81%8F%E3%81%91%E3%81%93%E3%81%AF%E3%81%B2%E3%81%B5%E3%81%B8%E3%81%BB%E3%81%AA%E3%81%AB%E3%81%AC%E3%81%
AD%E3%81%AE%E3%81%81%E3%82%8A%E3%82%8B%E3%82%8C%E3%82%8D%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A%E3%81%8B%E3%81%8D%E3%8
1%8F%E3%81%91%E3%81%93%E3%81%AF%E3%81%B2%E3%81%B5%E3%81%B8%E3%81%BB%E3%81%AA%E3%81%AB%E3%81%AC%E3%81%AD%E3%81%AE%E3%81%81%E3
%82%8A%E3%82%8B%E3%82%8C%E3%82%8D%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A%E3%81%8B%E3%81%8D%E3%81%8F%E3%81%91%E3%81%93%
E3%81%AF%E3%81%B2%E3%81%B5%E3%81%B8%E3%81%BB%E3%81%AA%E3%81%AB%E3%81%AC%E3%81%AD%E3%81%AE%E3%81%81%E3%82%8A%E3%82%8B%E3%82%8
C%E3%82%8D.docx (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:449)

There is no issue with write permission or anything like this, since no other file has this issue.  The OS is Windows 7.
               

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13266718#comment-13266718 ]

Sebb commented on FILEUPLOAD-193:
---------------------------------

What is the total length of the file name, including parent directories?

There is a hard limit in windows, so you'll likely find the same issue with plain ascii file names too.
               

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13266885#comment-13266885 ]

Jochen Wiedmann commented on FILEUPLOAD-193:
--------------------------------------------

Most likely caused by an invalid file name. It is the fileupload users task to choose valid file name.
               

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13266891#comment-13266891 ]

Eli Segev commented on FILEUPLOAD-193:
--------------------------------------

The issue is in the length of the file name.  The hard limit in Windows is 255 characters and this is what happens here.  See here: http://windows.microsoft.com/en-us/windows-vista/file-names-and-file-name-extensions-frequently-asked-questions.  Encoding a Chinese file name increases the file name's size 9 fold and it goes above the hard limit.  Thanks to Sebb for pointing me at the right direction.
               

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13266967#comment-13266967 ]

Sebb commented on FILEUPLOAD-193:
---------------------------------

I think the clue is in this part of the trace (I should have noted it earlier):

bq. (The filename, directory name, or volume label syntax is incorrect)

The reference to a syntax error presumably refers to the excess length.

BTW, I'm not sure why this is treated as FileNotFoundException rather than some other IOException.
[The same happens if the file exists but cannot be written, e.g. is read-only]
The use of FNFE is confusing.
               

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13267067#comment-13267067 ]

Eli Segev commented on FILEUPLOAD-193:
--------------------------------------

If you notice, the issue happens in a native method and not in a pure Java code.  I guess the Java code in FileOutputStream could have chosen a different exception.
               

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (FILEUPLOAD-193) FileNotFoundException thrown by DiskFileItem.write

David Mollitor (Jira)
In reply to this post by David Mollitor (Jira)

    [ https://issues.apache.org/jira/browse/FILEUPLOAD-193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13276372#comment-13276372 ]

jagub zhang commented on FILEUPLOAD-193:
----------------------------------------

Another possibility.
If you upload a 0 byte file, FileNotFoundException will be occurred.
               

> FileNotFoundException thrown by DiskFileItem.write
> --------------------------------------------------
>
>                 Key: FILEUPLOAD-193
>                 URL: https://issues.apache.org/jira/browse/FILEUPLOAD-193
>             Project: Commons FileUpload
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: Ubuntu 10.10
> java version "1.6.0_24"
> Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
> Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)
>            Reporter: Dan Washusen
>            Priority: Critical
>
> Under certain conditions the DiskFileItem.write throws a FileNotFound exception.  It seems to be when outputFile.renameTo(file) fails.
> {code}java.io.FileNotFoundException: /tmp/UploadController/uploading/upload_69651d04_13000a31964__8000_00001651.tmp (No such file or directory)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.apache.commons.fileupload.disk.DiskFileItem.write(DiskFileItem.java:447)
>         at upload.UploadController.handle(UploadController.java:90)
>         ...{code}
> I can't see any obvious reason why the source file (outputFile) wouldn't exist...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira