< prev index next >
src/java.base/share/classes/sun/nio/ch/Net.java
Print this page
*** 52,62 ****
import sun.net.ext.ExtendedSocketOptions;
import sun.security.action.GetPropertyAction;
public class Net {
! private Net() { }
// unspecified protocol family
static final ProtocolFamily UNSPEC = new ProtocolFamily() {
public String name() {
return "UNSPEC";
--- 52,62 ----
import sun.net.ext.ExtendedSocketOptions;
import sun.security.action.GetPropertyAction;
public class Net {
! protected Net() { }
// unspecified protocol family
static final ProtocolFamily UNSPEC = new ProtocolFamily() {
public String name() {
return "UNSPEC";
*** 77,87 ****
private static volatile boolean isReusePortAvailable;
/**
* Tells whether dual-IPv4/IPv6 sockets should be used.
*/
! static boolean isIPv6Available() {
if (!checkedIPv6) {
isIPv6Available = isIPv6Available0();
checkedIPv6 = true;
}
return isIPv6Available;
--- 77,87 ----
private static volatile boolean isReusePortAvailable;
/**
* Tells whether dual-IPv4/IPv6 sockets should be used.
*/
! protected static boolean isIPv6Available() {
if (!checkedIPv6) {
isIPv6Available = isIPv6Available0();
checkedIPv6 = true;
}
return isIPv6Available;
*** 148,158 ****
if (!(sa instanceof InetSocketAddress))
throw new UnsupportedAddressTypeException();
return (InetSocketAddress)sa;
}
! static void translateToSocketException(Exception x)
throws SocketException
{
if (x instanceof SocketException)
throw (SocketException)x;
Exception nx = x;
--- 148,158 ----
if (!(sa instanceof InetSocketAddress))
throw new UnsupportedAddressTypeException();
return (InetSocketAddress)sa;
}
! public static void translateToSocketException(Exception x)
throws SocketException
{
if (x instanceof SocketException)
throw (SocketException)x;
Exception nx = x;
*** 178,188 ****
throw (RuntimeException)nx;
else
throw new Error("Untranslated exception", nx);
}
! static void translateException(Exception x,
boolean unknownHostForUnresolved)
throws IOException
{
if (x instanceof IOException)
throw (IOException)x;
--- 178,188 ----
throw (RuntimeException)nx;
else
throw new Error("Untranslated exception", nx);
}
! public static void translateException(Exception x,
boolean unknownHostForUnresolved)
throws IOException
{
if (x instanceof IOException)
throw (IOException)x;
*** 194,213 ****
throw new UnknownHostException();
}
translateToSocketException(x);
}
! static void translateException(Exception x)
throws IOException
{
translateException(x, false);
}
/**
* Returns the local address after performing a SecurityManager#checkConnect.
*/
! static InetSocketAddress getRevealedLocalAddress(InetSocketAddress addr) {
SecurityManager sm = System.getSecurityManager();
if (addr == null || sm == null)
return addr;
try{
--- 194,213 ----
throw new UnknownHostException();
}
translateToSocketException(x);
}
! public static void translateException(Exception x)
throws IOException
{
translateException(x, false);
}
/**
* Returns the local address after performing a SecurityManager#checkConnect.
*/
! public static InetSocketAddress getRevealedLocalAddress(InetSocketAddress addr) {
SecurityManager sm = System.getSecurityManager();
if (addr == null || sm == null)
return addr;
try{
*** 218,228 ****
addr = getLoopbackAddress(addr.getPort());
}
return addr;
}
! static String getRevealedLocalAddressAsString(InetSocketAddress addr) {
return System.getSecurityManager() == null ? addr.toString() :
getLoopbackAddress(addr.getPort()).toString();
}
private static InetSocketAddress getLoopbackAddress(int port) {
--- 218,228 ----
addr = getLoopbackAddress(addr.getPort());
}
return addr;
}
! public static String getRevealedLocalAddressAsString(InetSocketAddress addr) {
return System.getSecurityManager() == null ? addr.toString() :
getLoopbackAddress(addr.getPort()).toString();
}
private static InetSocketAddress getLoopbackAddress(int port) {
< prev index next >