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

Gary D. Gregory commented on VFS-789:
-------------------------------------

Hi [~mick1992]

I'm not sure what you are proposing to do here. May you provide a PR on GitHub 
that demonstrates the problem in a unit test? If you have a fix, please do 
include it in your PR.

https://github.com/apache/commons-vfs

Gary

> org.apache.commons.vfs2.provider.http.HttpFileObject.doGetInputStream() does 
> not release connection when an exception is thrown, such as the http method 
> return status code is not 200
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: VFS-789
>                 URL: https://issues.apache.org/jira/browse/VFS-789
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.4, 2.3, 2.4.1, 2.5.0, 2.6.0
>            Reporter: Mick Woo
>            Priority: Major
>             Fix For: 2.4, 2.3, 2.4.1, 2.5.0, 2.6.0
>
>
> org.apache.commons.vfs2.provider.http.HttpFileObject.doGetInputStream() does 
> not release connection when an exception is thrown, such as the http method 
> return status code is not 200.
> When throw the FileSystemException, the connection was not released.
> The return status code of 404,can be released by garbage collector in 
> MultiThreadedHttpConnectionManager. But 403 can't.
> {code:java}
> // org.apache.commons.vfs2.provider.http.HttpFileObject
> // version 2.6.0
> @Override
> protected InputStream doGetInputStream(final int bufferSize) throws Exception 
> {
>     final GetMethod getMethod = new GetMethod();
>     setupMethod(getMethod);
>     final int status = 
> getAbstractFileSystem().getClient().executeMethod(getMethod);
>     if (status == HttpURLConnection.HTTP_NOT_FOUND) {
>         throw new FileNotFoundException(getName());
>     }
>     if (status != HttpURLConnection.HTTP_OK) {
>         throw new FileSystemException("vfs.provider.http/get.error", 
> getName(), Integer.valueOf(status));
>     }
>     return new HttpInputStream(getMethod, bufferSize);
> }
> {code}
> {code:java}
> // org.apache.commons.vfs2.provider.http.HttpFileObject
> // version 2.3
> @Override
> protected InputStream doGetInputStream() throws Exception {
>     final GetMethod getMethod = new GetMethod();
>     setupMethod(getMethod);
>     final int status = 
> getAbstractFileSystem().getClient().executeMethod(getMethod);
>     if (status == HttpURLConnection.HTTP_NOT_FOUND) {
>         throw new FileNotFoundException(getName());
>     }
>     if (status != HttpURLConnection.HTTP_OK) {
>         throw new FileSystemException("vfs.provider.http/get.error", 
> getName(), Integer.valueOf(status));
>     }
>     return new HttpInputStream(getMethod);
> }
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to