URLConnection.connect() throws incorrect exception for unresolved addresses
Guillermo Rodriguez Garcia <[email protected]> Thu, 14 Apr 2016 12:38:45 +0200
| Newsgroups | gmane.comp.java.classpath.devel |
|---|---|
| Message-ID | <CABDcavYtRNP68AfhD8-Kgj+0LRyO5GHh_KiB0GEZ6zU0TUzE2g@mail.gmail.com> |
--001a11438032b3fa3e05306f7f48 Content-Type: text/plain; charset=UTF-8 According to the API specification, the URLConnection.connect() method should throw an IOException if an error occurs. However in GNU Classpath if the address cannot be resolved, a java.nio.channels.UnresolvedAddressException is thrown instead. UnresolvedAddressException is a subclass of IllegalArgumentException, not IOException, so this breaks the API contract. I have added a bug in the bugtracker for this including sample code. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70661 -- Guillermo Rodriguez Garcia [email protected] --001a11438032b3fa3e05306f7f48 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">According to the API specification, the URLConnection.conn= ect() method should throw an IOException if an error occurs. However in GNU= Classpath if the address cannot be resolved, a java.nio.channels.Unresolve= dAddressException is thrown instead. UnresolvedAddressException is a subcla= ss of IllegalArgumentException, not IOException, so this breaks the API con= tract.<div><br></div><div>I have added a bug in the bugtracker for this inc= luding sample code.</div><div><br></div><div><a href=3D"https://gcc.gnu.org= /bugzilla/show_bug.cgi?id=3D70661">https://gcc.gnu.org/bugzilla/show_bug.cg= i?id=3D70661</a></div><div><br>--<br>Guillermo Rodriguez Garcia<br><a href= =3D"mailto:[email protected]">[email protected]</a> </div></div> --001a11438032b3fa3e05306f7f48--