Skip to content

Commit dc7ec0a

Browse files
committed
#890 Replace Permission#checkGuard with SecurityManager#checkPermission
Fixes `Connection.abort`, `Connection.setNetworkTimeout`, and `OperationMonitor.initOperationAware` always throwing _"java.lang.SecurityException: checking permissions is not supported"_ on Java 24.
1 parent d6d5cdc commit dc7ec0a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/main/org/firebirdsql/gds/ng/OperationMonitor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ static void endOperation(Operation operation) {
6666
* If a security manager is installed and the calling code does not have permission {@code
6767
* "org.firebirdsql.jaybird.initOperationAware"}
6868
*/
69+
@SuppressWarnings("removal")
6970
public static void initOperationAware(OperationAware operationAware) {
70-
PERMISSION_INIT_OPERATION_AWARE.checkGuard(OperationMonitor.class);
71+
var sm = System.getSecurityManager();
72+
if (sm != null) {
73+
sm.checkPermission(PERMISSION_INIT_OPERATION_AWARE);
74+
}
7175
instance.set(operationAware != null
7276
? operationAware
7377
: NoOpOperationAware.INSTANCE);

src/main/org/firebirdsql/jdbc/FBConnection.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,11 +1274,14 @@ public void resetKnownClientInfoProperties() {
12741274
}
12751275

12761276
@Override
1277-
@SuppressWarnings("java:S1141")
1277+
@SuppressWarnings({ "java:S1141", "removal" })
12781278
public void abort(Executor executor) throws SQLException {
12791279
// NOTE: None of these operations are performed under lock (except maybe very late in the cleanup)
12801280
if (isClosed()) return;
1281-
PERMISSION_CALL_ABORT.checkGuard(this);
1281+
var sm = System.getSecurityManager();
1282+
if (sm != null) {
1283+
sm.checkPermission(PERMISSION_CALL_ABORT);
1284+
}
12821285
if (executor == null) {
12831286
throw FbExceptionBuilder.toException(jb_invalidExecutor);
12841287
}
@@ -1320,9 +1323,13 @@ public void abort(Executor executor) throws SQLException {
13201323
});
13211324
}
13221325

1326+
@SuppressWarnings("removal")
13231327
@Override
13241328
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
1325-
PERMISSION_SET_NETWORK_TIMEOUT.checkGuard(this);
1329+
var sm = System.getSecurityManager();
1330+
if (sm != null) {
1331+
sm.checkPermission(PERMISSION_SET_NETWORK_TIMEOUT);
1332+
}
13261333
if (executor == null) {
13271334
throw FbExceptionBuilder.toException(jb_invalidExecutor);
13281335
}

0 commit comments

Comments
 (0)