2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java: (isAnyLocalAddress): Implemented. (isLoopbackAddress): Implemented, comment added. (isLinkLocalAddress): Implemented, documentation added. (isSiteLocalAddress): Implemented, documentation added. (isMCGlobal): Implemented, documentation added. (isMCNodeLocal): Implemented, documentation added. (isMCLinkLocal): Implemented, documentation added. (isMCSiteLocal): Implemented, documentation added. (isMCOrgLocal): Implemented, documentation added. (getHostName): Documentation added. (getCanonicalHostName): Implemented, documentation added. (getAddress): Documentation added. (hashCode): Documentation added. (equals): Documentation added. (toString): Fixed implementation. (getByAddress): Use Inet4Address and Inet6Address. (lookup): New linewrap. (getByName): SecurityManager check added, support Inet4Address and Inet6address, comments added. (getAllByName): SecurityManager check added, comments added. * java/net/Inet6Address.java: (Inet6Address): Initialize parent class with addr instead of null. * java/net/URL.java (equals): Documentation added. (getFile): Documentation added. (hashCode): Documentation added. * java/net/natInetAddress.cc: (aton): Fix IPv6 support. * java/net/natPlainDatagramSocketImpl.cc: (peek): Throw PortUnreachableException when suitable. (peekData): Throw PortUnreachableException when suitable. (send): Throw PortUnreachableException when suitable. (receive): Throw PortUnreachableException when suitable. From-SVN: r58704
This commit is contained in:
parent
04c7481ed2
commit
75fe3383d8
|
@ -1,3 +1,40 @@
|
||||||
|
2002-11-01 Michael Koch <konqueror@gmx.de>
|
||||||
|
|
||||||
|
* java/net/InetAddress.java:
|
||||||
|
(isAnyLocalAddress): Implemented.
|
||||||
|
(isLoopbackAddress): Implemented, comment added.
|
||||||
|
(isLinkLocalAddress): Implemented, documentation added.
|
||||||
|
(isSiteLocalAddress): Implemented, documentation added.
|
||||||
|
(isMCGlobal): Implemented, documentation added.
|
||||||
|
(isMCNodeLocal): Implemented, documentation added.
|
||||||
|
(isMCLinkLocal): Implemented, documentation added.
|
||||||
|
(isMCSiteLocal): Implemented, documentation added.
|
||||||
|
(isMCOrgLocal): Implemented, documentation added.
|
||||||
|
(getHostName): Documentation added.
|
||||||
|
(getCanonicalHostName): Implemented, documentation added.
|
||||||
|
(getAddress): Documentation added.
|
||||||
|
(hashCode): Documentation added.
|
||||||
|
(equals): Documentation added.
|
||||||
|
(toString): Fixed implementation.
|
||||||
|
(getByAddress): Use Inet4Address and Inet6Address.
|
||||||
|
(lookup): New linewrap.
|
||||||
|
(getByName): SecurityManager check added, support Inet4Address and
|
||||||
|
Inet6address, comments added.
|
||||||
|
(getAllByName): SecurityManager check added, comments added.
|
||||||
|
* java/net/Inet6Address.java:
|
||||||
|
(Inet6Address): Initialize parent class with addr instead of null.
|
||||||
|
* java/net/URL.java
|
||||||
|
(equals): Documentation added.
|
||||||
|
(getFile): Documentation added.
|
||||||
|
(hashCode): Documentation added.
|
||||||
|
* java/net/natInetAddress.cc:
|
||||||
|
(aton): Fix IPv6 support.
|
||||||
|
* java/net/natPlainDatagramSocketImpl.cc:
|
||||||
|
(peek): Throw PortUnreachableException when suitable.
|
||||||
|
(peekData): Throw PortUnreachableException when suitable.
|
||||||
|
(send): Throw PortUnreachableException when suitable.
|
||||||
|
(receive): Throw PortUnreachableException when suitable.
|
||||||
|
|
||||||
2002-10-27 Mark Wielaard <mark@klomp.org>
|
2002-10-27 Mark Wielaard <mark@klomp.org>
|
||||||
|
|
||||||
* java/util/zip/ZipFile.java (readLeShort): Take and use DataInput as
|
* java/util/zip/ZipFile.java (readLeShort): Take and use DataInput as
|
||||||
|
|
|
@ -67,7 +67,7 @@ public final class Inet6Address extends InetAddress
|
||||||
*/
|
*/
|
||||||
protected Inet6Address (byte[] addr, String host)
|
protected Inet6Address (byte[] addr, String host)
|
||||||
{
|
{
|
||||||
super (null, host);
|
super (addr, host);
|
||||||
this.ipaddress = addr;
|
this.ipaddress = addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,9 @@ public class InetAddress implements Serializable
|
||||||
*/
|
*/
|
||||||
public boolean isAnyLocalAddress ()
|
public boolean isAnyLocalAddress ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// This is the IPv4 implementation.
|
||||||
return false;
|
// Any class derived from InetAddress should override this.
|
||||||
|
return addr == zeros;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,89 +125,169 @@ public class InetAddress implements Serializable
|
||||||
*/
|
*/
|
||||||
public boolean isLoopbackAddress ()
|
public boolean isLoopbackAddress ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// This is the IPv4 implementation.
|
||||||
|
// Any class derived from InetAddress should override this.
|
||||||
|
|
||||||
return addr[0] == 0x7F;
|
return addr[0] == 0x7F;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Utility routine to check if InetAddress is a link local address
|
||||||
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
public boolean isLinkLocalAddress ()
|
public boolean isLinkLocalAddress ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// This is the IPv4 implementation.
|
||||||
|
// Any class derived from InetAddress should override this.
|
||||||
|
|
||||||
|
// XXX: This seems to not exist with IPv4 addresses
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Utility routine to check if InetAddress is a site local address
|
||||||
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
public boolean isSiteLocalAddress ()
|
public boolean isSiteLocalAddress ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// This is the IPv4 implementation.
|
||||||
|
// Any class derived from InetAddress should override this.
|
||||||
|
|
||||||
|
// 10.0.0.0/8
|
||||||
|
if (addr[0] == 0x0A)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// XXX: Suns JDK 1.4.1 (on Linux) seems to have a bug here:
|
||||||
|
// it says 172.16.0.0 - 172.255.255.255 are site local addresses
|
||||||
|
|
||||||
|
// 172.16.0.0/12
|
||||||
|
if (addr[0] == 0xAC && (addr[1] & 0xF0) == 0x01)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// 192.168.0.0/16
|
||||||
|
if (addr[0] == 0xC0 && addr[1] == 0xA8)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// XXX: Do we need to check more addresses here ?
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Utility routine to check if InetAddress is a global multicast address
|
||||||
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
public boolean isMCGlobal ()
|
public boolean isMCGlobal ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// This is the IPv4 implementation.
|
||||||
|
// Any class derived from InetAddress should override this.
|
||||||
|
|
||||||
|
// XXX: This seems to not exist with IPv4 addresses
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Utility reoutine to check if InetAddress is a node local multicast address
|
||||||
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
public boolean isMCNodeLocal ()
|
public boolean isMCNodeLocal ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// This is the IPv4 implementation.
|
||||||
|
// Any class derived from InetAddress should override this.
|
||||||
|
|
||||||
|
// XXX: This seems to not exist with IPv4 addresses
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Utility reoutine to check if InetAddress is a link local multicast address
|
||||||
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
public boolean isMCLinkLocal ()
|
public boolean isMCLinkLocal ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// This is the IPv4 implementation.
|
||||||
|
// Any class derived from InetAddress should override this.
|
||||||
|
|
||||||
|
if (!isMulticastAddress ())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return (addr[0] == 0xE0
|
||||||
|
&& addr[1] == 0x00
|
||||||
|
&& addr[2] == 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Utility reoutine to check if InetAddress is a site local multicast address
|
||||||
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
public boolean isMCSiteLocal ()
|
public boolean isMCSiteLocal ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// This is the IPv4 implementation.
|
||||||
|
// Any class derived from InetAddress should override this.
|
||||||
|
|
||||||
|
// XXX: This seems to not exist with IPv4 addresses
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Utility reoutine to check if InetAddress is a organization local
|
||||||
|
* multicast address
|
||||||
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
public boolean isMCOrgLocal ()
|
public boolean isMCOrgLocal ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
// This is the IPv4 implementation.
|
||||||
|
// Any class derived from InetAddress should override this.
|
||||||
|
|
||||||
|
// XXX: This seems to not exist with IPv4 addresses
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hostname represented by this InetAddress
|
||||||
|
*/
|
||||||
public String getHostName ()
|
public String getHostName ()
|
||||||
{
|
{
|
||||||
if (hostName == null)
|
if (hostName == null)
|
||||||
lookup (null, this, false);
|
lookup (null, this, false);
|
||||||
|
|
||||||
return hostName;
|
return hostName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the canonical hostname represented by this InetAddress
|
||||||
|
*
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
public String getCanonicalHostName ()
|
public String getCanonicalHostName ()
|
||||||
{
|
{
|
||||||
// FIXME: implement this
|
SecurityManager sm = System.getSecurityManager ();
|
||||||
return "";
|
if (sm != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sm.checkConnect (hostName, -1);
|
||||||
|
}
|
||||||
|
catch (SecurityException e)
|
||||||
|
{
|
||||||
|
return getHostAddress ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to find the FDQN now
|
||||||
|
InetAddress address = new InetAddress (getAddress (), null);
|
||||||
|
return address.getHostName ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the IP address of this InetAddress as array of bytes
|
||||||
|
*/
|
||||||
public byte[] getAddress ()
|
public byte[] getAddress ()
|
||||||
{
|
{
|
||||||
// An experiment shows that JDK1.2 returns a different byte array each
|
// An experiment shows that JDK1.2 returns a different byte array each
|
||||||
|
@ -284,9 +365,13 @@ public class InetAddress implements Serializable
|
||||||
break;
|
break;
|
||||||
sbuf.append('.');
|
sbuf.append('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return sbuf.toString();
|
return sbuf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a hashcode of the InetAddress
|
||||||
|
*/
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
// There hashing algorithm is not specified, but a simple experiment
|
// There hashing algorithm is not specified, but a simple experiment
|
||||||
|
@ -299,6 +384,9 @@ public class InetAddress implements Serializable
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the InetAddress object with another one.
|
||||||
|
*/
|
||||||
public boolean equals (Object obj)
|
public boolean equals (Object obj)
|
||||||
{
|
{
|
||||||
if (obj == null || ! (obj instanceof InetAddress))
|
if (obj == null || ! (obj instanceof InetAddress))
|
||||||
|
@ -325,7 +413,12 @@ public class InetAddress implements Serializable
|
||||||
*/
|
*/
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return getHostName()+'/'+getHostAddress();
|
String hostname = getHostName ();
|
||||||
|
|
||||||
|
if (hostname == "")
|
||||||
|
hostname = getHostAddress ();
|
||||||
|
|
||||||
|
return hostname + '/' + getHostAddress ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -346,7 +439,10 @@ public class InetAddress implements Serializable
|
||||||
if (addr.length != 4 && addr.length != 16)
|
if (addr.length != 4 && addr.length != 16)
|
||||||
throw new UnknownHostException ("IP address has illegal length");
|
throw new UnknownHostException ("IP address has illegal length");
|
||||||
|
|
||||||
return new InetAddress (addr, "");
|
if (addr.length == 4)
|
||||||
|
return new Inet4Address (addr, null);
|
||||||
|
|
||||||
|
return new Inet6Address (addr, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -376,8 +472,8 @@ public class InetAddress implements Serializable
|
||||||
* Otherwise, return null. */
|
* Otherwise, return null. */
|
||||||
private static native byte[] aton (String host);
|
private static native byte[] aton (String host);
|
||||||
|
|
||||||
private static native InetAddress[] lookup
|
private static native InetAddress[] lookup (String hostname,
|
||||||
(String hostname, InetAddress addr, boolean all);
|
InetAddress addr, boolean all);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the IP address of a host, given the host's name.
|
* Determines the IP address of a host, given the host's name.
|
||||||
|
@ -387,17 +483,43 @@ public class InetAddress implements Serializable
|
||||||
* @exception SecurityException If a security manager exists and its
|
* @exception SecurityException If a security manager exists and its
|
||||||
* checkConnect method doesn't allow the operation
|
* checkConnect method doesn't allow the operation
|
||||||
*/
|
*/
|
||||||
public static InetAddress getByName (String host)
|
public static InetAddress getByName (String hostname)
|
||||||
throws UnknownHostException
|
throws UnknownHostException
|
||||||
{
|
{
|
||||||
if (host == null)
|
SecurityManager sm = System.getSecurityManager();
|
||||||
|
if (sm != null)
|
||||||
|
sm.checkConnect (hostname, -1);
|
||||||
|
|
||||||
|
// Default to current host if necessary
|
||||||
|
if (hostname == null)
|
||||||
return getLocalHost();
|
return getLocalHost();
|
||||||
byte[] address = aton(host);
|
|
||||||
|
// Assume that the host string is an IP address
|
||||||
|
byte[] address = aton (hostname);
|
||||||
if (address != null)
|
if (address != null)
|
||||||
return new InetAddress(address, null);
|
{
|
||||||
InetAddress iaddr = new InetAddress(null, host);
|
if (address.length == 4)
|
||||||
lookup(host, iaddr, false);
|
return new Inet4Address (address, null);
|
||||||
return iaddr;
|
else if (address.length == 16)
|
||||||
|
{
|
||||||
|
if ((address[10] == 0xFF) && (address[11] == 0xFF))
|
||||||
|
{
|
||||||
|
byte[] ip4addr = new byte[4];
|
||||||
|
ip4addr[0] = address[12];
|
||||||
|
ip4addr[1] = address[13];
|
||||||
|
ip4addr[2] = address[14];
|
||||||
|
ip4addr[3] = address[15];
|
||||||
|
return new Inet4Address (ip4addr, null);
|
||||||
|
}
|
||||||
|
return new Inet6Address (address, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new UnknownHostException ("Address has invalid length");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to resolve the host by DNS
|
||||||
|
InetAddress[] addresses = getAllByName (hostname);
|
||||||
|
return addresses[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -409,20 +531,28 @@ public class InetAddress implements Serializable
|
||||||
* @exception SecurityException If a security manager exists and its
|
* @exception SecurityException If a security manager exists and its
|
||||||
* checkConnect method doesn't allow the operation
|
* checkConnect method doesn't allow the operation
|
||||||
*/
|
*/
|
||||||
public static InetAddress[] getAllByName (String host)
|
public static InetAddress[] getAllByName (String hostname)
|
||||||
throws UnknownHostException
|
throws UnknownHostException
|
||||||
{
|
{
|
||||||
byte[] address = aton(host);
|
SecurityManager sm = System.getSecurityManager();
|
||||||
|
if (sm != null)
|
||||||
|
sm.checkConnect(hostname, -1);
|
||||||
|
|
||||||
|
// Check if hostname is an IP address
|
||||||
|
byte[] address = aton (hostname);
|
||||||
if (address != null)
|
if (address != null)
|
||||||
{
|
{
|
||||||
InetAddress[] result = new InetAddress[1];
|
InetAddress[] result = new InetAddress[1];
|
||||||
result[0] = new InetAddress(address, null);
|
result[0] = new InetAddress(address, null);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return lookup(host, null, true);
|
|
||||||
|
// Try to resolve the hostname by DNS
|
||||||
|
return lookup (hostname, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static final byte[] zeros = {0,0,0,0};
|
static final byte[] zeros = {0,0,0,0};
|
||||||
|
|
||||||
/* dummy InetAddress, used to bind socket to any (all) network interfaces */
|
/* dummy InetAddress, used to bind socket to any (all) network interfaces */
|
||||||
static final InetAddress ANY_IF = new InetAddress(zeros, null);
|
static final InetAddress ANY_IF = new InetAddress(zeros, null);
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,9 @@ public final class URL implements Serializable
|
||||||
hashCode = hashCode(); // Used for serialization.
|
hashCode = hashCode(); // Used for serialization.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if two URLs are equal
|
||||||
|
*/
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (obj == null || ! (obj instanceof URL))
|
if (obj == null || ! (obj instanceof URL))
|
||||||
|
@ -287,6 +290,9 @@ public final class URL implements Serializable
|
||||||
return getContent();
|
return getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the file of the URL
|
||||||
|
*/
|
||||||
public String getFile()
|
public String getFile()
|
||||||
{
|
{
|
||||||
return file;
|
return file;
|
||||||
|
@ -367,6 +373,9 @@ public final class URL implements Serializable
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a hashcode computed by the URLStreamHandler of this URL
|
||||||
|
*/
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
// JCL book says this is computed using (only) the hashcodes of the
|
// JCL book says this is computed using (only) the hashcodes of the
|
||||||
|
|
|
@ -121,7 +121,7 @@ java::net::InetAddress::aton (jstring host)
|
||||||
#endif
|
#endif
|
||||||
#if defined (HAVE_INET_PTON) && defined (HAVE_INET6)
|
#if defined (HAVE_INET_PTON) && defined (HAVE_INET6)
|
||||||
char inet6_addr[16];
|
char inet6_addr[16];
|
||||||
if (len == 0 && inet_pton (AF_INET6, hostname, inet6_addr) > 0)
|
if (len != 0 && inet_pton (AF_INET6, hostname, inet6_addr) > 0)
|
||||||
{
|
{
|
||||||
bytes = inet6_addr;
|
bytes = inet6_addr;
|
||||||
blen = 16;
|
blen = 16;
|
||||||
|
|
|
@ -65,6 +65,7 @@ _Jv_bind (int fd, struct sockaddr *addr, int addrlen)
|
||||||
#include <java/net/InetAddress.h>
|
#include <java/net/InetAddress.h>
|
||||||
#include <java/net/NetworkInterface.h>
|
#include <java/net/NetworkInterface.h>
|
||||||
#include <java/net/DatagramPacket.h>
|
#include <java/net/DatagramPacket.h>
|
||||||
|
#include <java/net/PortUnreachableException.h>
|
||||||
#include <java/lang/InternalError.h>
|
#include <java/lang/InternalError.h>
|
||||||
#include <java/lang/Object.h>
|
#include <java/lang/Object.h>
|
||||||
#include <java/lang/Boolean.h>
|
#include <java/lang/Boolean.h>
|
||||||
|
@ -328,6 +329,8 @@ java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *i)
|
||||||
return rport;
|
return rport;
|
||||||
error:
|
error:
|
||||||
char* strerr = strerror (errno);
|
char* strerr = strerror (errno);
|
||||||
|
if (errno == ECONNREFUSED)
|
||||||
|
throw new PortUnreachableException (JvNewStringUTF (strerr));
|
||||||
throw new java::io::IOException (JvNewStringUTF (strerr));
|
throw new java::io::IOException (JvNewStringUTF (strerr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,6 +393,8 @@ java::net::PlainDatagramSocketImpl::peekData(java::net::DatagramPacket *p)
|
||||||
return rport;
|
return rport;
|
||||||
error:
|
error:
|
||||||
char* strerr = strerror (errno);
|
char* strerr = strerror (errno);
|
||||||
|
if (errno == ECONNREFUSED)
|
||||||
|
throw new PortUnreachableException (JvNewStringUTF (strerr));
|
||||||
throw new java::io::IOException (JvNewStringUTF (strerr));
|
throw new java::io::IOException (JvNewStringUTF (strerr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,6 +446,8 @@ java::net::PlainDatagramSocketImpl::send (java::net::DatagramPacket *p)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char* strerr = strerror (errno);
|
char* strerr = strerror (errno);
|
||||||
|
if (errno == ECONNREFUSED)
|
||||||
|
throw new PortUnreachableException (JvNewStringUTF (strerr));
|
||||||
throw new java::io::IOException (JvNewStringUTF (strerr));
|
throw new java::io::IOException (JvNewStringUTF (strerr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,6 +510,8 @@ java::net::PlainDatagramSocketImpl::receive (java::net::DatagramPacket *p)
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
char* strerr = strerror (errno);
|
char* strerr = strerror (errno);
|
||||||
|
if (errno == ECONNREFUSED)
|
||||||
|
throw new PortUnreachableException (JvNewStringUTF (strerr));
|
||||||
throw new java::io::IOException (JvNewStringUTF (strerr));
|
throw new java::io::IOException (JvNewStringUTF (strerr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue