Skip to content

Commit 91f4aa6

Browse files
committed
cleanup: cleanup usage of getSecurityManager()
desc: getSecurityManager() is deprecated and marked for imminent removal. In addition as of JDK 24, getSecurityManager() returns null. This change removes getSecurityManager() from various places that have minimal impact.
1 parent dbea0b6 commit 91f4aa6

File tree

37 files changed

+49
-231
lines changed

37 files changed

+49
-231
lines changed

enterprise/performance.javaee/test/unit/src/org/netbeans/performance/j2ee/memory/MeasureBaselineMemoryFootprint.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public class MeasureBaselineMemoryFootprint extends org.netbeans.junit.NbPerform
5454

5555
private static final String [][] SUPPORTED_PLATFORMS = {
5656
{"Linux,i386",UNIX},
57-
{"SunOS,sparc",UNIX},
5857
{"Windows_NT,x86",WINDOWS},
5958
{"Windows_2000,x86",WINDOWS},
6059
{"Windows_XP,x86",WINDOWS},

enterprise/performance.scripting/test/qa-functional/src/org/netbeans/performance/languages/actions/CountingSecurityManager.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ public static void register() {
5151
public static void initialize(String prefix) {
5252
Assert.assertNotNull(prefix);
5353

54-
if (! (System.getSecurityManager() instanceof CountingSecurityManager)) {
55-
setAllowedReplace(true);
56-
System.setSecurityManager(new CountingSecurityManager());
57-
setAllowedReplace(false);
58-
}
54+
setAllowedReplace(true);
55+
System.setSecurityManager(new CountingSecurityManager());
56+
setAllowedReplace(false);
57+
5958
if (!System.getSecurityManager().getClass().getName().equals(CountingSecurityManager.class.getName())) {
6059
throw new IllegalStateException("Wrong security manager: " + System.getSecurityManager());
6160
}

harness/nbjunit/src/org/netbeans/junit/MemoryMeasurement.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static long getIdeMemoryFootPrint() throws MemoryMeasurementFailedExcepti
8383
public static long getProcessMemoryFootPrint(long pid) throws MemoryMeasurementFailedException {
8484
String platform = getPlatform();
8585
//System.out.println("PLATFORM = "+getPlatform());
86-
if (platform.equals(SOLARIS)|platform.equals(LINUX)) {
86+
if (platform.equals(LINUX)) {
8787
// call unix method
8888
return getProcessMemoryFootPrintOnUnix(pid);
8989
} else if (platform.equals(WINDOWS)) {
@@ -98,13 +98,11 @@ public static long getProcessMemoryFootPrint(long pid) throws MemoryMeasurementF
9898
/** */
9999
private static final long UNKNOWN_VALUE = -1;
100100

101-
private static final String SOLARIS = "solaris";
102101
private static final String LINUX = "linux";
103102
private static final String WINDOWS = "win32";
104103
private static final String UNKNOWN = "unknown";
105104

106105
private static final String [][] SUPPORTED_PLATFORMS = {
107-
{"SunOS",SOLARIS},
108106
{"Linux",LINUX},
109107
{"Windows NT",WINDOWS},
110108
{"Windows 2000",WINDOWS},

ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/TerminalLocalNativeProcess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public int waitResult() throws InterruptedException {
262262
return -1;
263263
}
264264

265-
if (osFamily == OSFamily.LINUX || osFamily == OSFamily.SUNOS) {
265+
if (osFamily == OSFamily.LINUX) {
266266
File f = new File("/proc/" + pid); // NOI18N
267267

268268
while (f.exists()) {

ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/HostInfo.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public static enum CpuFamily {
3434

3535
public static enum OSFamily {
3636

37-
SUNOS,
3837
LINUX,
3938
WINDOWS,
4039
MACOSX,
@@ -45,7 +44,6 @@ public boolean isUnix() {
4544
switch (this) {
4645
case LINUX:
4746
case MACOSX:
48-
case SUNOS:
4947
case FREEBSD:
5048
return true;
5149
case WINDOWS:
@@ -58,7 +56,7 @@ public boolean isUnix() {
5856
}
5957

6058
/**
61-
* Returns CamelCase name of the family. Like: SunOS; Linux; Windows;
59+
* Returns CamelCase name of the family. Like: Linux; Windows;
6260
* MacOSX.
6361
*
6462
* @return CamelCase name
@@ -69,8 +67,6 @@ public String cname() {
6967
return "Linux"; // NOI18N
7068
case MACOSX:
7169
return "MacOSX"; // NOI18N
72-
case SUNOS:
73-
return "SunOS"; // NOI18N
7470
case FREEBSD:
7571
return "FreeBSD"; // NOI18N
7672
case WINDOWS:

ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/pty/PtySupport.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ public static boolean isSupportedFor(ExecutionEnvironment executionEnvironment)
170170
|| hostInfo.getCpuFamily().equals(CpuFamily.SPARC)
171171
|| (hostInfo.getCpuFamily().equals(CpuFamily.ARM) && Boolean.getBoolean("cnd.pty.arm.support"))
172172
|| hostInfo.getCpuFamily().equals(CpuFamily.AARCH64);
173-
case SUNOS:
174-
return true;
175173
case FREEBSD:
176174
return false;
177175
default:

ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/HelperLibraryUtility.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public static String getLDPathEnvName(ExecutionEnvironment execEnv) {
113113
case MACOSX:
114114
return "DYLD_LIBRARY_PATH"; // NOI18N
115115
case LINUX:
116-
case SUNOS:
117116
case FREEBSD:
118117
return "LD_LIBRARY_PATH"; // NOI18N
119118
case WINDOWS:
@@ -152,7 +151,6 @@ public static String getLDPreloadEnvName(ExecutionEnvironment execEnv) {
152151
case MACOSX:
153152
return "DYLD_INSERT_LIBRARIES"; // NOI18N
154153
case LINUX:
155-
case SUNOS:
156154
case FREEBSD:
157155
return "LD_PRELOAD"; // NOI18N
158156
case WINDOWS:

ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/MacroExpanderFactory.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@ protected final void setupPredefined(ExpanderStyle style) {
254254
soext = "dylib"; // NOI18N
255255
osname = "MacOSX"; // NOI18N
256256
break;
257-
case SUNOS:
258-
soext = "so"; // NOI18N
259-
osname = "SunOS"; // NOI18N
260-
break;
261257
case LINUX:
262258
soext = "so"; // NOI18N
263259
osname = "Linux"; // NOI18N
@@ -285,11 +281,7 @@ protected final void setupPredefined(ExpanderStyle style) {
285281
platform = "intel"; // NOI18N
286282
}
287283

288-
if (hostInfo.getOSFamily() == HostInfo.OSFamily.SUNOS) { // NOI18N
289-
platform += "-S2"; // NOI18N
290-
} else {
291-
platform += "-" + osname; // NOI18N
292-
}
284+
platform += "-" + osname; // NOI18N
293285
}
294286

295287
predefinedMacros.put("platform", platform); // NOI18N

ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/Md5checker.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ public Result check(File localFile, String remotePath)
8383
args = new String[] { remotePath }; // NOI18N
8484
first = false;
8585
break;
86-
case SUNOS:
87-
cmd = "/usr/bin/digest"; // NOI18N
88-
args = new String[] {"-a", "md5", remotePath }; //NOI18N
89-
first = true;
90-
break;
9186
case MACOSX:
9287
cmd = "sh"; // NOI18N
9388
args = new String [] {"-c", String.format("md5 %s || openssl -md5 %s", remotePath, remotePath)}; //NOI18N

ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/IOConnector.java

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -114,32 +114,7 @@ private static class ResizeListener implements PropertyChangeListener {
114114
private final boolean pxlsAware;
115115

116116
ResizeListener(final ExecutionEnvironment env, final String tty) throws IOException, CancellationException {
117-
final HostInfo hinfo = HostInfoUtils.getHostInfo(env);
118-
119-
if (OSFamily.SUNOS.equals(hinfo.getOSFamily())) {
120-
pxlsAware = true;
121-
122-
// See IZ 192063 - Input is duplicated in internal terminal
123-
// See CR 7009510 - Changing winsize (SIGWINCH) of pts causes entered text duplication
124-
125-
// In case OpenSolaris/Solaris 11 will not react on window size
126-
// change... This causes 'problems' with, say, vi started
127-
// in the internal terminal... But 'solves' problems with input
128-
// duplication, which is more important...
129-
130-
String version = hinfo.getOS().getVersion();
131-
if (version.contains("Solaris 11.")) { // NOI18N
132-
// update for IZ 236261: in Solaris 11+ this seems to work, so
133-
// will not disable listener for it...
134-
135-
// update: the same is valid for 11.2
136-
// assuming it was fixed in 11 - disabling this fix for 11.*
137-
} else if (version.contains("OpenSolaris") || version.contains("Solaris 11")) { // NOI18N
138-
return;
139-
}
140-
} else {
141-
pxlsAware = false;
142-
}
117+
pxlsAware = false;
143118

144119
this.task = rp.create(new Runnable() {
145120

0 commit comments

Comments
 (0)