You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Benjamin Riefenstahl (JIRA)" <ji...@apache.org> on 2009/09/16 15:11:58 UTC

[jira] Created: (HTTPCLIENT-878) FilePart.sendData does not complain about missing file

FilePart.sendData does not complain about missing file
------------------------------------------------------

                 Key: HTTPCLIENT-878
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-878
             Project: HttpComponents HttpClient
          Issue Type: Improvement
          Components: HttpClient
    Affects Versions: Snapshot
            Reporter: Benjamin Riefenstahl
            Priority: Minor


The situation in my code was this:

* Create a FilePartSource from an existing file.
* Do some housekeeping.
* Call HttpClient.executeMethod.

My bug was that HttpClient.executeMethod just sent an empty file.

My own problem was that the "housekeeping" mentioned above had moved
the file.

The intermediate culprit turned out to be FilePart.sendData.  It calls
FilePart.lengthOfData before opening the file stream.  lengthOfData
boils down to File.length which returns 0 if the file does not exist
and in that case FilePart avoids opening the file.

While this is a bug in my code, I wish that FilePart.sendData would
throw an exception in this situation, so that this error is more
easily seen and is more likely to come up during unit testing.  The
check could also go into FilePartSource.getLength.

It should be noted that the constructor of FilePartSource does check
that the file exists, but FilePartSource.getLength and
FilePart.sendData do not repeat that check.

I can create a patch, if that is necessary.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] Resolved: (HTTPCLIENT-878) FilePart.sendData does not complain about missing file

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-878.
------------------------------------------

    Resolution: Won't Fix

Benjamin,

There will no fixes in the 3.x branch other than for serious security / stability related issues. 

Please re-open this issue if you think that version 4.0 of HttpClient exhibits a similar problem, A patch would be quite welcome.

Oleg 

> FilePart.sendData does not complain about missing file
> ------------------------------------------------------
>
>                 Key: HTTPCLIENT-878
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-878
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: Snapshot
>            Reporter: Benjamin Riefenstahl
>            Priority: Minor
>
> The situation in my code was this:
> * Create a FilePartSource from an existing file.
> * Do some housekeeping.
> * Call HttpClient.executeMethod.
> My bug was that HttpClient.executeMethod just sent an empty file.
> My own problem was that the "housekeeping" mentioned above had moved
> the file.
> The intermediate culprit turned out to be FilePart.sendData.  It calls
> FilePart.lengthOfData before opening the file stream.  lengthOfData
> boils down to File.length which returns 0 if the file does not exist
> and in that case FilePart avoids opening the file.
> While this is a bug in my code, I wish that FilePart.sendData would
> throw an exception in this situation, so that this error is more
> easily seen and is more likely to come up during unit testing.  The
> check could also go into FilePartSource.getLength.
> It should be noted that the constructor of FilePartSource does check
> that the file exists, but FilePartSource.getLength and
> FilePart.sendData do not repeat that check.
> I can create a patch, if that is necessary.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org