Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
2.0-RC1
-
None
-
None
Description
Using Commons HttpClient and an URL Resolver, it is possible for the HttpClientHandler to hang.
The following seems to correct the problem:
public InputStream openStream(URL url) throws IOException { GetMethod get = doGet(url); if (!checkStatusCode(url, get)) { // Make sure the number of connections does not get exhausted get.releaseConnection(); // throw new IOException( "The HTTP response code for " + url + " did not indicate a success." + " See log for more detail."); } return new GETInputStream(get); } public void download(URL src, File dest, CopyProgressListener l) throws IOException { GetMethod get = doGet(src); // We can only figure the content we got is want we want if the status is success. if (!checkStatusCode(src, get)) { // Make sure the number of connections does not get exhausted get.releaseConnection(); // throw new IOException( "The HTTP response code for " + src + " did not indicate a success." + " See log for more detail."); } FileUtil.copy(get.getResponseBodyAsStream(), dest, l); dest.setLastModified(getLastModified(get)); get.releaseConnection(); }
Attachments
Issue Links
- is duplicated by
-
IVY-934 ivy:buildnumber Task can cause ivy:resolve to 'hang' forever
- Resolved