JERSEY-1667: Incorrect handling of file upload errors when temp files cannot be written

 - fix (+ refactoring)
 - integration test reproducing the issue

Change-Id: Ib70e371b7eaec4bc0b4ae9823b0bb62d16670c15