users@jersey.java.net

[Jersey] Re: File upload is broken in Jersey 2.17

From: Scott Palmer <swpalmer_at_gmail.com>
Date: Wed, 13 May 2015 09:42:44 -0400

Done.
https://java.net/jira/browse/JERSEY-2862

Scott

P.S. Jersey 2.17 was released two months ago but it is listed under the
"unreleased versions" part of the version selection dropdown.

On Wed, May 13, 2015 at 5:01 AM, Marek Potociar <marek.potociar_at_oracle.com>
wrote:

> Hi Scott,
>
> Can you please open a new bug in our Jira?
>
> Thank you,
> Marek
>
> On 12 May 2015, at 18:32, Scott Palmer <swpalmer_at_gmail.com> wrote:
>
> This is the commit that did it:
>
>
> https://github.com/jersey/jersey/commit/d90369ca0e872df280979f04669894871f5c8189#diff-71e5b60df38390f13c313b6cc9847efd
>
> The problem is that the temp file can't be renamed because an empty file
> with the destination name is created and left there, blocking the moveTo
> from succeeding.
>
>
> https://github.com/jersey/jersey/blob/master/media/multipart/src/main/java/org/glassfish/jersey/media/multipart/internal/FormDataParamValueFactoryProvider.java#L253
>
>
> The problem is hidden because the ultimate renameTo call in WeakDataFile
> simply logs the failure without letting the caller know that the rename
> failed.
>
> May 12, 2015 11:40:50 AM org.jvnet.mimepull.WeakDataFile renameTo
> INFO: File
> C:\Users\SCOTT~1.PAL\AppData\Local\Temp\MIME9174014175637264696.tmp was not
> moved to C:\Users\SCOTT~1.PAL\AppData\Local\Temp\rep818068880122345050tmp
>
> The result is that the web service, with a parameter declared as:
> @FormDataParam("file") File file, is always given a reference to an empty
> temp file.
>
> Regards,
>
> Scott
>
>
>