Merge GNU Classpath 0.99 into libjava.
From-SVN: r185741
This commit is contained in:
@@ -525,7 +525,27 @@ public class DatagramSocket
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkConnect(address.getHostAddress(), port);
|
||||
{
|
||||
if (address.isMulticastAddress())
|
||||
sm.checkMulticast(address);
|
||||
else
|
||||
{
|
||||
sm.checkConnect(address.getHostAddress(), port);
|
||||
sm.checkAccept(address.getHostAddress(), port);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isBound())
|
||||
{
|
||||
try
|
||||
{
|
||||
bind(new InetSocketAddress(0));
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
throw new Error("Binding socket failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -428,7 +428,9 @@ public class Socket
|
||||
* @exception IllegalBlockingModeException If this socket has an associated
|
||||
* channel, and the channel is in non-blocking mode
|
||||
* @exception SocketTimeoutException If the timeout is reached
|
||||
*
|
||||
* @throws SecurityException if the SocketAddress is an {@link InetSocketAddress}
|
||||
* and a security manager is present which does not
|
||||
* allow connections on the given host and port.
|
||||
* @since 1.4
|
||||
*/
|
||||
public void connect(SocketAddress endpoint, int timeout)
|
||||
@@ -440,6 +442,13 @@ public class Socket
|
||||
if (! (endpoint instanceof InetSocketAddress))
|
||||
throw new IllegalArgumentException("unsupported address type");
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
{
|
||||
InetSocketAddress inetAddr = (InetSocketAddress) endpoint;
|
||||
sm.checkConnect(inetAddr.getHostName(), inetAddr.getPort());
|
||||
}
|
||||
|
||||
// The Sun spec says that if we have an associated channel and
|
||||
// it is in non-blocking mode, we throw an IllegalBlockingModeException.
|
||||
// However, in our implementation if the channel itself initiated this
|
||||
|
||||
Reference in New Issue
Block a user