Merge pull request #1128 from hyteio/AMQ-9216

[AMQ-9216] Remove deprecated java.lang.SecurityManager usage from activemq-client IdGenerator
This commit is contained in:
JB Onofré 2024-02-28 16:54:32 +01:00 committed by GitHub
commit 99dced2fa7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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";