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 09:53:34 UTC
[tomcat] branch 9.0.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 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 f40d672 Remove some SuppressWarnings annotations that are not necessary
f40d672 is described below
commit f40d672e0734e18ae1c2c0ca88675696705d1db1
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 --
java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java | 1 -
11 files changed, 17 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 5dea527..23775c1 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingPreparedStatement.java
@@ -686,7 +686,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 0f61d1f..ad1021e 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingResultSet.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingResultSet.java
@@ -605,7 +605,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 8436e8f..aa30871 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/DelegatingStatement.java
@@ -464,7 +464,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 da21dae..86e6d4e 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 6d2456b..d15fb40 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();
diff --git a/java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java b/java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java
index fa4aff3..a2e7373 100644
--- a/java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java
+++ b/java/org/apache/tomcat/dbcp/dbcp2/managed/ManagedConnection.java
@@ -258,7 +258,6 @@ public class ManagedConnection<C extends Connection> extends DelegatingConnectio
// in the transaction, replace our delegate with the enrolled connection
// return current connection to the pool
- @SuppressWarnings("resource")
final C connection = getDelegateInternal();
setDelegate(null);
if (connection != null && transactionContext.getSharedConnection() != connection) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org