[AMQ-9216] Remove SeucrityManager usage from activemq-client IdGenerator

(cherry picked from commit e24c756e8d)
This commit is contained in:
Matt Pavlovich 2023-11-22 10:41:00 -06:00 committed by JB Onofré
parent b2a808466d
commit f1b7b83870
2 changed files with 66 additions and 88 deletions

View File

@ -41,17 +41,7 @@ public class IdGenerator {
static {
String stub = "";
boolean canAccessSystemProps = true;
try {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPropertiesAccess();
}
} catch (SecurityException se) {
canAccessSystemProps = false;
}
if (canAccessSystemProps) {
int idGeneratorPort = 0;
ServerSocket ss = null;
try {
@ -85,7 +75,6 @@ public class IdGenerator {
}
}
}
}
if (hostName == null) {
hostName = "localhost";

View File

@ -41,17 +41,6 @@ public class IdGenerator {
static {
String stub = "";
boolean canAccessSystemProps = true;
try {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPropertiesAccess();
}
} catch (SecurityException se) {
canAccessSystemProps = false;
}
if (canAccessSystemProps) {
hostName = System.getProperty(PROPERTY_IDGENERATOR_HOSTNAME);
int localPort = Integer.parseInt(System.getProperty(PROPERTY_IDGENERATOR_LOCALPORT, "0"));
@ -97,7 +86,7 @@ public class IdGenerator {
}
}
}
}
// fallback
if (hostName == null) {
hostName = "localhost";