Details
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 connection was not released.
The return status code of 404,can be released by garbage collector in MultiThreadedHttpConnectionManager. But 403 can't.
// 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); }
// 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); }