harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Li Jing Qin (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6656) [classlib][luni]HttpURLConnection.connect should throw ConnectException instead of IllegalArgumentException when the port is set to -1.
Date Sat, 25 Sep 2010 07:11:33 GMT
[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.


Mime
View raw message