[ https://issues.apache.org/jira/browse/VFS-789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mick Woo updated VFS-789: ------------------------- Description: 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 connect was not released. {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} was: rg.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 connect was not released. {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} > 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 connect was not released. > {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)