300
301 /** use serialVersionUID from JDK 1.0.2 for interoperability */
302 private static final long serialVersionUID = 3286316764910316507L;
303
304 /*
305 * Load net library into runtime, and perform initializations.
306 */
307 static {
308 String str = GetPropertyAction.privilegedGetProperty("java.net.preferIPv6Addresses");
309 if (str == null) {
310 preferIPv6Address = PREFER_IPV4_VALUE;
311 } else if (str.equalsIgnoreCase("true")) {
312 preferIPv6Address = PREFER_IPV6_VALUE;
313 } else if (str.equalsIgnoreCase("false")) {
314 preferIPv6Address = PREFER_IPV4_VALUE;
315 } else if (str.equalsIgnoreCase("system")) {
316 preferIPv6Address = PREFER_SYSTEM_VALUE;
317 } else {
318 preferIPv6Address = PREFER_IPV4_VALUE;
319 }
320 AccessController.doPrivileged(
321 new java.security.PrivilegedAction<>() {
322 public Void run() {
323 System.loadLibrary("net");
324 return null;
325 }
326 });
327 SharedSecrets.setJavaNetInetAddressAccess(
328 new JavaNetInetAddressAccess() {
329 public String getOriginalHostName(InetAddress ia) {
330 return ia.holder.getOriginalHostName();
331 }
332
333 public InetAddress getByName(String hostName,
334 InetAddress hostAddress)
335 throws UnknownHostException
336 {
337 return InetAddress.getByName(hostName, hostAddress);
338 }
339 }
340 );
341 init();
342 }
343
344 /**
345 * Constructor for the Socket.accept() method.
346 * This creates an empty InetAddress, which is filled in by
|
300
301 /** use serialVersionUID from JDK 1.0.2 for interoperability */
302 private static final long serialVersionUID = 3286316764910316507L;
303
304 /*
305 * Load net library into runtime, and perform initializations.
306 */
307 static {
308 String str = GetPropertyAction.privilegedGetProperty("java.net.preferIPv6Addresses");
309 if (str == null) {
310 preferIPv6Address = PREFER_IPV4_VALUE;
311 } else if (str.equalsIgnoreCase("true")) {
312 preferIPv6Address = PREFER_IPV6_VALUE;
313 } else if (str.equalsIgnoreCase("false")) {
314 preferIPv6Address = PREFER_IPV4_VALUE;
315 } else if (str.equalsIgnoreCase("system")) {
316 preferIPv6Address = PREFER_SYSTEM_VALUE;
317 } else {
318 preferIPv6Address = PREFER_IPV4_VALUE;
319 }
320 jdk.internal.access.SharedSecrets.getJavaLangAccess().loadLibrary("net");
321 SharedSecrets.setJavaNetInetAddressAccess(
322 new JavaNetInetAddressAccess() {
323 public String getOriginalHostName(InetAddress ia) {
324 return ia.holder.getOriginalHostName();
325 }
326
327 public InetAddress getByName(String hostName,
328 InetAddress hostAddress)
329 throws UnknownHostException
330 {
331 return InetAddress.getByName(hostName, hostAddress);
332 }
333 }
334 );
335 init();
336 }
337
338 /**
339 * Constructor for the Socket.accept() method.
340 * This creates an empty InetAddress, which is filled in by
|