You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Li Jing Qin (JIRA)" <ji...@apache.org> on 2010/09/25 09:11:33 UTC

[jira] Created: (HARMONY-6656) [classlib][luni]HttpURLConnection.connect should throw ConnectException instead of IllegalArgumentException when the port is set to -1.

[classlib][luni]HttpURLConnection.connect should throw ConnectException instead of IllegalArgumentException when the port is set to -1.
---------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-6656
                 URL: https://issues.apache.org/jira/browse/HARMONY-6656
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 5.0M15
         Environment: All
            Reporter: Li Jing Qin
             Fix For: 5.0M16


The root cause is we set port is -1. Below is the description:
1. -1 is set to be the default port. For example, http will set port to 80, https will set port to 443. See org.apache.harmony.luni.internal.net.www.protocol.http.HttpConfiguration.
2. The uri in the HttpConfiguration is from the url.toURI(). If the url's port is -1, url.toURI().getHost() will return null (as expected). 
3. The connection will new a InetSocketAddress, whose parameter will be host(null) and port(default port). This will cause a IllegalArgumentException.

What's in the patch:
1. use uri.toURL().getHost() to get the orignal host instead of null.
2. add the test case
3. remove the unused code in the HttpConfiguration(URI uri, Proxy proxy).

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


[jira] Updated: (HARMONY-6656) [classlib][luni]HttpURLConnection.connect should throw ConnectException instead of IllegalArgumentException when the port is set to -1.

Posted by "Li Jing Qin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-6656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Li Jing Qin updated HARMONY-6656:
---------------------------------

    Attachment: HARMONY-6656.diff

> [classlib][luni]HttpURLConnection.connect should throw ConnectException instead of IllegalArgumentException when the port is set to -1.
> ---------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6656
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6656
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M15
>         Environment: All
>            Reporter: Li Jing Qin
>             Fix For: 5.0M16
>
>         Attachments: HARMONY-6656.diff
>
>
> The root cause is we set port is -1. Below is the description:
> 1. -1 is set to be the default port. For example, http will set port to 80, https will set port to 443. See org.apache.harmony.luni.internal.net.www.protocol.http.HttpConfiguration.
> 2. The uri in the HttpConfiguration is from the url.toURI(). If the url's port is -1, url.toURI().getHost() will return null (as expected). 
> 3. The connection will new a InetSocketAddress, whose parameter will be host(null) and port(default port). This will cause a IllegalArgumentException.
> What's in the patch:
> 1. use uri.toURL().getHost() to get the orignal host instead of null.
> 2. add the test case
> 3. remove the unused code in the HttpConfiguration(URI uri, Proxy proxy).

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