Skip to content

Commit 17458be

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 33d26bd commit 17458be

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/docs/asciidoc/release_notes.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ This could also hang the cleaner thread used for closing leaked statements.
4444
* Fixed: `ResultSet` move incorrectly closes input `Clob` (https://github.com/FirebirdSQL/jaybird/issues/880[#880])
4545
* Fixed: Batch execution with multiple empty strings resulted in error _"Repeated blob id 0:0 in registerBlob()"_ (https://github.com/FirebirdSQL/jaybird/issues/888[#888])
4646
* Dependency update: updated `org.bouncycastle:bcprov-jdk18on` from 1.80 to 1.81 (used by `chacha64-plugin`) (https://github.com/FirebirdSQL/jaybird/issues/889[#889])
47+
* Fixed: On Java 24, `Connection.abort`, `Connection.setNetworkTimeout`, and `OperationMonitor.initOperationAware` always throw _"java.lang.SecurityException: checking permissions is not supported"_ (https://github.com/FirebirdSQL/jaybird/issues/890[#890])
4748

4849
=== Jaybird 6.0.2
4950

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,12 @@ static void endOperation(Operation operation) {
8181
* If a security manager is installed and the calling code does not have permission {@code
8282
* "org.firebirdsql.jaybird.initOperationAware"}
8383
*/
84+
@SuppressWarnings("removal")
8485
public static void initOperationAware(OperationAware operationAware) {
85-
PERMISSION_INIT_OPERATION_AWARE.checkGuard(OperationMonitor.class);
86+
var sm = System.getSecurityManager();
87+
if (sm != null) {
88+
sm.checkPermission(PERMISSION_INIT_OPERATION_AWARE);
89+
}
8690
instance.set(operationAware != null
8791
? operationAware
8892
: NoOpOperationAware.INSTANCE);

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

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

12841284
@Override
1285-
@SuppressWarnings("java:S1141")
1285+
@SuppressWarnings({ "java:S1141", "removal" })
12861286
public void abort(Executor executor) throws SQLException {
12871287
// NOTE: None of these operations are performed under lock (except maybe very late in the cleanup)
12881288
if (isClosed()) return;
1289-
PERMISSION_CALL_ABORT.checkGuard(this);
1289+
var sm = System.getSecurityManager();
1290+
if (sm != null) {
1291+
sm.checkPermission(PERMISSION_CALL_ABORT);
1292+
}
12901293
if (executor == null) {
12911294
throw FbExceptionBuilder.toException(jb_invalidExecutor);
12921295
}
@@ -1328,9 +1331,13 @@ public void abort(Executor executor) throws SQLException {
13281331
});
13291332
}
13301333

1334+
@SuppressWarnings("removal")
13311335
@Override
13321336
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
1333-
PERMISSION_SET_NETWORK_TIMEOUT.checkGuard(this);
1337+
var sm = System.getSecurityManager();
1338+
if (sm != null) {
1339+
sm.checkPermission(PERMISSION_SET_NETWORK_TIMEOUT);
1340+
}
13341341
if (executor == null) {
13351342
throw FbExceptionBuilder.toException(jb_invalidExecutor);
13361343
}

0 commit comments

Comments
 (0)