This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 792ef8125d Fix IDE warnings
792ef8125d is described below

commit 792ef8125d47a8bfa2246207d919e1a0bd3c143e
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Nov 25 11:13:30 2026 +0000

    Fix IDE warnings
---
 .../src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java       | 2 ++
 .../java/org/apache/tomcat/jdbc/pool/ClosedPoolBorrowConnectBase.java   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
index 19e7656a63..07a29243ab 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
@@ -806,6 +806,7 @@ public class ConnectionPool {
      *
      * @param force {@code true} to close the active connections as well
      */
+    @SuppressWarnings("null")
     protected void close(boolean force) {
         // Claim the closure atomically. Two callers that observe the open 
state
         // at the same time would otherwise both run the drain and deliver the
@@ -880,6 +881,7 @@ public class ConnectionPool {
         PoolProperties.InterceptorDefinition[] toldStarted = closingDuringInit 
&& started != null
                 ? Arrays.copyOf(started, startedLimit) : started;
         synchronized (interceptorStartLock) {
+            // No NPE. If started is null, startedLimit will be zero.
             for (int i = 0; i < startedLimit; i++) {
                 informInterceptorOfPoolClosure(started[i]);
             }
diff --git 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/ClosedPoolBorrowConnectBase.java
 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/ClosedPoolBorrowConnectBase.java
index f459b002c0..9a2c3e80b8 100644
--- 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/ClosedPoolBorrowConnectBase.java
+++ 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/ClosedPoolBorrowConnectBase.java
@@ -113,7 +113,7 @@ abstract class ClosedPoolBorrowConnectBase extends 
JdbcPoolBaseTest {
 
             AtomicReference<Throwable> failure = new AtomicReference<>();
             Thread borrower = new Thread(() -> {
-                try (Connection pooled = pool.getConnection()) {
+                try (@SuppressWarnings("unused") Connection pooled = 
pool.getConnection()) {
                     Assertions.fail("a closed pool must not hand out a 
connection");
                 } catch (SQLException x) {
                     failure.set(x);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to