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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new c105177fef Fix IDE warnings
c105177fef is described below

commit c105177fefdcc9b1d574af70dada96b43095ae65
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Oct 27 16:14:05 2026 +0000

    Fix IDE warnings
---
 .../main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java  | 1 +
 .../test/java/org/apache/tomcat/jdbc/pool/TestProxyContract.java | 1 +
 .../tomcat/jdbc/pool/TestThrowingDisconnectedInterceptor.java    | 9 +++------
 .../apache/tomcat/jdbc/pool/TestThrowingResetInterceptor.java    | 3 +--
 .../tomcat/jdbc/pool/interceptor/TestInterceptorSemantics.java   | 2 +-
 5 files changed, 7 insertions(+), 9 deletions(-)

diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
index 15d2ad129f..4390a8afe3 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java
@@ -267,6 +267,7 @@ public class PooledConnection implements 
PooledConnectionMBean {
      * Connects using the configured DataSource.
      * @throws SQLException if unable to obtain a connection from the 
DataSource
      */
+    @SuppressWarnings("null") // Suppress false positive warnings
     protected void connectUsingDataSource() throws SQLException {
         String usr = null;
         String pwd = null;
diff --git 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestProxyContract.java
 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestProxyContract.java
index 52d1ed131e..a64a75c894 100644
--- 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestProxyContract.java
+++ 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestProxyContract.java
@@ -108,6 +108,7 @@ class TestProxyContract extends JdbcPoolBaseTest {
         }
     }
 
+    @SuppressWarnings("unlikely-arg-type") // Use of unlikely arg-type is 
deliberate
     @Test
     void equalsAgainstNullOrForeignObjectsIsFalseNotAnException()
             throws Exception {
diff --git 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingDisconnectedInterceptor.java
 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingDisconnectedInterceptor.java
index db419b1098..239baceadd 100644
--- 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingDisconnectedInterceptor.java
+++ 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingDisconnectedInterceptor.java
@@ -72,10 +72,8 @@ class TestThrowingDisconnectedInterceptor extends 
JdbcPoolBaseTest {
         // test: an abandoned, unclosed physical connection is otherwise
         // reclaimed by the JDK's socket cleaner and the leaked database
         // sessions would disappear with GC timing instead of staying open
-        java.sql.Connection physicalFirst =
-                ((PooledConnection) 
first.unwrap(PooledConnection.class)).getConnection();
-        java.sql.Connection physicalSecond =
-                ((PooledConnection) 
second.unwrap(PooledConnection.class)).getConnection();
+        java.sql.Connection physicalFirst = 
first.unwrap(PooledConnection.class).getConnection();
+        java.sql.Connection physicalSecond = 
second.unwrap(PooledConnection.class).getConnection();
         awaitSessions(2);
         first.close();
         second.close();
@@ -98,8 +96,7 @@ class TestThrowingDisconnectedInterceptor extends 
JdbcPoolBaseTest {
                 BoomInterceptor.class.getName() + ";" + 
RecordingInterceptor.class.getName());
         Connection con = ds.getConnection();
         // keep the physical connection strongly reachable (see above)
-        java.sql.Connection physical =
-                ((PooledConnection) 
con.unwrap(PooledConnection.class)).getConnection();
+        java.sql.Connection physical = 
con.unwrap(PooledConnection.class).getConnection();
         con.close();
         ds.close();
         Assertions.assertEquals(1, 
RecordingInterceptor.DISCONNECTED_CALLS.get(),
diff --git 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingResetInterceptor.java
 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingResetInterceptor.java
index 08558a7714..b35b8439af 100644
--- 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingResetInterceptor.java
+++ 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingResetInterceptor.java
@@ -95,8 +95,7 @@ class TestThrowingResetInterceptor extends JdbcPoolBaseTest {
                 ThrowResetInterceptor.class.getName() + ";" + 
RecordingInterceptor.class.getName());
         Connection con = ds.getConnection();
         // keep the physical connection strongly reachable (see above)
-        java.sql.Connection physical =
-                ((PooledConnection) 
con.unwrap(PooledConnection.class)).getConnection();
+        java.sql.Connection physical = 
con.unwrap(PooledConnection.class).getConnection();
         con.close();
         ds.close();
         // a shutdown reset walks the chain twice by existing design
diff --git 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptorSemantics.java
 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptorSemantics.java
index ed4fb3ed30..04f7e74f22 100644
--- 
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptorSemantics.java
+++ 
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptorSemantics.java
@@ -388,7 +388,7 @@ class TestInterceptorSemantics extends JdbcPoolBaseTest {
         String t = uniqueTable();
         String sql = "CREATE TABLE " + t + " (v INT)";
         try (Connection c = ds.getConnection(); Statement st = 
c.createStatement()) {
-            Assertions.assertDoesNotThrow(() -> st.execute(sql),
+            Assertions.assertDoesNotThrow(() -> 
Boolean.valueOf(st.execute(sql)),
                     "a throwing reporter must not disturb the application");
         }
         // positive control: the hook ran and booked the execution before


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

Reply via email to