You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "Scott Hebert (JIRA)" <ji...@apache.org> on 2008/10/01 22:41:46 UTC

[jira] Created: (IVY-930) HttpClientHandler hanging in certain cases

HttpClientHandler hanging in certain cases
------------------------------------------

                 Key: IVY-930
                 URL: https://issues.apache.org/jira/browse/IVY-930
             Project: Ivy
          Issue Type: Bug
    Affects Versions: 2.0-RC1
            Reporter: Scott Hebert
            Priority: Blocker


Using Commons HttpClient and an URL Resolver, it is possible for the HttpClientHandler to hang.

The following seems to correct the problem:

{code:java}
    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();
    }

{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (IVY-930) HttpClientHandler hanging in certain cases

Posted by "Maarten Coene (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maarten Coene reassigned IVY-930:
---------------------------------

    Assignee: Maarten Coene

> HttpClientHandler hanging in certain cases
> ------------------------------------------
>
>                 Key: IVY-930
>                 URL: https://issues.apache.org/jira/browse/IVY-930
>             Project: Ivy
>          Issue Type: Bug
>    Affects Versions: 2.0-RC1
>            Reporter: Scott Hebert
>            Assignee: Maarten Coene
>            Priority: Blocker
>
> Using Commons HttpClient and an URL Resolver, it is possible for the HttpClientHandler to hang.
> The following seems to correct the problem:
> {code:java}
>     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();
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (IVY-930) HttpClientHandler hanging in certain cases

Posted by "Maarten Coene (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maarten Coene updated IVY-930:
------------------------------

    Fix Version/s:     (was: trunk)
                   2.0-RC2

> HttpClientHandler hanging in certain cases
> ------------------------------------------
>
>                 Key: IVY-930
>                 URL: https://issues.apache.org/jira/browse/IVY-930
>             Project: Ivy
>          Issue Type: Bug
>    Affects Versions: 2.0-RC1
>            Reporter: Scott Hebert
>            Assignee: Maarten Coene
>            Priority: Blocker
>             Fix For: 2.0-RC2
>
>
> Using Commons HttpClient and an URL Resolver, it is possible for the HttpClientHandler to hang.
> The following seems to correct the problem:
> {code:java}
>     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();
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (IVY-930) HttpClientHandler hanging in certain cases

Posted by "Maarten Coene (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-930?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maarten Coene resolved IVY-930.
-------------------------------

       Resolution: Fixed
    Fix Version/s: trunk

Thank you for reporting!

I've committed your (slighlty modified) patch into SVN trunk.
Please give it a try and post your feedback here.

> HttpClientHandler hanging in certain cases
> ------------------------------------------
>
>                 Key: IVY-930
>                 URL: https://issues.apache.org/jira/browse/IVY-930
>             Project: Ivy
>          Issue Type: Bug
>    Affects Versions: 2.0-RC1
>            Reporter: Scott Hebert
>            Assignee: Maarten Coene
>            Priority: Blocker
>             Fix For: trunk
>
>
> Using Commons HttpClient and an URL Resolver, it is possible for the HttpClientHandler to hang.
> The following seems to correct the problem:
> {code:java}
>     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();
>     }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.