Spec-Zone .ru
спецификации, руководства, описания, API
|
new URL
("http://www.example.com:-1/index.html")
.
Specifying a port number of -1
is not valid. However,
in previous releases the -1
was stripped off when
sending such URLS with HTTP commands. In 1.4.2, the -1
is left in the URL and this may cause problems for some HTTP
servers or proxies. Applications should not create URL instances
with a -1
port number. Assuming the -1
refers to the default port in this example, the correct way to
create this URL is new URL
("http://www.example.com/index.html")
. This note
only applies to the single argument URL constructor.This has been corrected in 1.4 so that an IOException is thrown for any http error from the server and a specific exception of FileNotFoundExeption when the resource is not found (ie: 404 or 410 response codes). The exception is thrown irrespective of the file type.
Applications that assumed an exception would not be thrown when
an http error is returned from the server need to be aware of this
change in 1.4 - see
Related to this issue is that HttpURLConnection.getErrorStream() method can now been used to read the error page from the http server when a http error is returned from the server. Previously getErrorStream() always returned null.
Applications that depend on toString() returning a
string with the resolved hostname should be aware of this
correction in 1.4 - see
Applications that depend on behaviour where subsequent lookups
always failed need to be aware of this issue - see
The following lists the known issues with PortUnreachableException :-
If DHCP is used in conjunction with dynamic DNS then there are
two options (i) change the name service search order in
/etc/nsswitch.conf to use dns before the hosts file (ie:
"hosts: dns files"), or (ii) configure InetAddress to use the DNS
name service provider instead of the default provider
(-Dsun.net.spi.nameservice.provider.1=dns,sun). This issue
is being tracked in