You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by bw...@apache.org on 2025/12/23 04:56:31 UTC
(netbeans) 01/01: cleanup: cleanup usage of getSecurityManager()
This is an automated email from the ASF dual-hosted git repository.
bwalker pushed a commit to branch cleanup_getSecurityManager_usage
in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit 91f4aa6a025f9186cfdefcda43fef1bf95d20bf3
Author: Brad Walker <bw...@musings.com>
AuthorDate: Mon Dec 22 21:07:05 2025 -0700
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.
---
.../memory/MeasureBaselineMemoryFootprint.java | 1 -
.../languages/actions/CountingSecurityManager.java | 9 ++++----
.../src/org/netbeans/junit/MemoryMeasurement.java | 4 +---
.../TerminalLocalNativeProcess.java | 2 +-
.../modules/nativeexecution/api/HostInfo.java | 6 +----
.../nativeexecution/api/pty/PtySupport.java | 2 --
.../api/util/HelperLibraryUtility.java | 2 --
.../api/util/MacroExpanderFactory.java | 10 +-------
.../nativeexecution/api/util/Md5checker.java | 5 ----
.../modules/nativeexecution/pty/IOConnector.java | 27 +---------------------
.../nativeexecution/pty/NbStartUtility.java | 1 -
.../signals/impl/NbKillAllSignalSupport.java | 1 -
.../netbeans/test/ide/CountingSecurityManager.java | 9 ++------
.../project/ui/groups/CheckBoxRenderrer.java | 16 ++++---------
.../spellchecker/options/CheckBoxRenderrer.java | 16 ++++---------
.../netbeans/modules/versioning/GetOwnerTest.java | 7 ++----
.../java/stackanalyzer/AnalyserCellRenderer.java | 14 ++++-------
.../api/java/source/TreePathHandleTest.java | 7 +++---
.../j2se/actions/CountingSecurityManager.java | 12 ++++------
.../utilities/MemoryFootprintTestCase.java | 2 --
.../test/ide/PerfCountingSecurityManager.java | 9 ++------
.../scalability/CountingSecurityManager.java | 12 ++++------
.../core/startup/CountingSecurityManager.java | 6 +----
.../core/startup/IsDirCntSecurityManager.java | 4 +---
.../startup/PlatformDependencySatisfiedTest.java | 14 -----------
.../startup/layers/CountingSecurityManager.java | 9 ++------
.../modules/netbinox/CountingSecurityManager.java | 9 ++------
.../src/org/netbeans/CountingSecurityManager.java | 6 +----
.../unit/src/org/netbeans/JarClassLoaderTest.java | 6 +----
.../src/org/netbeans/swing/plaf/Startup.java | 10 +-------
.../beanstubs/org/openide/util/Utilities.java | 4 ----
.../src/org/openide/filesystems/TestBaseHid.java | 3 ---
.../org/openide/filesystems/test/StatFiles.java | 8 +------
.../src/org/openide/xml/XMLUtilReflectionTest.java | 6 +----
.../src/org/openide/util/BaseUtilities.java | 4 ----
.../modules/quicksearch/SearchResultRender.java | 8 -------
.../org/netbeans/lib/profiler/global/Platform.java | 9 --------
37 files changed, 49 insertions(+), 231 deletions(-)
diff --git a/enterprise/performance.javaee/test/unit/src/org/netbeans/performance/j2ee/memory/MeasureBaselineMemoryFootprint.java b/enterprise/performance.javaee/test/unit/src/org/netbeans/performance/j2ee/memory/MeasureBaselineMemoryFootprint.java
index 2681a80e245..59a1b03fd64 100644
--- a/enterprise/performance.javaee/test/unit/src/org/netbeans/performance/j2ee/memory/MeasureBaselineMemoryFootprint.java
+++ b/enterprise/performance.javaee/test/unit/src/org/netbeans/performance/j2ee/memory/MeasureBaselineMemoryFootprint.java
@@ -54,7 +54,6 @@ public class MeasureBaselineMemoryFootprint extends org.netbeans.junit.NbPerform
private static final String [][] SUPPORTED_PLATFORMS = {
{"Linux,i386",UNIX},
- {"SunOS,sparc",UNIX},
{"Windows_NT,x86",WINDOWS},
{"Windows_2000,x86",WINDOWS},
{"Windows_XP,x86",WINDOWS},
diff --git a/enterprise/performance.scripting/test/qa-functional/src/org/netbeans/performance/languages/actions/CountingSecurityManager.java b/enterprise/performance.scripting/test/qa-functional/src/org/netbeans/performance/languages/actions/CountingSecurityManager.java
index 652cc2fdb83..b9f6b674f2c 100644
--- a/enterprise/performance.scripting/test/qa-functional/src/org/netbeans/performance/languages/actions/CountingSecurityManager.java
+++ b/enterprise/performance.scripting/test/qa-functional/src/org/netbeans/performance/languages/actions/CountingSecurityManager.java
@@ -51,11 +51,10 @@ public final class CountingSecurityManager extends SecurityManager {
public static void initialize(String prefix) {
Assert.assertNotNull(prefix);
- if (! (System.getSecurityManager() instanceof CountingSecurityManager)) {
- setAllowedReplace(true);
- System.setSecurityManager(new CountingSecurityManager());
- setAllowedReplace(false);
- }
+ setAllowedReplace(true);
+ System.setSecurityManager(new CountingSecurityManager());
+ setAllowedReplace(false);
+
if (!System.getSecurityManager().getClass().getName().equals(CountingSecurityManager.class.getName())) {
throw new IllegalStateException("Wrong security manager: " + System.getSecurityManager());
}
diff --git a/harness/nbjunit/src/org/netbeans/junit/MemoryMeasurement.java b/harness/nbjunit/src/org/netbeans/junit/MemoryMeasurement.java
index d1265b07661..62fc01cf892 100644
--- a/harness/nbjunit/src/org/netbeans/junit/MemoryMeasurement.java
+++ b/harness/nbjunit/src/org/netbeans/junit/MemoryMeasurement.java
@@ -83,7 +83,7 @@ public class MemoryMeasurement {
public static long getProcessMemoryFootPrint(long pid) throws MemoryMeasurementFailedException {
String platform = getPlatform();
//System.out.println("PLATFORM = "+getPlatform());
- if (platform.equals(SOLARIS)|platform.equals(LINUX)) {
+ if (platform.equals(LINUX)) {
// call unix method
return getProcessMemoryFootPrintOnUnix(pid);
} else if (platform.equals(WINDOWS)) {
@@ -98,13 +98,11 @@ public class MemoryMeasurement {
/** */
private static final long UNKNOWN_VALUE = -1;
- private static final String SOLARIS = "solaris";
private static final String LINUX = "linux";
private static final String WINDOWS = "win32";
private static final String UNKNOWN = "unknown";
private static final String [][] SUPPORTED_PLATFORMS = {
- {"SunOS",SOLARIS},
{"Linux",LINUX},
{"Windows NT",WINDOWS},
{"Windows 2000",WINDOWS},
diff --git a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/TerminalLocalNativeProcess.java b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/TerminalLocalNativeProcess.java
index fc47fdf71e5..cf315844410 100644
--- a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/TerminalLocalNativeProcess.java
+++ b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/TerminalLocalNativeProcess.java
@@ -262,7 +262,7 @@ public final class TerminalLocalNativeProcess extends AbstractNativeProcess {
return -1;
}
- if (osFamily == OSFamily.LINUX || osFamily == OSFamily.SUNOS) {
+ if (osFamily == OSFamily.LINUX) {
File f = new File("/proc/" + pid); // NOI18N
while (f.exists()) {
diff --git a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/HostInfo.java b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/HostInfo.java
index 667acc74017..8249c3e468f 100644
--- a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/HostInfo.java
+++ b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/HostInfo.java
@@ -34,7 +34,6 @@ public interface HostInfo {
public static enum OSFamily {
- SUNOS,
LINUX,
WINDOWS,
MACOSX,
@@ -45,7 +44,6 @@ public interface HostInfo {
switch (this) {
case LINUX:
case MACOSX:
- case SUNOS:
case FREEBSD:
return true;
case WINDOWS:
@@ -58,7 +56,7 @@ public interface HostInfo {
}
/**
- * Returns CamelCase name of the family. Like: SunOS; Linux; Windows;
+ * Returns CamelCase name of the family. Like: Linux; Windows;
* MacOSX.
*
* @return CamelCase name
@@ -69,8 +67,6 @@ public interface HostInfo {
return "Linux"; // NOI18N
case MACOSX:
return "MacOSX"; // NOI18N
- case SUNOS:
- return "SunOS"; // NOI18N
case FREEBSD:
return "FreeBSD"; // NOI18N
case WINDOWS:
diff --git a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/pty/PtySupport.java b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/pty/PtySupport.java
index 8848070d7fd..bfc8a75b32a 100644
--- a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/pty/PtySupport.java
+++ b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/pty/PtySupport.java
@@ -170,8 +170,6 @@ public final class PtySupport {
|| hostInfo.getCpuFamily().equals(CpuFamily.SPARC)
|| (hostInfo.getCpuFamily().equals(CpuFamily.ARM) && Boolean.getBoolean("cnd.pty.arm.support"))
|| hostInfo.getCpuFamily().equals(CpuFamily.AARCH64);
- case SUNOS:
- return true;
case FREEBSD:
return false;
default:
diff --git a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/HelperLibraryUtility.java b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/HelperLibraryUtility.java
index 5dd4f9bdb07..5b33fccc915 100644
--- a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/HelperLibraryUtility.java
+++ b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/HelperLibraryUtility.java
@@ -113,7 +113,6 @@ public class HelperLibraryUtility {
case MACOSX:
return "DYLD_LIBRARY_PATH"; // NOI18N
case LINUX:
- case SUNOS:
case FREEBSD:
return "LD_LIBRARY_PATH"; // NOI18N
case WINDOWS:
@@ -152,7 +151,6 @@ public class HelperLibraryUtility {
case MACOSX:
return "DYLD_INSERT_LIBRARIES"; // NOI18N
case LINUX:
- case SUNOS:
case FREEBSD:
return "LD_PRELOAD"; // NOI18N
case WINDOWS:
diff --git a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/MacroExpanderFactory.java b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/MacroExpanderFactory.java
index c1779546c77..12a314d4688 100644
--- a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/MacroExpanderFactory.java
+++ b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/MacroExpanderFactory.java
@@ -254,10 +254,6 @@ public final class MacroExpanderFactory {
soext = "dylib"; // NOI18N
osname = "MacOSX"; // NOI18N
break;
- case SUNOS:
- soext = "so"; // NOI18N
- osname = "SunOS"; // NOI18N
- break;
case LINUX:
soext = "so"; // NOI18N
osname = "Linux"; // NOI18N
@@ -285,11 +281,7 @@ public final class MacroExpanderFactory {
platform = "intel"; // NOI18N
}
- if (hostInfo.getOSFamily() == HostInfo.OSFamily.SUNOS) { // NOI18N
- platform += "-S2"; // NOI18N
- } else {
- platform += "-" + osname; // NOI18N
- }
+ platform += "-" + osname; // NOI18N
}
predefinedMacros.put("platform", platform); // NOI18N
diff --git a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/Md5checker.java b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/Md5checker.java
index ee5b90de439..5bcd3dc9032 100644
--- a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/Md5checker.java
+++ b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/api/util/Md5checker.java
@@ -83,11 +83,6 @@ import org.netbeans.modules.nativeexecution.api.util.ProcessUtils.ExitStatus;
args = new String[] { remotePath }; // NOI18N
first = false;
break;
- case SUNOS:
- cmd = "/usr/bin/digest"; // NOI18N
- args = new String[] {"-a", "md5", remotePath }; //NOI18N
- first = true;
- break;
case MACOSX:
cmd = "sh"; // NOI18N
args = new String [] {"-c", String.format("md5 %s || openssl -md5 %s", remotePath, remotePath)}; //NOI18N
diff --git a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/IOConnector.java b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/IOConnector.java
index f53331fb876..f053b054282 100644
--- a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/IOConnector.java
+++ b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/IOConnector.java
@@ -114,32 +114,7 @@ public final class IOConnector {
private final boolean pxlsAware;
ResizeListener(final ExecutionEnvironment env, final String tty) throws IOException, CancellationException {
- final HostInfo hinfo = HostInfoUtils.getHostInfo(env);
-
- if (OSFamily.SUNOS.equals(hinfo.getOSFamily())) {
- pxlsAware = true;
-
- // See IZ 192063 - Input is duplicated in internal terminal
- // See CR 7009510 - Changing winsize (SIGWINCH) of pts causes entered text duplication
-
- // In case OpenSolaris/Solaris 11 will not react on window size
- // change... This causes 'problems' with, say, vi started
- // in the internal terminal... But 'solves' problems with input
- // duplication, which is more important...
-
- String version = hinfo.getOS().getVersion();
- if (version.contains("Solaris 11.")) { // NOI18N
- // update for IZ 236261: in Solaris 11+ this seems to work, so
- // will not disable listener for it...
-
- // update: the same is valid for 11.2
- // assuming it was fixed in 11 - disabling this fix for 11.*
- } else if (version.contains("OpenSolaris") || version.contains("Solaris 11")) { // NOI18N
- return;
- }
- } else {
- pxlsAware = false;
- }
+ pxlsAware = false;
this.task = rp.create(new Runnable() {
diff --git a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/NbStartUtility.java b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/NbStartUtility.java
index 15fbf4741dc..6e5b96fe311 100644
--- a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/NbStartUtility.java
+++ b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/pty/NbStartUtility.java
@@ -85,7 +85,6 @@ public class NbStartUtility extends HelperUtility {
try {
switch (hostInfo.getOS().getFamily()) {
case MACOSX:
- case SUNOS:
case LINUX:
try {
return getLocalFile(hostInfo) != null;
diff --git a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/signals/impl/NbKillAllSignalSupport.java b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/signals/impl/NbKillAllSignalSupport.java
index 4fc872c76b7..a08cb93752e 100644
--- a/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/signals/impl/NbKillAllSignalSupport.java
+++ b/ide/dlight.nativeexecution/src/org/netbeans/modules/nativeexecution/signals/impl/NbKillAllSignalSupport.java
@@ -57,7 +57,6 @@ public final class NbKillAllSignalSupport extends HelperUtility implements Signa
switch (hostInfo.getOSFamily()) {
case LINUX:
- case SUNOS:
return true;
case FREEBSD:
return false;
diff --git a/ide/ide.kit/test/qa-functional/src/org/netbeans/test/ide/CountingSecurityManager.java b/ide/ide.kit/test/qa-functional/src/org/netbeans/test/ide/CountingSecurityManager.java
index 45b65e53bbb..361eb697bab 100755
--- a/ide/ide.kit/test/qa-functional/src/org/netbeans/test/ide/CountingSecurityManager.java
+++ b/ide/ide.kit/test/qa-functional/src/org/netbeans/test/ide/CountingSecurityManager.java
@@ -90,11 +90,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
public static void initialize(String prefix, Mode mode, Set<String> allowedFiles) {
System.setProperty("counting.security.disabled", "true");
- if (System.getSecurityManager() instanceof CountingSecurityManager) {
- // ok
- } else {
- System.setSecurityManager(new CountingSecurityManager());
- }
+ System.setSecurityManager(new CountingSecurityManager());
setCnt(0);
msgs = new StringWriter();
pw = new PrintWriter(msgs);
@@ -113,7 +109,6 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
static void assertReflection(int maxCount, String whitelist) {
System.setProperty("counting.reflection.whitelist", whitelist);
RuntimePermission checkMemberAccessPermission = new RuntimePermission("accessDeclaredMembers");
- System.getSecurityManager().checkPermission(checkMemberAccessPermission);
System.getProperties().remove("counting.reflection.whitelist");
}
@@ -127,7 +122,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
}
public static boolean isEnabled() {
- return System.getSecurityManager() instanceof Callable<?>;
+ return false;
}
public static void assertCounts(String msg, int expectedCnt) throws Exception {
diff --git a/ide/projectui/src/org/netbeans/modules/project/ui/groups/CheckBoxRenderrer.java b/ide/projectui/src/org/netbeans/modules/project/ui/groups/CheckBoxRenderrer.java
index d0628fd4d40..6a1750ab523 100644
--- a/ide/projectui/src/org/netbeans/modules/project/ui/groups/CheckBoxRenderrer.java
+++ b/ide/projectui/src/org/netbeans/modules/project/ui/groups/CheckBoxRenderrer.java
@@ -49,19 +49,11 @@ public class CheckBoxRenderrer extends JCheckBox implements ListCellRenderer, Se
private Border getNoFocusBorder () {
Border border = UIManager.getBorder("List.cellNoFocusBorder");
- if (System.getSecurityManager () != null) {
- if (border != null) {
- return border;
- }
- return SAFE_NO_FOCUS_BORDER;
- } else {
- if (border != null &&
- (noFocusBorder == null ||
- noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
- return border;
- }
- return noFocusBorder;
+ if (border != null &&
+ (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
+ return border;
}
+ return noFocusBorder;
}
public Component getListCellRendererComponent (
diff --git a/ide/spellchecker/src/org/netbeans/modules/spellchecker/options/CheckBoxRenderrer.java b/ide/spellchecker/src/org/netbeans/modules/spellchecker/options/CheckBoxRenderrer.java
index 02f7706a8c3..5a434e2987b 100644
--- a/ide/spellchecker/src/org/netbeans/modules/spellchecker/options/CheckBoxRenderrer.java
+++ b/ide/spellchecker/src/org/netbeans/modules/spellchecker/options/CheckBoxRenderrer.java
@@ -49,19 +49,11 @@ public class CheckBoxRenderrer extends JCheckBox implements ListCellRenderer, Se
private Border getNoFocusBorder () {
Border border = UIManager.getBorder("List.cellNoFocusBorder");
- if (System.getSecurityManager () != null) {
- if (border != null) {
- return border;
- }
- return SAFE_NO_FOCUS_BORDER;
- } else {
- if (border != null &&
- (noFocusBorder == null ||
- noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
- return border;
- }
- return noFocusBorder;
+ if (border != null &&
+ (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
+ return border;
}
+ return noFocusBorder;
}
public Component getListCellRendererComponent (
diff --git a/ide/versioning/test/unit/src/org/netbeans/modules/versioning/GetOwnerTest.java b/ide/versioning/test/unit/src/org/netbeans/modules/versioning/GetOwnerTest.java
index 7b464230622..ba531213ac0 100644
--- a/ide/versioning/test/unit/src/org/netbeans/modules/versioning/GetOwnerTest.java
+++ b/ide/versioning/test/unit/src/org/netbeans/modules/versioning/GetOwnerTest.java
@@ -37,7 +37,6 @@ public class GetOwnerTest extends NbTestCase {
protected File dataRootDir;
private StatFiles accessMonitor;
- private SecurityManager defaultSecurityManager;
protected File versionedFolder;
protected File unversionedFolder;
@@ -69,9 +68,6 @@ public class GetOwnerTest extends NbTestCase {
userdir.mkdirs();
System.setProperty("netbeans.user", userdir.getAbsolutePath());
if(accessMonitor != null) {
- if(defaultSecurityManager == null) {
- defaultSecurityManager = System.getSecurityManager();
- }
System.setSecurityManager(accessMonitor);
}
}
@@ -80,7 +76,8 @@ public class GetOwnerTest extends NbTestCase {
protected void tearDown() throws Exception {
super.tearDown();
if(accessMonitor != null) {
- System.setSecurityManager(defaultSecurityManager);
+ // FIXME - throws UnsupportedOperationException unconditionally, regardless of arg.
+ System.setSecurityManager(null);
}
}
diff --git a/java/java.navigation/src/org/netbeans/modules/java/stackanalyzer/AnalyserCellRenderer.java b/java/java.navigation/src/org/netbeans/modules/java/stackanalyzer/AnalyserCellRenderer.java
index 44d0641fafc..4b0eb5a52af 100644
--- a/java/java.navigation/src/org/netbeans/modules/java/stackanalyzer/AnalyserCellRenderer.java
+++ b/java/java.navigation/src/org/netbeans/modules/java/stackanalyzer/AnalyserCellRenderer.java
@@ -42,17 +42,11 @@ class AnalyserCellRenderer extends DefaultListCellRenderer {
private Border getNoFocusBorder() {
Border border = UIManager.getBorder("List.cellNoFocusBorder");
- if (System.getSecurityManager() != null) {
- if (border != null) return border;
- return SAFE_NO_FOCUS_BORDER;
- } else {
- if (border != null &&
- (noFocusBorder == null ||
- noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
- return border;
- }
- return noFocusBorder;
+ if (border != null &&
+ (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER)) {
+ return border;
}
+ return noFocusBorder;
}
diff --git a/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TreePathHandleTest.java b/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TreePathHandleTest.java
index 950c9fa6afc..987de39fd3c 100644
--- a/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TreePathHandleTest.java
+++ b/java/java.source.base/test/unit/src/org/netbeans/api/java/source/TreePathHandleTest.java
@@ -184,13 +184,12 @@ public class TreePathHandleTest extends NbTestCase {
TypeElement string = parameter.getElements().getTypeElement("test.test2");
- SecurityManager old = System.getSecurityManager();
-
System.setSecurityManager(new SecMan());
TreePathHandle.create(string, parameter);
-
- System.setSecurityManager(old);
+
+ // FIXME - throws UnsupportedOperationException unconditionally, regardless of arg.
+ System.setSecurityManager(null);
}
}, true);
}
diff --git a/java/performance.java/test/qa-functional/src/org/netbeans/performance/j2se/actions/CountingSecurityManager.java b/java/performance.java/test/qa-functional/src/org/netbeans/performance/j2se/actions/CountingSecurityManager.java
index 64a04837c34..2bd2017d2ae 100644
--- a/java/performance.java/test/qa-functional/src/org/netbeans/performance/j2se/actions/CountingSecurityManager.java
+++ b/java/performance.java/test/qa-functional/src/org/netbeans/performance/j2se/actions/CountingSecurityManager.java
@@ -50,14 +50,10 @@ public final class CountingSecurityManager extends SecurityManager {
public static void initialize(String prefix) {
Assert.assertNotNull(prefix);
- if (! (System.getSecurityManager() instanceof CountingSecurityManager)) {
- setAllowedReplace(true);
- System.setSecurityManager(new CountingSecurityManager());
- setAllowedReplace(false);
- }
- if (!System.getSecurityManager().getClass().getName().equals(CountingSecurityManager.class.getName())) {
- throw new IllegalStateException("Wrong security manager: " + System.getSecurityManager());
- }
+ setAllowedReplace(true);
+ System.setSecurityManager(new CountingSecurityManager());
+ setAllowedReplace(false);
+
cnt = 0;
msgs = new StringWriter();
pw = new PrintWriter(msgs);
diff --git a/java/performance/src/org/netbeans/modules/performance/utilities/MemoryFootprintTestCase.java b/java/performance/src/org/netbeans/modules/performance/utilities/MemoryFootprintTestCase.java
index 11cec8c75d7..f952f84d47b 100644
--- a/java/performance/src/org/netbeans/modules/performance/utilities/MemoryFootprintTestCase.java
+++ b/java/performance/src/org/netbeans/modules/performance/utilities/MemoryFootprintTestCase.java
@@ -64,8 +64,6 @@ public abstract class MemoryFootprintTestCase extends PerformanceTestCase {
*/
private static final String[][] SUPPORTED_PLATFORMS = {
{"Linux,i386", UNIX},
- {"SunOS,sparc", UNIX},
- {"SunOS,x86", UNIX},
{"Windows_NT,x86", WINDOWS},
{"Windows_2000,x86", WINDOWS},
{"Windows_XP,x86", WINDOWS},
diff --git a/java/performance/test/qa-functional/src/org/netbeans/test/ide/PerfCountingSecurityManager.java b/java/performance/test/qa-functional/src/org/netbeans/test/ide/PerfCountingSecurityManager.java
index dcd3b28cead..17dd919c1a7 100644
--- a/java/performance/test/qa-functional/src/org/netbeans/test/ide/PerfCountingSecurityManager.java
+++ b/java/performance/test/qa-functional/src/org/netbeans/test/ide/PerfCountingSecurityManager.java
@@ -91,11 +91,7 @@ final class PerfCountingSecurityManager extends SecurityManager implements Calla
public static void initialize(String prefix, PerfCountingSecurityManager.Mode mode, Set<String> allowedFiles) {
System.setProperty("counting.security.disabled", "true");
- if (System.getSecurityManager() instanceof PerfCountingSecurityManager) {
- // ok
- } else {
- System.setSecurityManager(new PerfCountingSecurityManager());
- }
+ System.setSecurityManager(new PerfCountingSecurityManager());
setCnt(0);
msgs = new StringWriter();
pw = new PrintWriter(msgs);
@@ -113,7 +109,6 @@ final class PerfCountingSecurityManager extends SecurityManager implements Calla
static void assertReflection(int maxCount, String whitelist) {
System.setProperty("counting.reflection.whitelist", whitelist);
- System.getSecurityManager().checkPermission( SecurityConstants.CHECK_MEMBER_ACCESS_PERMISSION);
System.getProperties().remove("counting.reflection.whitelist");
}
@@ -127,7 +122,7 @@ final class PerfCountingSecurityManager extends SecurityManager implements Calla
}
public static boolean isEnabled() {
- return System.getSecurityManager() instanceof Callable<?>;
+ return false;
}
public static void assertCounts(String msg, int expectedCnt) throws Exception {
diff --git a/java/performance/test/unit/src/org/netbeans/performance/scalability/CountingSecurityManager.java b/java/performance/test/unit/src/org/netbeans/performance/scalability/CountingSecurityManager.java
index 0a42eb5166e..32660829db7 100644
--- a/java/performance/test/unit/src/org/netbeans/performance/scalability/CountingSecurityManager.java
+++ b/java/performance/test/unit/src/org/netbeans/performance/scalability/CountingSecurityManager.java
@@ -51,14 +51,10 @@ public final class CountingSecurityManager extends SecurityManager {
public static void initialize(String prefix) {
Assert.assertNotNull(prefix);
- if (! (System.getSecurityManager() instanceof CountingSecurityManager)) {
- setAllowedReplace(true);
- System.setSecurityManager(new CountingSecurityManager());
- setAllowedReplace(false);
- }
- if (!System.getSecurityManager().getClass().getName().equals(CountingSecurityManager.class.getName())) {
- throw new IllegalStateException("Wrong security manager: " + System.getSecurityManager());
- }
+ setAllowedReplace(true);
+ System.setSecurityManager(new CountingSecurityManager());
+ setAllowedReplace(false);
+
cnt = 0;
msgs = new StringWriter();
pw = new PrintWriter(msgs);
diff --git a/platform/core.startup/test/unit/src/org/netbeans/core/startup/CountingSecurityManager.java b/platform/core.startup/test/unit/src/org/netbeans/core/startup/CountingSecurityManager.java
index fd6ac88fb24..7b3ef66e437 100644
--- a/platform/core.startup/test/unit/src/org/netbeans/core/startup/CountingSecurityManager.java
+++ b/platform/core.startup/test/unit/src/org/netbeans/core/startup/CountingSecurityManager.java
@@ -36,11 +36,7 @@ final class CountingSecurityManager extends SecurityManager {
private static String prefix;
public static void initialize(String prefix) {
- if (System.getSecurityManager() instanceof CountingSecurityManager) {
- // ok
- } else {
- System.setSecurityManager(new CountingSecurityManager());
- }
+ System.setSecurityManager(new CountingSecurityManager());
cnt = 0;
msgs = new StringWriter();
pw = new PrintWriter(msgs);
diff --git a/platform/core.startup/test/unit/src/org/netbeans/core/startup/IsDirCntSecurityManager.java b/platform/core.startup/test/unit/src/org/netbeans/core/startup/IsDirCntSecurityManager.java
index 12a02eb2aee..528704c97d9 100644
--- a/platform/core.startup/test/unit/src/org/netbeans/core/startup/IsDirCntSecurityManager.java
+++ b/platform/core.startup/test/unit/src/org/netbeans/core/startup/IsDirCntSecurityManager.java
@@ -32,9 +32,7 @@ public class IsDirCntSecurityManager extends SecurityManager {
private static StringBuffer sb;
public static void initialize() {
- if (!(System.getSecurityManager() instanceof IsDirCntSecurityManager)) {
- System.setSecurityManager(new IsDirCntSecurityManager());
- }
+ System.setSecurityManager(new IsDirCntSecurityManager());
cnt = 0;
sb = new StringBuffer();
}
diff --git a/platform/core.startup/test/unit/src/org/netbeans/core/startup/PlatformDependencySatisfiedTest.java b/platform/core.startup/test/unit/src/org/netbeans/core/startup/PlatformDependencySatisfiedTest.java
index 630c4fb8539..22da2a3575f 100644
--- a/platform/core.startup/test/unit/src/org/netbeans/core/startup/PlatformDependencySatisfiedTest.java
+++ b/platform/core.startup/test/unit/src/org/netbeans/core/startup/PlatformDependencySatisfiedTest.java
@@ -126,20 +126,6 @@ public class PlatformDependencySatisfiedTest extends SetupHid {
assertEnableModule("org.openide.modules.os.Solaris", false);
}
- public void testSolaris() throws Exception {
- System.setProperty("os.name", "SunOS");
- assertTrue("We are on Solaris", (Utilities.getOperatingSystem() & Utilities.OS_SOLARIS) != 0);
-
- assertEnableModule("org.openide.modules.os.Windows", false);
- assertEnableModule("org.openide.modules.os.MacOSX", false);
- assertEnableModule("org.openide.modules.os.Unix", true);
- assertEnableModule("org.openide.modules.os.PlainUnix", true);
- assertEnableModule("org.openide.modules.os.Garbage", false);
- assertEnableModule("org.openide.modules.os.OS2", false);
- assertEnableModule("org.openide.modules.os.Linux", false);
- assertEnableModule("org.openide.modules.os.Solaris", true);
- }
-
public void testBSD() throws Exception {
System.setProperty("os.name", "FreeBSD X1.4");
assertTrue("We are on unix", Utilities.isUnix());
diff --git a/platform/core.startup/test/unit/src/org/netbeans/core/startup/layers/CountingSecurityManager.java b/platform/core.startup/test/unit/src/org/netbeans/core/startup/layers/CountingSecurityManager.java
index ed12ee2376c..5758f4a5d78 100644
--- a/platform/core.startup/test/unit/src/org/netbeans/core/startup/layers/CountingSecurityManager.java
+++ b/platform/core.startup/test/unit/src/org/netbeans/core/startup/layers/CountingSecurityManager.java
@@ -67,11 +67,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
System.setProperty("counting.security.disabled", "true");
inSubtree("", "");
- if (System.getSecurityManager() instanceof CountingSecurityManager) {
- // ok
- } else {
- System.setSecurityManager(new CountingSecurityManager());
- }
+ System.setSecurityManager(new CountingSecurityManager());
setCnt(0);
msgs = new StringWriter();
pw = new PrintWriter(msgs);
@@ -86,7 +82,6 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
static void assertReflection(int maxCount, String whitelist) {
System.setProperty("counting.reflection.whitelist", whitelist);
- System.getSecurityManager().checkPermission(new MaxCountCheck(maxCount, "MaxCountCheck"));
System.getProperties().remove("counting.reflection.whitelist");
}
@@ -129,7 +124,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
}
public static boolean isEnabled() {
- return System.getSecurityManager() instanceof Callable<?>;
+ return false
}
public static void assertCounts(String msg, int expectedCnt) throws Exception {
diff --git a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/CountingSecurityManager.java b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/CountingSecurityManager.java
index 608d1d936db..b461497b96b 100644
--- a/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/CountingSecurityManager.java
+++ b/platform/netbinox/test/unit/src/org/netbeans/modules/netbinox/CountingSecurityManager.java
@@ -60,11 +60,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
public static void initialize(String prefix, Mode mode, Set<String> allowedFiles) {
System.setProperty("counting.security.disabled", "true");
- if (System.getSecurityManager() instanceof CountingSecurityManager) {
- // ok
- } else {
- System.setSecurityManager(new CountingSecurityManager());
- }
+ System.setSecurityManager(new CountingSecurityManager());
setCnt(0);
msgs = new StringWriter();
pw = new PrintWriter(msgs);
@@ -79,7 +75,6 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
static void assertReflection(int maxCount, String whitelist) {
System.setProperty("counting.reflection.whitelist", whitelist);
- System.getSecurityManager().checkPermission(new MaxCountPerm(maxCount));
System.getProperties().remove("counting.reflection.whitelist");
}
@@ -124,7 +119,7 @@ final class CountingSecurityManager extends SecurityManager implements Callable<
}
public static boolean isEnabled() {
- return System.getSecurityManager() instanceof Callable<?>;
+ return false;
}
public static void assertCounts(String msg, int expectedCnt) throws Exception {
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/CountingSecurityManager.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/CountingSecurityManager.java
index d29eb163aed..7a54ce8b9a7 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/CountingSecurityManager.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/CountingSecurityManager.java
@@ -36,11 +36,7 @@ final class CountingSecurityManager extends SecurityManager {
private static String prefix;
public static void initialize(String prefix) {
- if (System.getSecurityManager() instanceof CountingSecurityManager) {
- // ok
- } else {
- System.setSecurityManager(new CountingSecurityManager());
- }
+ System.setSecurityManager(new CountingSecurityManager());
cnt = 0;
msgs = new StringWriter();
pw = new PrintWriter(msgs);
diff --git a/platform/o.n.bootstrap/test/unit/src/org/netbeans/JarClassLoaderTest.java b/platform/o.n.bootstrap/test/unit/src/org/netbeans/JarClassLoaderTest.java
index 0a603593bba..73e2ea9e3b4 100644
--- a/platform/o.n.bootstrap/test/unit/src/org/netbeans/JarClassLoaderTest.java
+++ b/platform/o.n.bootstrap/test/unit/src/org/netbeans/JarClassLoaderTest.java
@@ -407,11 +407,7 @@ public class JarClassLoaderTest extends NbTestCase {
public static void initialize(String path, Semaphore sync) {
BlockingSecurityManager.path = path;
BlockingSecurityManager.sync = sync;
- if (System.getSecurityManager() instanceof BlockingSecurityManager) {
- // ok
- } else {
- System.setSecurityManager(new BlockingSecurityManager());
- }
+ System.setSecurityManager(new BlockingSecurityManager());
}
public @Override void checkRead(String file) {
diff --git a/platform/o.n.swing.plaf/src/org/netbeans/swing/plaf/Startup.java b/platform/o.n.swing.plaf/src/org/netbeans/swing/plaf/Startup.java
index 13fff7090c6..69e31178385 100644
--- a/platform/o.n.swing.plaf/src/org/netbeans/swing/plaf/Startup.java
+++ b/platform/o.n.swing.plaf/src/org/netbeans/swing/plaf/Startup.java
@@ -597,13 +597,6 @@ public final class Startup {
return result;
}
- private static boolean isSolaris10 () {
- String osName = System.getProperty ("os.name");
- String osVersion = System.getProperty ("os.version");
- boolean result = osName.startsWith ("SunOS") && "5.10".equals(osVersion);
- return result;
- }
-
/** If it is solaris or linux, we can use GTK where supported by getting
* the platform specific look and feel.
*
@@ -619,8 +612,7 @@ public final class Startup {
boolean result = !"Solaris".equals (osName) &&
!osName.startsWith ("SunOS") &&
!osName.endsWith ("Linux") ||
- UIManager.getSystemLookAndFeelClassName().indexOf("Motif") > -1 ||
- isSolaris10();
+ UIManager.getSystemLookAndFeelClassName().indexOf("Motif") > -1;
return result;
}
diff --git a/platform/o.n.swing.tabcontrol/beanstubs/org/openide/util/Utilities.java b/platform/o.n.swing.tabcontrol/beanstubs/org/openide/util/Utilities.java
index aef86a6984c..03f6bc2f559 100644
--- a/platform/o.n.swing.tabcontrol/beanstubs/org/openide/util/Utilities.java
+++ b/platform/o.n.swing.tabcontrol/beanstubs/org/openide/util/Utilities.java
@@ -126,8 +126,6 @@ public final class Utilities {
operatingSystem = OS_WIN_OTHER;
else if ("Solaris".equals (osName)) // NOI18N
operatingSystem = OS_SOLARIS;
- else if (osName.startsWith ("SunOS")) // NOI18N
- operatingSystem = OS_SOLARIS;
// JDK 1.4 b2 defines os.name for me as "Redhat Linux" -jglick
else if (osName.endsWith ("Linux")) // NOI18N
operatingSystem = OS_LINUX;
@@ -137,8 +135,6 @@ public final class Utilities {
operatingSystem = OS_AIX;
else if ("Irix".equals (osName)) // NOI18N
operatingSystem = OS_IRIX;
- else if ("SunOS".equals (osName)) // NOI18N
- operatingSystem = OS_SUNOS;
else if ("Digital UNIX".equals (osName)) // NOI18N
operatingSystem = OS_TRU64;
else if ("OS/2".equals (osName)) // NOI18N
diff --git a/platform/openide.filesystems/test/unit/src/org/openide/filesystems/TestBaseHid.java b/platform/openide.filesystems/test/unit/src/org/openide/filesystems/TestBaseHid.java
index 029b9db853d..b14d886fa76 100644
--- a/platform/openide.filesystems/test/unit/src/org/openide/filesystems/TestBaseHid.java
+++ b/platform/openide.filesystems/test/unit/src/org/openide/filesystems/TestBaseHid.java
@@ -76,9 +76,6 @@ public abstract class TestBaseHid extends MultiThreadedTestCaseHid {
if (allTestedFS != null) testedFS = allTestedFS[0];
// If not null, file accesses are counted through custom SecurityManager.
if(accessMonitor != null) {
- if(defaultSecurityManager == null) {
- defaultSecurityManager = System.getSecurityManager();
- }
System.setSecurityManager(accessMonitor);
}
}
diff --git a/platform/openide.filesystems/test/unit/src/org/openide/filesystems/test/StatFiles.java b/platform/openide.filesystems/test/unit/src/org/openide/filesystems/test/StatFiles.java
index 6fab0f33a51..4e7b3e5e1b0 100644
--- a/platform/openide.filesystems/test/unit/src/org/openide/filesystems/test/StatFiles.java
+++ b/platform/openide.filesystems/test/unit/src/org/openide/filesystems/test/StatFiles.java
@@ -40,23 +40,17 @@ public class StatFiles extends SecurityManager {
public static final int DELETE = 3;
private Results results;
private Monitor monitor;
- private SecurityManager defaultSecurityManager;
public StatFiles() {
reset();
}
public void register() {
- if (defaultSecurityManager == null) {
- defaultSecurityManager = System.getSecurityManager();
- }
System.setSecurityManager(this);
}
public void unregister() {
- if (defaultSecurityManager == null) {
- System.setSecurityManager(defaultSecurityManager);
- }
+ System.setSecurityManager(null);
}
public void reset() {
diff --git a/platform/openide.util.ui/test/unit/src/org/openide/xml/XMLUtilReflectionTest.java b/platform/openide.util.ui/test/unit/src/org/openide/xml/XMLUtilReflectionTest.java
index 7caedcf8d87..56b5964ab58 100644
--- a/platform/openide.util.ui/test/unit/src/org/openide/xml/XMLUtilReflectionTest.java
+++ b/platform/openide.util.ui/test/unit/src/org/openide/xml/XMLUtilReflectionTest.java
@@ -97,11 +97,7 @@ public class XMLUtilReflectionTest extends org.netbeans.junit.NbTestCase {
static final class CountingSecurityManager extends SecurityManager {
public static void initialize() {
- if (System.getSecurityManager() instanceof CountingSecurityManager) {
- // ok
- } else {
- System.setSecurityManager(new CountingSecurityManager());
- }
+ System.setSecurityManager(new CountingSecurityManager());
members.clear();
}
diff --git a/platform/openide.util/src/org/openide/util/BaseUtilities.java b/platform/openide.util/src/org/openide/util/BaseUtilities.java
index 810fe52b982..0000014c085 100644
--- a/platform/openide.util/src/org/openide/util/BaseUtilities.java
+++ b/platform/openide.util/src/org/openide/util/BaseUtilities.java
@@ -228,8 +228,6 @@ public abstract class BaseUtilities {
operatingSystem = OS_WIN_OTHER;
} else if ("Solaris".equals(osName)) { // NOI18N
operatingSystem = OS_SOLARIS;
- } else if (osName.startsWith("SunOS")) { // NOI18N
- operatingSystem = OS_SOLARIS;
}
// JDK 1.4 b2 defines os.name for me as "Redhat Linux" -jglick
else if (osName.endsWith("Linux")) { // NOI18N
@@ -240,8 +238,6 @@ public abstract class BaseUtilities {
operatingSystem = OS_AIX;
} else if ("Irix".equals(osName)) { // NOI18N
operatingSystem = OS_IRIX;
- } else if ("SunOS".equals(osName)) { // NOI18N
- operatingSystem = OS_SUNOS;
} else if ("Digital UNIX".equals(osName)) { // NOI18N
operatingSystem = OS_TRU64;
} else if ("OS/2".equals(osName)) { // NOI18N
diff --git a/platform/spi.quicksearch/src/org/netbeans/modules/quicksearch/SearchResultRender.java b/platform/spi.quicksearch/src/org/netbeans/modules/quicksearch/SearchResultRender.java
index e87c2ede75b..7e22bce12e8 100644
--- a/platform/spi.quicksearch/src/org/netbeans/modules/quicksearch/SearchResultRender.java
+++ b/platform/spi.quicksearch/src/org/netbeans/modules/quicksearch/SearchResultRender.java
@@ -186,9 +186,6 @@ class SearchResultRender extends JLabel implements ListCellRenderer {
if (Utilities.isMac()) {
// Mac cloverleaf symbol
sb.append ("\u2318+");
- } else if (isSolaris()) {
- // Sun meta symbol
- sb.append ("\u25C6+");
} else {
sb.append ("Meta+");
}
@@ -203,9 +200,4 @@ class SearchResultRender extends JLabel implements ListCellRenderer {
));
return sb.toString ();
}
-
- private static boolean isSolaris () {
- String osName = System.getProperty ("os.name");
- return osName != null && osName.startsWith ("SunOS");
- }
}
diff --git a/profiler/lib.profiler/src/org/netbeans/lib/profiler/global/Platform.java b/profiler/lib.profiler/src/org/netbeans/lib/profiler/global/Platform.java
index ae9107bcb31..0e446c8f1e5 100644
--- a/profiler/lib.profiler/src/org/netbeans/lib/profiler/global/Platform.java
+++ b/profiler/lib.profiler/src/org/netbeans/lib/profiler/global/Platform.java
@@ -413,12 +413,6 @@ public class Platform implements CommonConstants {
} else if (osName.startsWith("Windows ")) { // NOI18N
return OS_WIN_OTHER;
- } else if ("Solaris".equals(osName)) { // NOI18N
-
- return OS_SOLARIS;
- } else if (osName.startsWith("SunOS")) { // NOI18N
-
- return OS_SOLARIS;
} else if (osName.endsWith("Linux")) { // NOI18N
return OS_LINUX;
@@ -431,9 +425,6 @@ public class Platform implements CommonConstants {
} else if ("Irix".equals(osName)) { // NOI18N
return OS_IRIX;
- } else if ("SunOS".equals(osName)) { // NOI18N
-
- return OS_SOLARIS;
} else if ("Digital UNIX".equals(osName)) { // NOI18N
return OS_TRU64;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists