Author: maartenc
Date: Wed Oct 1 14:21:11 2008
New Revision: 700932
URL: http://svn.apache.org/viewvc?rev=700932&view=rev
Log:
FIX: HttpClientHandler hanging in certain cases (IVY-930) (thanks to Scott
Hebert)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=700932&r1=700931&r2=700932&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Oct 1 14:21:11 2008
@@ -34,6 +34,7 @@
Tobias Himstedt
Ben Hale
Peter Hayes
+ Scott Hebert
Matt Inger
Anders Janmyr
Christer Jonsson
@@ -96,6 +97,7 @@
- FIX: StackOverflow when using ivy:settings with "ivy.instance" as id
(IVY-924)
- FIX: Maven Pom reader doesn't handle optional dependencies correctly in some
instances (IVY-926) (thanks to Phil Messenger)
- FIX: ivy:settings doesn't work if id is a property (IVY-925)
+- FIX: HttpClientHandler hanging in certain cases (IVY-930) (thanks to Scott
Hebert)
2.0.0-rc1
=====================================
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java?rev=700932&r1=700931&r2=700932&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
Wed Oct 1 14:21:11 2008
@@ -94,6 +94,7 @@
public InputStream openStream(URL url) throws IOException {
GetMethod get = doGet(url, 0);
if (!checkStatusCode(url, get)) {
+ get.releaseConnection();
throw new IOException(
"The HTTP response code for " + url + " did not indicate a
success."
+ " See log for more detail.");
@@ -103,15 +104,18 @@
public void download(URL src, File dest, CopyProgressListener l) throws
IOException {
GetMethod get = doGet(src, 0);
- // We can only figure the content we got is want we want if the status
is success.
- if (!checkStatusCode(src, get)) {
- throw new IOException(
- "The HTTP response code for " + src + " did not indicate a
success."
- + " See log for more detail.");
+ try {
+ // We can only figure the content we got is want we want if the
status is success.
+ if (!checkStatusCode(src, get)) {
+ 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));
+ } finally {
+ get.releaseConnection();
}
- FileUtil.copy(get.getResponseBodyAsStream(), dest, l);
- dest.setLastModified(getLastModified(get));
- get.releaseConnection();
}
public void upload(File src, URL dest, CopyProgressListener l) throws
IOException {
@@ -133,6 +137,7 @@
/* ignored */
}
}
+ put.releaseConnection();
}
}