You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/04/17 10:53:16 UTC

[tomcat] branch 8.5.x updated: Remove some SuppressWarnings annotations that are not necessary

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 5d1c58b  Remove some SuppressWarnings annotations that are not necessary
5d1c58b is described below

commit 5d1c58b9c68792d97f5762969772c314ac8c3faa
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Apr 17 10:52:21 2020 +0100

    Remove some SuppressWarnings annotations that are not necessary
    
    These annotations create IDE warnings rather than suppress them.
---
 java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java                 | 2 --
 java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java            | 3 ---
 java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java     | 1 -
 java/org/apache/tomcat/dbcp/dbcp2/DelegatingResultSet.java             | 1 -
 java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java             | 1 -
 java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java               | 2 --
 java/org/apache/tomcat/dbcp/dbcp2/PoolingDriver.java                   | 1 -
 .../org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java | 2 --
 .../tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSourceFactory.java    | 1 -
 .../apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSource.java    | 2 --
 10 files changed, 16 deletions(-)

diff --git a/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java b/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java
index 6345a22..4af74ab 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java
@@ -106,7 +106,6 @@ public class BasicDataSource implements DataSource, BasicDataSourceMXBean, MBean
         }
     }
 
-    @SuppressWarnings("resource")
     protected static void validateConnectionFactory(final PoolableConnectionFactory connectionFactory)
             throws Exception {
         PoolableConnection conn = null;
@@ -1442,7 +1441,6 @@ public class BasicDataSource implements DataSource, BasicDataSourceMXBean, MBean
      * @throws IllegalStateException if invalidating the connection failed.
      * @since 2.1
      */
-    @SuppressWarnings("resource")
     public void invalidateConnection(final Connection connection) throws IllegalStateException {
         if (connection == null) {
             return;
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java
index 1a83305..737f171 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingConnection.java
@@ -88,7 +88,6 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
     /**
      * Returns a string representation of the metadata associated with the innermost delegate connection.
      */
-    @SuppressWarnings("resource")
     @Override
     public synchronized String toString() {
         String str = null;
@@ -139,7 +138,6 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
      *            connection to compare innermost delegate with
      * @return true if innermost delegate equals <code>c</code>
      */
-    @SuppressWarnings("resource")
     public boolean innermostDelegateEquals(final Connection c) {
         final Connection innerCon = getInnermostDelegateInternal();
         if (innerCon == null) {
@@ -172,7 +170,6 @@ public class DelegatingConnection<C extends Connection> extends AbandonedTrace i
      *
      * @return innermost delegate.
      */
-    @SuppressWarnings("resource")
     public final Connection getInnermostDelegateInternal() {
         Connection conn = connection;
         while (conn != null && conn instanceof DelegatingConnection) {
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java
index 6719ead..a0bcea7 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java
@@ -645,7 +645,6 @@ public class DelegatingPreparedStatement extends DelegatingStatement implements
      *
      * @return String
      */
-    @SuppressWarnings("resource")
     @Override
     public synchronized String toString() {
         final Statement statement = getDelegate();
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingResultSet.java b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingResultSet.java
index 1561ede..c5650f5 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingResultSet.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingResultSet.java
@@ -604,7 +604,6 @@ public final class DelegatingResultSet extends AbandonedTrace implements ResultS
      *
      * @return the innermost delegate.
      */
-    @SuppressWarnings("resource")
     public ResultSet getInnermostDelegate() {
         ResultSet r = resultSet;
         while (r != null && r instanceof DelegatingResultSet) {
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
index f79e36e..9f5fec1 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
@@ -389,7 +389,6 @@ public class DelegatingStatement extends AbandonedTrace implements Statement {
      *
      * @see #getDelegate
      */
-    @SuppressWarnings("resource")
     public Statement getInnermostDelegate() {
         Statement s = statement;
         while (s != null && s instanceof DelegatingStatement) {
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java b/java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java
index 57dd54a..e278722 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/PoolingConnection.java
@@ -295,7 +295,6 @@ public class PoolingConnection extends DelegatingConnection<Connection>
      *            the key for the {@link PreparedStatement} to be created
      * @see #createKey(String, int, int, StatementType)
      */
-    @SuppressWarnings("resource")
     @Override
     public PooledObject<DelegatingPreparedStatement> makeObject(final PStmtKey key) throws Exception {
         if (null == key) {
@@ -335,7 +334,6 @@ public class PoolingConnection extends DelegatingConnection<Connection>
     @Override
     public void passivateObject(final PStmtKey key, final PooledObject<DelegatingPreparedStatement> pooledObject)
             throws Exception {
-        @SuppressWarnings("resource")
         final DelegatingPreparedStatement dps = pooledObject.getObject();
         dps.clearParameters();
         dps.passivate();
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/PoolingDriver.java b/java/org/apache/tomcat/dbcp/dbcp2/PoolingDriver.java
index 9cbed71..cddf329 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/PoolingDriver.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/PoolingDriver.java
@@ -116,7 +116,6 @@ public class PoolingDriver implements Driver {
      *             Thrown when a problem is caught closing the pool.
      */
     public synchronized void closePool(final String name) throws SQLException {
-        @SuppressWarnings("resource")
         final ObjectPool<? extends Connection> pool = pools.get(name);
         if (pool != null) {
             pools.remove(name);
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java b/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java
index 7127e45..147ee26 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/cpdsadapter/PooledConnectionImpl.java
@@ -417,7 +417,6 @@ class PooledConnectionImpl
      * @param key
      *            The key for the {@link PreparedStatement} to be created.
      */
-    @SuppressWarnings("resource")
     @Override
     public PooledObject<DelegatingPreparedStatement> makeObject(final PStmtKey key) throws Exception {
         if (null == key) {
@@ -470,7 +469,6 @@ class PooledConnectionImpl
     @Override
     public void passivateObject(final PStmtKey key, final PooledObject<DelegatingPreparedStatement> pooledObject)
             throws Exception {
-        @SuppressWarnings("resource")
         final DelegatingPreparedStatement dps = pooledObject.getObject();
         dps.clearParameters();
         dps.passivate();
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSourceFactory.java b/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSourceFactory.java
index c471d53..df46b3f 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSourceFactory.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/datasources/InstanceKeyDataSourceFactory.java
@@ -89,7 +89,6 @@ abstract class InstanceKeyDataSourceFactory implements ObjectFactory {
             // Bullet-proof to avoid anything else but problems from InstanceKeyDataSource#close().
             final Entry<String, InstanceKeyDataSource> next = instanceIterator.next();
             if (next != null) {
-                @SuppressWarnings("resource")
                 final InstanceKeyDataSource value = next.getValue();
                 if (value != null) {
                     try {
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSource.java b/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSource.java
index fd5a7ef..a580173 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSource.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/datasources/PerUserPoolDataSource.java
@@ -157,7 +157,6 @@ public class PerUserPoolDataSource extends InstanceKeyDataSource {
      *            The user name key.
      * @return The user specific value.
      */
-    @SuppressWarnings("resource")
     public int getNumActive(final String userName) {
         final ObjectPool<PooledConnectionAndInfo> pool = getPool(getPoolKey(userName));
         return pool == null ? 0 : pool.getNumActive();
@@ -179,7 +178,6 @@ public class PerUserPoolDataSource extends InstanceKeyDataSource {
      *            The user name key.
      * @return The user specific value.
      */
-    @SuppressWarnings("resource")
     public int getNumIdle(final String userName) {
         final ObjectPool<PooledConnectionAndInfo> pool = getPool(getPoolKey(userName));
         return pool == null ? 0 : pool.getNumIdle();


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org