< prev index next >
src/java.base/unix/classes/sun/net/PortConfig.java
Print this page
rev 55686 : 8227587: Add internal privileged System.loadLibrary
Reviewed-by: rriggs, mchung
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -23,11 +23,11 @@
* questions.
*/
package sun.net;
-import java.security.AccessController;
+import sun.security.action.GetPropertyAction;
/**
* Determines the ephemeral port range in use on this system.
* If this cannot be determined, then the default settings
* of the OS are returned.
@@ -39,15 +39,12 @@
private static final int upper, lower;
private PortConfig() {}
static {
- AccessController.doPrivileged(
- new java.security.PrivilegedAction<>() {
- public Void run() {
- System.loadLibrary("net");
- String os = System.getProperty("os.name");
+ jdk.internal.loader.BootLoader.loadLibrary("net");
+ String os = GetPropertyAction.privilegedGetProperty("os.name");
if (os.startsWith("Linux")) {
defaultLower = 32768;
defaultUpper = 61000;
} else if (os.startsWith("SunOS")) {
defaultLower = 32768;
@@ -65,13 +62,10 @@
defaultUpper = 65535;
} else {
throw new InternalError(
"sun.net.PortConfig: unknown OS");
}
- return null;
- }
- });
int v = getLower0();
if (v == -1) {
v = defaultLower;
}
< prev index next >