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 da128675b4 Fix IDE warnings
da128675b4 is described below
commit da128675b4afdbae49ce588a379028a52938959a
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Nov 6 00:26:38 2026 +0000
Fix IDE warnings
---
.../core/ThreadLocalLeakPreventionListener.java | 2 ++
.../catalina/ha/deploy/FileMessageFactory.java | 1 -
.../catalina/loader/WebappClassLoaderBase.java | 1 -
java/org/apache/catalina/startup/ExpandWar.java | 2 +-
java/org/apache/catalina/startup/HostConfig.java | 1 -
.../apache/jasper/servlet/JspCServletContext.java | 2 +-
.../apache/tomcat/util/net/AbstractEndpoint.java | 1 +
.../jdbc/naming/GenericNamingResourcesFactory.java | 1 -
.../apache/tomcat/jdbc/pool/ConnectionPool.java | 25 ++++++++++++----------
.../apache/tomcat/jdbc/pool/PoolProperties.java | 1 +
.../AbstractCreateStatementInterceptor.java | 6 +++---
.../jdbc/pool/interceptor/ConnectionState.java | 2 +-
.../pool/interceptor/QueryTimeoutInterceptor.java | 10 +++++----
.../jdbc/pool/interceptor/SlowQueryReport.java | 4 ++--
.../tomcat/jdbc/pool/jmx/ConnectionPool.java | 2 +-
.../TestDataSourceFactoryRefAddrContent.java | 8 +++----
.../tomcat/jdbc/naming/TestNamingFactory.java | 18 ++++++++--------
.../tomcat/jdbc/pool/TestAbandonedTrace.java | 2 +-
.../tomcat/jdbc/pool/TestAbortEndsTheBorrow.java | 10 ++++++---
.../jdbc/pool/TestAsyncBorrowCancelRace.java | 4 ++--
.../pool/TestAsyncBorrowFailureDiagnostics.java | 2 +-
.../tomcat/jdbc/pool/TestBlankValidationQuery.java | 7 +++---
.../jdbc/pool/TestBorrowReturnStatistics.java | 2 +-
.../jdbc/pool/TestCloseVsConcurrentRelease.java | 12 +++++------
.../jdbc/pool/TestCloseVsForwardedInvoke.java | 6 +++---
.../jdbc/pool/TestCompositeValueBoundary.java | 6 ++----
.../tomcat/jdbc/pool/TestConnectionSetup.java | 4 ++--
.../jdbc/pool/TestCursorOutParameterSealing.java | 4 ++++
.../jdbc/pool/TestDataSourceProxyCredentials.java | 2 +-
.../tomcat/jdbc/pool/TestFairBlockingQueue.java | 2 +-
.../jdbc/pool/TestInterruptedBorrowWait.java | 4 ++--
.../jdbc/pool/TestPoolExhaustionSqlState.java | 2 +-
.../tomcat/jdbc/pool/TestRequestBoundaries.java | 2 +-
.../jdbc/pool/TestStatementWrapperContract.java | 2 --
.../tomcat/jdbc/pool/TestThrowingValidator.java | 1 +
.../tomcat/jdbc/pool/TestWrapperDelegation.java | 2 +-
.../pool/interceptor/TestQueryReportIdentity.java | 3 +++
.../TestResetAbandonedTimerCursorOutParameter.java | 2 ++
.../TestResetAbandonedTimerNestedCursor.java | 6 ++++--
.../interceptor/TestSlowQueryJmxNotifications.java | 4 ++--
.../TestSlowQueryReportSharedStatistics.java | 4 ++--
.../interceptor/TestStatementCacheRacingPark.java | 2 +-
.../TestStatementDecoratorIdentity.java | 4 ++--
.../pool/interceptor/TestStatementFinalizer.java | 3 ++-
.../jdbc/pool/jmx/TestJmxNotificationDelivery.java | 5 +++--
.../tomcat/jdbc/pool/jmx/TestJmxRegistration.java | 4 ++--
.../tomcat/jdbc/pool/util/TestMessageFactory.java | 2 +-
.../apache/catalina/manager/TestManagerWebapp.java | 2 +-
.../tribes/tipis/TestAbstractReplicatedMap.java | 2 +-
test/org/apache/el/parser/TestAstIdentifier.java | 6 +++---
.../apache/el/stream/TestCollectionOperations.java | 3 +--
.../tomcat/integration/httpd/TesterHttpd.java | 2 +-
.../SSLUtilBaseCertificateSelectionTestBase.java | 12 ++++++-----
.../util/threads/TestInlineExecutorService.java | 4 ++++
.../util/threads/TestThreadPoolExecutor.java | 1 +
55 files changed, 130 insertions(+), 104 deletions(-)
diff --git
a/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java
b/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java
index 9d0b21286e..981583655e 100644
--- a/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java
+++ b/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java
@@ -125,9 +125,11 @@ public class ThreadLocalLeakPreventionListener extends
FrameworkListener {
}
if (executor instanceof ThreadPoolExecutor) {
+ @SuppressWarnings("resource")
ThreadPoolExecutor threadPoolExecutor =
(ThreadPoolExecutor) executor;
threadPoolExecutor.contextStopping();
} else if (executor instanceof StandardThreadExecutor) {
+ @SuppressWarnings("resource")
StandardThreadExecutor stdThreadExecutor =
(StandardThreadExecutor) executor;
stdThreadExecutor.contextStopping();
}
diff --git a/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
b/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
index 0060dbc7a0..4f2fbffb39 100644
--- a/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
+++ b/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
@@ -360,7 +360,6 @@ public class FileMessageFactory {
System.out.println("Actually wrote " + cnt + " messages.");
}
- /// main
public File getFile() {
return file;
diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
index 8085d93b9d..cc72811a4e 100644
--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
@@ -1772,7 +1772,6 @@ public abstract class WebappClassLoaderBase extends
URLClassLoader
}
- @SuppressWarnings("deprecation") // thread.stop()
private void clearReferencesThreads() {
Thread[] threads = getThreads();
List<Thread> threadsToStop = new ArrayList<>();
diff --git a/java/org/apache/catalina/startup/ExpandWar.java
b/java/org/apache/catalina/startup/ExpandWar.java
index 5df4946a05..fdb0bc03b3 100644
--- a/java/org/apache/catalina/startup/ExpandWar.java
+++ b/java/org/apache/catalina/startup/ExpandWar.java
@@ -87,7 +87,7 @@ public class ExpandWar {
File warTracker = new File(host.getAppBaseFile(), pathname +
Constants.WarTracker);
long warLastModified;
- try (InputStream is = jfuc.getInputStream()) {
+ try (@SuppressWarnings("unused") InputStream is =
jfuc.getInputStream()) {
// Get the last modified time for the WAR
warLastModified = jfuc.getLastModified();
}
diff --git a/java/org/apache/catalina/startup/HostConfig.java
b/java/org/apache/catalina/startup/HostConfig.java
index 2c7c0be2bd..f73978043c 100644
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -629,7 +629,6 @@ public class HostConfig implements LifecycleListener {
* @param cn The context name
* @param contextXml The descriptor
*/
- @SuppressWarnings("null") // context is not null
protected void deployDescriptor(ContextName cn, File contextXml) {
// Check for descriptors with /../ /./ or similar sequences in the name
diff --git a/java/org/apache/jasper/servlet/JspCServletContext.java
b/java/org/apache/jasper/servlet/JspCServletContext.java
index eae3b12ba9..cf6a5f543f 100644
--- a/java/org/apache/jasper/servlet/JspCServletContext.java
+++ b/java/org/apache/jasper/servlet/JspCServletContext.java
@@ -329,7 +329,7 @@ public class JspCServletContext implements ServletContext {
// they are by the runtime container.
URI uri = new URI(myResourceBaseURL.toExternalForm() +
encodePath(path));
url = uri.toURL();
- try (InputStream is = url.openStream()) {
+ try (@SuppressWarnings("unused") InputStream is =
url.openStream()) {
}
} catch (IOException | URISyntaxException e) {
// The resource does not exist or the URL could not be built.
diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 56f3f3fc7b..1920625c6b 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -1787,6 +1787,7 @@ public abstract class AbstractEndpoint<S, U> {
this.executor = null;
if (executor instanceof ThreadPoolExecutor) {
// this is our internal one, so we need to shut it down
+ @SuppressWarnings("resource")
ThreadPoolExecutor tpe = (ThreadPoolExecutor) executor;
tpe.shutdownNow();
long timeout = getExecutorTerminationTimeoutMillis();
diff --git
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
index ef53408515..cfbcedc12b 100644
---
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
+++
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java
@@ -429,7 +429,6 @@ public class GenericNamingResourcesFactory implements
ObjectFactory {
* failed property, instead of escaping unconverted from within a catch
* block the outer handlers cannot guard.
*/
- @SuppressWarnings("null") // voidBag can't be null where it is used
private static SetResult applyPropertyBag(Object o, String name,
String value, Method boolBag, Method voidBag)
throws IllegalAccessException, InvocationTargetException {
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 22c5f0595b..acc63aa20b 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
@@ -1074,7 +1074,8 @@ public class ConnectionPool {
*/
public void checkPoolConfiguration(PoolConfiguration properties) {
if (properties.getMaxActive() < 1) {
- log.warn(MessageFactory.get("connectionPool.maxActiveTooSmall",
PoolProperties.DEFAULT_MAX_ACTIVE));
+ log.warn(MessageFactory.get("connectionPool.maxActiveTooSmall",
+ Integer.valueOf(PoolProperties.DEFAULT_MAX_ACTIVE)));
properties.setMaxActive(PoolProperties.DEFAULT_MAX_ACTIVE);
}
if (properties.getInitialSize() < 0) {
@@ -1093,24 +1094,26 @@ public class ConnectionPool {
properties.setMaxIdle(0);
}
if (properties.getMaxActive() < properties.getInitialSize()) {
- log.warn(MessageFactory.get("connectionPool.initialSizeTooLarge",
properties.getMaxActive()));
+ log.warn(MessageFactory.get("connectionPool.initialSizeTooLarge",
+ Integer.valueOf(properties.getMaxActive())));
properties.setInitialSize(properties.getMaxActive());
}
if (properties.getMinIdle() > properties.getMaxActive()) {
- log.warn(MessageFactory.get("connectionPool.minIdleTooLarge",
properties.getMaxActive()));
+ log.warn(MessageFactory.get("connectionPool.minIdleTooLarge",
Integer.valueOf(properties.getMaxActive())));
properties.setMinIdle(properties.getMaxActive());
}
if (properties.getMaxIdle() > properties.getMaxActive()) {
- log.warn(MessageFactory.get("connectionPool.maxIdleTooLarge",
properties.getMaxActive()));
+ log.warn(MessageFactory.get("connectionPool.maxIdleTooLarge",
Integer.valueOf(properties.getMaxActive())));
properties.setMaxIdle(properties.getMaxActive());
}
if (properties.getMaxIdle() < properties.getMinIdle()) {
- log.warn(MessageFactory.get("connectionPool.maxIdleTooSmall",
properties.getMinIdle()));
+ log.warn(MessageFactory.get("connectionPool.maxIdleTooSmall",
Integer.valueOf(properties.getMinIdle())));
properties.setMaxIdle(properties.getMinIdle());
}
if (properties.getMaxAge() > 0 && properties.isPoolSweeperEnabled() &&
properties.getTimeBetweenEvictionRunsMillis() >
properties.getMaxAge()) {
-
log.warn(MessageFactory.get("connectionPool.timeBetweenEvictionRunsTooLarge",
properties.getMaxAge()));
+
log.warn(MessageFactory.get("connectionPool.timeBetweenEvictionRunsTooLarge",
+ Long.valueOf(properties.getMaxAge())));
properties.setTimeBetweenEvictionRunsMillis((int)
properties.getMaxAge());
}
}
@@ -1297,7 +1300,7 @@ public class ConnectionPool {
String trace = con.getStackTrace();
if (getPoolProperties().isLogAbandoned()) {
log.warn(MessageFactory.get("connectionPool.connectionSuspect",
- con, (System.currentTimeMillis() -
con.getTimestamp()), trace));
+ con, Long.valueOf(System.currentTimeMillis() -
con.getTimestamp()), trace));
}
org.apache.tomcat.jdbc.pool.jmx.ConnectionPool jmx = jmxPool;
if (jmx != null) {
@@ -1589,7 +1592,7 @@ public class ConnectionPool {
jmx.notify(org.apache.tomcat.jdbc.pool.jmx.ConnectionPool.POOL_EMPTY, "Pool
empty - no wait.");
}
throw new
PoolExhaustedException(MessageFactory.get("connectionPool.poolEmptyNoWait",
- Thread.currentThread().getName(), busy.size()));
+ Thread.currentThread().getName(),
Integer.valueOf(busy.size())));
}
// We didn't get a connection, lets see if we timed out
if (con == null) {
@@ -1611,8 +1614,8 @@ public class ConnectionPool {
"Pool empty - timeout.");
}
throw new
PoolExhaustedException(MessageFactory.get("connectionPool.poolEmptyTimeout",
- Thread.currentThread().getName(), (maxWait /
1000), size.get(), busy.size(),
- idle.size(), timetowait));
+ Thread.currentThread().getName(),
Long.valueOf(maxWait / 1000), Integer.valueOf(size.get()),
+ Integer.valueOf(busy.size()),
Integer.valueOf(idle.size()), Long.valueOf(timetowait)));
} else {
// No timeout, lets try again
continue;
@@ -2105,7 +2108,7 @@ public class ConnectionPool {
if (con.isSuspect()) {
if (poolProperties.isLogAbandoned() &&
log.isInfoEnabled()) {
log.info(MessageFactory.get("connectionPool.suspectConnectionReturned",
- con, (System.currentTimeMillis() -
con.getTimestamp())));
+ con, Long.valueOf(System.currentTimeMillis() -
con.getTimestamp())));
}
org.apache.tomcat.jdbc.pool.jmx.ConnectionPool jmx =
jmxPool;
if (jmx != null) {
diff --git
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
index dc0f8082fd..74cc4a0b41 100644
---
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
+++
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
@@ -606,6 +606,7 @@ public class PoolProperties implements PoolConfiguration,
Cloneable, Serializabl
}
}
}
+ @SuppressWarnings("null")
Set<String> keys = new HashSet<>(parsed.size());
for (String key : parsed.stringPropertyNames()) {
writable.setProperty(key, parsed.getProperty(key));
diff --git
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractCreateStatementInterceptor.java
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractCreateStatementInterceptor.java
index 224209a125..cba0babde2 100644
---
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractCreateStatementInterceptor.java
+++
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/AbstractCreateStatementInterceptor.java
@@ -223,7 +223,7 @@ public abstract class AbstractCreateStatementInterceptor
extends JdbcInterceptor
// An exception escaping the class initializer would surface as an
// ExceptionInInitializerError at every use of every subclass.
log.warn(MessageFactory.get("abstractCreateStatementInterceptor.unableToCreateConstructorCacheEntry",
- idx, clazz.getName()), e);
+ Integer.valueOf(idx), clazz.getName()), e);
}
}
@@ -345,8 +345,8 @@ public abstract class AbstractCreateStatementInterceptor
extends JdbcInterceptor
}
if (!clazz.isAssignableFrom(cached.getDeclaringClass())) {
throw new IllegalStateException(MessageFactory.get(
-
"abstractCreateStatementInterceptor.constructorCacheIndexPopulated",
- idx,
Arrays.toString(cached.getDeclaringClass().getInterfaces()), clazz.getName()));
+
"abstractCreateStatementInterceptor.constructorCacheIndexPopulated",
Integer.valueOf(idx),
+
Arrays.toString(cached.getDeclaringClass().getInterfaces()), clazz.getName()));
}
return cached;
}
diff --git
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
index 1426e09d28..5ca2d242fd 100644
---
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
+++
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/ConnectionState.java
@@ -223,7 +223,7 @@ public class ConnectionState extends JdbcInterceptor {
} else {
refusedIsolationLevel = defaultTransactionIsolation;
log.error(MessageFactory.get("connectionState.unableToResetTransactionIsolation",
- defaultTransactionIsolation), confirmed);
+ Integer.valueOf(defaultTransactionIsolation)),
confirmed);
}
}
}
diff --git
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/QueryTimeoutInterceptor.java
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/QueryTimeoutInterceptor.java
index accfa18761..c44938f3d1 100644
---
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/QueryTimeoutInterceptor.java
+++
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/QueryTimeoutInterceptor.java
@@ -127,7 +127,7 @@ public class QueryTimeoutInterceptor extends
AbstractCreateStatementInterceptor
timeout = Integer.parseInt(p.getValue());
} catch (NumberFormatException x) {
log.warn(MessageFactory.get("queryTimeoutInterceptor.invalidQueryTimeout",
- p.getValue(), timeout));
+ p.getValue(), Integer.valueOf(timeout)));
}
}
@@ -161,7 +161,7 @@ public class QueryTimeoutInterceptor extends
AbstractCreateStatementInterceptor
// warning could report.
if (pool != null && timeout > 0
&& pool.getPoolProperties().getDataSource() instanceof
javax.sql.XADataSource) {
- log.warn(MessageFactory.get("queryTimeoutInterceptor.xaBypass",
timeout));
+ log.warn(MessageFactory.get("queryTimeoutInterceptor.xaBypass",
Integer.valueOf(timeout)));
}
}
@@ -238,7 +238,8 @@ public class QueryTimeoutInterceptor extends
AbstractCreateStatementInterceptor
return;
}
timeoutRefusalReported = true;
-
log.warn(MessageFactory.get("queryTimeoutInterceptor.queryTimeoutRefused",
timeout, reasonOf(x)), x);
+
log.warn(MessageFactory.get("queryTimeoutInterceptor.queryTimeoutRefused",
Integer.valueOf(timeout),
+ reasonOf(x)), x);
}
/*
@@ -252,7 +253,8 @@ public class QueryTimeoutInterceptor extends
AbstractCreateStatementInterceptor
return;
}
timeoutFailureReported = true;
-
log.warn(MessageFactory.get("queryTimeoutInterceptor.queryTimeoutSetupFailed",
timeout, reasonOf(x)), x);
+
log.warn(MessageFactory.get("queryTimeoutInterceptor.queryTimeoutSetupFailed",
Integer.valueOf(timeout),
+ reasonOf(x)), x);
}
/*
diff --git
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
index 2d45744490..273a1f92a1 100644
---
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
+++
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
@@ -226,7 +226,7 @@ public class SlowQueryReport extends AbstractQueryReport {
// FAILED QUERY notification behind isLogFailed() alone, the two
// channels disagreeing on the same event.
if (isLogFailed() && log.isWarnEnabled()) {
- log.warn(MessageFactory.get("slowQueryReport.failedQueryReport",
sqlForLog(sql), delta));
+ log.warn(MessageFactory.get("slowQueryReport.failedQueryReport",
sqlForLog(sql), Long.valueOf(delta)));
}
return sql;
}
@@ -268,7 +268,7 @@ public class SlowQueryReport extends AbstractQueryReport {
// keeps sending the SLOW QUERY notification behind isLogSlow() alone,
// the two channels disagreeing on the same event.
if (isLogSlow() && log.isWarnEnabled()) {
- log.warn(MessageFactory.get("slowQueryReport.slowQueryReport",
sqlForLog(sql), delta));
+ log.warn(MessageFactory.get("slowQueryReport.slowQueryReport",
sqlForLog(sql), Long.valueOf(delta)));
}
return sql;
}
diff --git
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
index 229b405f5b..6d6b5d512f 100644
---
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
+++
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/jmx/ConnectionPool.java
@@ -298,7 +298,7 @@ public class ConnectionPool extends
NotificationBroadcasterSupport implements Co
// point of the bound, and must not fail the pool operation that
// reported the condition
log.warn(MessageFactory.get("jmxConnectionPool.droppingNotification",
- type, getNotificationSource(), NOTIFY_QUEUE_CAPACITY));
+ type, getNotificationSource(),
Integer.valueOf(NOTIFY_QUEUE_CAPACITY)));
return false;
} catch (Exception x) {
if (log.isDebugEnabled()) {
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/naming/TestDataSourceFactoryRefAddrContent.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/naming/TestDataSourceFactoryRefAddrContent.java
index bef1e185da..3eb2022ceb 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/naming/TestDataSourceFactoryRefAddrContent.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/naming/TestDataSourceFactoryRefAddrContent.java
@@ -373,9 +373,9 @@ class TestDataSourceFactoryRefAddrContent extends
JdbcPoolBaseTest {
case "toString":
return "SingleInterfaceDataSource";
case "hashCode":
- return System.identityHashCode(proxy);
+ return
Integer.valueOf(System.identityHashCode(proxy));
case "equals":
- return proxy == args[0];
+ return Boolean.valueOf(proxy == args[0]);
default:
try {
return method.invoke(delegate, args);
@@ -402,9 +402,9 @@ class TestDataSourceFactoryRefAddrContent extends
JdbcPoolBaseTest {
case "lookup":
return bound;
case "hashCode":
- return System.identityHashCode(proxy);
+ return
Integer.valueOf(System.identityHashCode(proxy));
case "equals":
- return proxy == args[0];
+ return Boolean.valueOf(proxy == args[0]);
case "toString":
return "ContextStub";
case "close":
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/naming/TestNamingFactory.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/naming/TestNamingFactory.java
index 6935969d66..61b2407e67 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/naming/TestNamingFactory.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/naming/TestNamingFactory.java
@@ -672,8 +672,8 @@ public class TestNamingFactory extends JdbcPoolBaseTest {
ObjectName oname2 = new ObjectName("tomcat.jdbc:type="
+ SlowQueryReportJmx.class.getName() + ",name=" + stored2);
- try (java.sql.Connection c1 = ds1.getConnection();
- java.sql.Connection c2 = ds2.getConnection()) {
+ try (@SuppressWarnings("unused") java.sql.Connection c1 =
ds1.getConnection();
+ @SuppressWarnings("unused") java.sql.Connection c2 =
ds2.getConnection()) {
Assertions.assertTrue(server.isRegistered(oname1),
"the first pool must publish its interceptor MBean under
its own name");
Assertions.assertTrue(server.isRegistered(oname2),
@@ -1262,19 +1262,19 @@ public class TestNamingFactory extends JdbcPoolBaseTest
{
last = this;
}
- public void setPort(int port) {
+ public void setPort(@SuppressWarnings("unused") int port) {
portSetter = "int";
}
- public void setPort(long port) {
+ public void setPort(@SuppressWarnings("unused") long port) {
portSetter = "long";
}
public String getPortSetter() {
return portSetter;
}
- public void setRatio(float ratio) {
+ public void setRatio(@SuppressWarnings("unused") float ratio) {
ratioSetter = "float";
}
- public void setRatio(double ratio) {
+ public void setRatio(@SuppressWarnings("unused") double ratio) {
ratioSetter = "double";
}
public String getRatioSetter() {
@@ -1397,11 +1397,11 @@ public class TestNamingFactory extends JdbcPoolBaseTest
{
public boolean isInvoked() {
return invoked;
}
- public boolean setProperty(String name) {
+ public boolean setProperty(@SuppressWarnings("unused") String name) {
invoked = true;
return true;
}
- public void setProperty(int index) {
+ public void setProperty(@SuppressWarnings("unused") int index) {
invoked = true;
}
}
@@ -1443,7 +1443,7 @@ public class TestNamingFactory extends JdbcPoolBaseTest {
public java.util.Map<String, String> getBag() {
return bag;
}
- public void setProperty(int index) {
+ public void setProperty(@SuppressWarnings("unused") int index) {
indexInvoked = true;
}
public boolean isIndexInvoked() {
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAbandonedTrace.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAbandonedTrace.java
index 6bc42181a6..7e4354357e 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAbandonedTrace.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAbandonedTrace.java
@@ -77,7 +77,7 @@ class TestAbandonedTrace extends JdbcPoolBaseTest {
Assertions.assertTrue(site instanceof StackTraceElement[],
"a borrow with logAbandoned must record the borrow site as
unformatted frames, "
+ "not a thread dump up front, but the slot held: "
- + (site == null ? "null" :
site.getClass().getName()));
+ + site.getClass().getName());
Assertions.assertTrue(((StackTraceElement[]) site).length > 0,
"the borrow must record a borrow site");
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAbortEndsTheBorrow.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAbortEndsTheBorrow.java
index 54f943d746..542978f1a0 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAbortEndsTheBorrow.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAbortEndsTheBorrow.java
@@ -782,9 +782,13 @@ class TestAbortEndsTheBorrow extends JdbcPoolBaseTest {
return false;
}
- /* Where a subclass may hold up the abort once the call is already
- inside the driver, the way a real driver's abort may run long; the
- specification allows it. The base driver's abort is not slowed. */
+ /**
+ * Where a subclass may hold up the abort once the call is already
+ * inside the driver, the way a real driver's abort may run long; the
+ * specification allows it. The base driver's abort is not slowed.
+ *
+ * @throws InterruptedException If the abort is interrupted
+ */
protected void parkInAbort() throws InterruptedException {
// NOOP
}
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAsyncBorrowCancelRace.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAsyncBorrowCancelRace.java
index 88488df7d1..01ab6d6cce 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAsyncBorrowCancelRace.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAsyncBorrowCancelRace.java
@@ -299,7 +299,7 @@ class TestAsyncBorrowCancelRace extends JdbcPoolBaseTest {
Assertions.assertEquals(0, ds.getActive());
// and it is still there for the next borrower
- try (Connection c = ds.getConnection()) {
+ try (@SuppressWarnings("unused") Connection c = ds.getConnection()) {
Assertions.assertEquals(1, ds.getActive());
}
ds.close();
@@ -367,7 +367,7 @@ class TestAsyncBorrowCancelRace extends JdbcPoolBaseTest {
"a completed cancellation must keep being reported");
// and the connection is still there for the next borrower
- try (Connection c = ds.getConnection()) {
+ try (@SuppressWarnings("unused") Connection c = ds.getConnection()) {
Assertions.assertEquals(1, ds.getActive());
}
ds.close();
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAsyncBorrowFailureDiagnostics.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAsyncBorrowFailureDiagnostics.java
index 2d04c6c75c..aa68a5d8c5 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAsyncBorrowFailureDiagnostics.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestAsyncBorrowFailureDiagnostics.java
@@ -315,7 +315,7 @@ class TestAsyncBorrowFailureDiagnostics extends
JdbcPoolBaseTest {
logs.assertNoCancelErrorLogged();
// and the reclaimed connection is there for the next borrower
- try (Connection c = ds.getConnection()) {
+ try (@SuppressWarnings("unused") Connection c =
ds.getConnection()) {
Assertions.assertEquals(1, ds.getActive());
}
ds.close();
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestBlankValidationQuery.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestBlankValidationQuery.java
index b6a77c9e67..2f0a0e71bd 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestBlankValidationQuery.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestBlankValidationQuery.java
@@ -72,7 +72,7 @@ class TestBlankValidationQuery {
case "isClosed" :
return Boolean.FALSE;
case "equals" :
- return proxy == args[0];
+ return Boolean.valueOf(proxy == args[0]);
case "hashCode" :
return
Integer.valueOf(System.identityHashCode(proxy));
case "toString" :
@@ -92,7 +92,7 @@ class TestBlankValidationQuery {
rec.lastExecuted = args == null || args.length ==
0 ? null : (String) args[0];
return Boolean.TRUE;
case "equals" :
- return proxy == args[0];
+ return Boolean.valueOf(proxy == args[0]);
case "hashCode" :
return
Integer.valueOf(System.identityHashCode(proxy));
case "toString" :
@@ -133,6 +133,7 @@ class TestBlankValidationQuery {
/** A configuration handing out statements that never passed through the
collapsing setters. */
private static final class BypassedConfiguration extends PoolProperties {
+ private static final long serialVersionUID = 1L;
private final String rawQuery;
private final String rawInitSql;
@@ -164,7 +165,7 @@ class TestBlankValidationQuery {
case "getConnection" :
return recordingConnection(rec);
case "equals" :
- return proxy == args[0];
+ return Boolean.valueOf(proxy == args[0]);
case "hashCode" :
return
Integer.valueOf(System.identityHashCode(proxy));
case "toString" :
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestBorrowReturnStatistics.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestBorrowReturnStatistics.java
index 275b7a2c7c..8d3f2a2043 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestBorrowReturnStatistics.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestBorrowReturnStatistics.java
@@ -129,7 +129,7 @@ class TestBorrowReturnStatistics extends JdbcPoolBaseTest {
Assertions.assertFalse(queued.isDone(),
"the poll must wait for a connection the pool cannot spare");
holder.close();
- try (Connection served = queued.get(AWAIT_TIMEOUT_MS,
TimeUnit.MILLISECONDS)) {
+ try (@SuppressWarnings("unused") Connection served =
queued.get(AWAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
Assertions.assertEquals(4, pool.getBorrowedCount(),
"the connection the queue handed to the waiting poll is "
+ "one borrow, counted once it is set up for "
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCloseVsConcurrentRelease.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCloseVsConcurrentRelease.java
index 6bcc2d9180..26d527377a 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCloseVsConcurrentRelease.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCloseVsConcurrentRelease.java
@@ -102,7 +102,7 @@ class TestCloseVsConcurrentRelease {
case "getAutoCommit" :
return Boolean.TRUE;
case "equals" :
- return proxy == args[0];
+ return Boolean.valueOf(proxy == args[0]);
case "hashCode" :
return
Integer.valueOf(System.identityHashCode(proxy));
case "toString" :
@@ -127,7 +127,7 @@ class TestCloseVsConcurrentRelease {
}
/** A connected session whose physical close is counted, on a counting
pool. */
- private static PooledConnection connectedTo(CountingPool pool, Recording
rec) throws SQLException {
+ private static PooledConnection connectedTo(CountingPool pool) throws
SQLException {
PooledConnection con = new PooledConnection(pool.props, pool);
con.connect();
return con;
@@ -145,7 +145,7 @@ class TestCloseVsConcurrentRelease {
case "getConnection" :
return recordingConnection(rec);
case "equals" :
- return proxy == args[0];
+ return Boolean.valueOf(proxy == args[0]);
case "hashCode" :
return
Integer.valueOf(System.identityHashCode(proxy));
case "toString" :
@@ -161,7 +161,7 @@ class TestCloseVsConcurrentRelease {
void aSecondReleaseDuringTheTerminalSequenceActsOnNothing() throws
Exception {
Recording rec = new Recording();
CountingPool pool = countingPool(rec);
- PooledConnection con = connectedTo(pool, rec);
+ PooledConnection con = connectedTo(pool);
AtomicBoolean firstResult = new AtomicBoolean();
Thread releaser = new Thread(() -> {
@@ -197,7 +197,7 @@ class TestCloseVsConcurrentRelease {
void aReconnectCannotResurrectASessionBeingTornDown() throws Exception {
Recording rec = new Recording();
CountingPool pool = countingPool(rec);
- PooledConnection con = connectedTo(pool, rec);
+ PooledConnection con = connectedTo(pool);
Thread releaser = new Thread(() -> pool.release(con),
"first-releaser");
releaser.start();
@@ -223,7 +223,7 @@ class TestCloseVsConcurrentRelease {
void aReleaseAfterTheFirstStaysALossWithoutTouchingAnything() throws
Exception {
Recording rec = new Recording();
CountingPool pool = countingPool(rec);
- PooledConnection con = connectedTo(pool, rec);
+ PooledConnection con = connectedTo(pool);
// This test is about the sequential second hand, not the held-up
// first one, so the notice does not need to park anyone.
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCloseVsForwardedInvoke.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCloseVsForwardedInvoke.java
index 00d60069c4..67135dfc2f 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCloseVsForwardedInvoke.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCloseVsForwardedInvoke.java
@@ -296,7 +296,7 @@ class TestCloseVsForwardedInvoke extends JdbcPoolBaseTest {
AtomicReference<Throwable> readFailure = new AtomicReference<>();
Thread reader = new Thread(() -> {
try {
- answered.set(held.getAutoCommit());
+ answered.set(Boolean.valueOf(held.getAutoCommit()));
} catch (Throwable t) {
readFailure.set(t);
}
@@ -446,7 +446,7 @@ class TestCloseVsForwardedInvoke extends JdbcPoolBaseTest {
AtomicReference<Throwable> readFailure = new AtomicReference<>();
Thread reader = new Thread(() -> {
try {
- answered.set(held.getAutoCommit());
+ answered.set(Boolean.valueOf(held.getAutoCommit()));
} catch (Throwable t) {
readFailure.set(t);
}
@@ -539,7 +539,7 @@ class TestCloseVsForwardedInvoke extends JdbcPoolBaseTest {
AtomicReference<Throwable> readFailure = new AtomicReference<>();
Thread reader = new Thread(() -> {
try {
- answered.set(held.getAutoCommit());
+ answered.set(Boolean.valueOf(held.getAutoCommit()));
} catch (Throwable t) {
readFailure.set(t);
}
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCompositeValueBoundary.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCompositeValueBoundary.java
index d625c10d23..f4c981a058 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCompositeValueBoundary.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCompositeValueBoundary.java
@@ -170,13 +170,11 @@ class TestCompositeValueBoundary extends JdbcPoolBaseTest
{
assertDriversOwnCursor(fromGetObject.getResultSet(),
"Array.getResultSet()");
assertDriversOwnCursor(
- fromGetObject.getResultSet(new HashMap<String,
Class<?>>()),
- "Array.getResultSet(Map)");
+ fromGetObject.getResultSet(new HashMap<>()),
"Array.getResultSet(Map)");
assertDriversOwnCursor(fromGetObject.getResultSet(1,
ARRAY_VALUES.length),
"Array.getResultSet(long, int)");
assertDriversOwnCursor(fromGetObject.getResultSet(1,
ARRAY_VALUES.length,
- new HashMap<String, Class<?>>()),
- "Array.getResultSet(long, int, Map)");
+ new HashMap<>()), "Array.getResultSet(long,
int, Map)");
try (ResultSet rows = fromGetObject.getResultSet()) {
readArrayRows(rows);
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestConnectionSetup.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestConnectionSetup.java
index d3af3e0c1f..d453db1047 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestConnectionSetup.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestConnectionSetup.java
@@ -692,11 +692,11 @@ class TestConnectionSetup extends JdbcPoolBaseTest {
private static void assertConfiguredDefault(Connection c, String method,
String value) throws SQLException {
switch (method) {
case "setReadOnly":
- Assertions.assertEquals(Boolean.parseBoolean(value),
c.isReadOnly(),
+ Assertions.assertEquals(Boolean.valueOf(value),
Boolean.valueOf(c.isReadOnly()),
"the restored read-only state must be the configured
one");
break;
case "setAutoCommit":
- Assertions.assertEquals(Boolean.parseBoolean(value),
c.getAutoCommit(),
+ Assertions.assertEquals(Boolean.valueOf(value),
Boolean.valueOf(c.getAutoCommit()),
"the restored auto-commit state must be the configured
one");
break;
case "setCatalog":
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCursorOutParameterSealing.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCursorOutParameterSealing.java
index 0421006131..b07d576c46 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCursorOutParameterSealing.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestCursorOutParameterSealing.java
@@ -299,6 +299,7 @@ class TestCursorOutParameterSealing extends
JdbcPoolBaseTest {
}
}
} else if ("unwrap".equals(name)) {
+ @SuppressWarnings("null")
Class<?> iface = (Class<?>) args[0];
if (DriverCursor.class.equals(iface)) {
// A driver's own cursor method hands back its
@@ -310,6 +311,7 @@ class TestCursorOutParameterSealing extends
JdbcPoolBaseTest {
}
return delegate.unwrap(iface);
} else if ("isWrapperFor".equals(name)) {
+ @SuppressWarnings("null")
Class<?> iface = (Class<?>) args[0];
return Boolean.valueOf(DriverCursor.class.equals(iface)
|| delegate.isWrapperFor(iface));
@@ -380,12 +382,14 @@ class TestCursorOutParameterSealing extends
JdbcPoolBaseTest {
return nestedCursor();
}
} else if ("unwrap".equals(name)) {
+ @SuppressWarnings("null")
Class<?> iface = (Class<?>) args[0];
if (DriverCursor.class.equals(iface)) {
return nestedCursor();
}
return delegate.unwrap(iface);
} else if ("isWrapperFor".equals(name)) {
+ @SuppressWarnings("null")
Class<?> iface = (Class<?>) args[0];
return Boolean.valueOf(DriverCursor.class.equals(iface)
|| delegate.isWrapperFor(iface));
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestDataSourceProxyCredentials.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestDataSourceProxyCredentials.java
index a050dab669..9bde254bdd 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestDataSourceProxyCredentials.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestDataSourceProxyCredentials.java
@@ -195,7 +195,7 @@ class TestDataSourceProxyCredentials {
volatile Runnable onMirrorWrite;
@Override
- public Object setProperty(String key, String value) {
+ public synchronized Object setProperty(String key, String value) {
if (PoolUtilities.PROP_PASSWORD.equals(key) &&
armed.compareAndSet(true, false)) {
onMirrorWrite.run();
}
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestFairBlockingQueue.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestFairBlockingQueue.java
index 891ddb44f1..1aea013805 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestFairBlockingQueue.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestFairBlockingQueue.java
@@ -545,7 +545,7 @@ class TestFairBlockingQueue {
} catch (InterruptedException e) {
thrown.set(e);
} finally {
- flagAfterPoll.set(Thread.currentThread().isInterrupted());
+
flagAfterPoll.set(Boolean.valueOf(Thread.currentThread().isInterrupted()));
done.countDown();
}
});
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestInterruptedBorrowWait.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestInterruptedBorrowWait.java
index 2112ff3b22..312be062e7 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestInterruptedBorrowWait.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestInterruptedBorrowWait.java
@@ -118,8 +118,8 @@ class TestInterruptedBorrowWait extends JdbcPoolBaseTest {
+ "as its cause");
// The property governs only the thread's flag, never the failure.
- Assertions.assertEquals(propagateInterruptState,
- outcome.interruptedAfterFailure,
+ Assertions.assertEquals(Boolean.valueOf(propagateInterruptState),
+ Boolean.valueOf(outcome.interruptedAfterFailure),
"propagateInterruptState=" + propagateInterruptState
+ " must decide whether the interrupt flag stays set");
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestPoolExhaustionSqlState.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestPoolExhaustionSqlState.java
index 52d55efb62..19319900f5 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestPoolExhaustionSqlState.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestPoolExhaustionSqlState.java
@@ -66,7 +66,7 @@ class TestPoolExhaustionSqlState extends JdbcPoolBaseTest {
ds.getPoolProperties().setMaxActive(1);
ds.getPoolProperties().setMaxWait(250);
ds.createPool();
- try (Connection held = ds.getConnection()) {
+ try (@SuppressWarnings("unused") Connection held = ds.getConnection())
{
PoolExhaustedException exhausted = Assertions.assertThrows(
PoolExhaustedException.class, ds::getConnection,
"a timing-out borrow on an exhausted pool must fail "
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestRequestBoundaries.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestRequestBoundaries.java
index bb0491867e..6b90028c71 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestRequestBoundaries.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestRequestBoundaries.java
@@ -136,7 +136,7 @@ class TestRequestBoundaries extends JdbcPoolBaseTest {
"the refused hint must not strand the return of the
connection");
// the connection stayed poolable across the refused hints
- try (Connection con = ds.getConnection()) {
+ try (@SuppressWarnings("unused") Connection con = ds.getConnection()) {
Assertions.assertEquals(2, BEGIN_REQUEST_COUNT.get());
}
Assertions.assertEquals(1, poolSessions(),
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestStatementWrapperContract.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestStatementWrapperContract.java
index d7e2cca535..e7c6c9e8c7 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestStatementWrapperContract.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestStatementWrapperContract.java
@@ -74,8 +74,6 @@ class TestStatementWrapperContract extends JdbcPoolBaseTest {
+ handle.getClass().getName());
Assertions.assertTrue(standardInterface.isInstance(handle),
what + ": the handle must implement its standard JDBC
interface");
- Assertions.assertTrue(handle instanceof java.sql.Wrapper,
- what + ": the handle must be a Wrapper, as java.sql.Statement
demands");
// Pinning the exact interface list: the documented contract is the
// standard interface and nothing else. Should the pool ever decide to
// mirror driver interfaces onto its handles, this is the pin that
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingValidator.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingValidator.java
index 110ae933a0..56042eb7de 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingValidator.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestThrowingValidator.java
@@ -247,6 +247,7 @@ class TestThrowingValidator extends JdbcPoolBaseTest {
* next read is answered the replacement - here, none.
*/
private static final class SwapOnSecondRead extends PoolProperties {
+ private static final long serialVersionUID = 1L;
private Validator real;
private int reads;
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestWrapperDelegation.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestWrapperDelegation.java
index 27f0fb78cb..81f1294785 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestWrapperDelegation.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/TestWrapperDelegation.java
@@ -149,7 +149,7 @@ class TestWrapperDelegation extends JdbcPoolBaseTest {
public interface MarkerDataSource extends javax.sql.DataSource {
}
- /** Another marker, claimed by {@link #MarkerDataSource} as a layer. */
+ /** Another marker, claimed by {@link
TestWrapperDelegation.MarkerDataSource} as a layer. */
public interface UnderlyingDataSource {
}
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestQueryReportIdentity.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestQueryReportIdentity.java
index 2fec8c2e3a..416d4021c8 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestQueryReportIdentity.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestQueryReportIdentity.java
@@ -74,6 +74,7 @@ class TestQueryReportIdentity extends JdbcPoolBaseTest {
}
/* The contract of an open statement handle, for one layer. */
+ @SuppressWarnings("unlikely-arg-type") // Use of unlikely arg-type is
deliberate
private static void assertOpenStatementHandle(Statement handle,
Connection pooled, String layer) throws SQLException {
Assertions.assertTrue(handle.equals(handle),
@@ -131,6 +132,7 @@ class TestQueryReportIdentity extends JdbcPoolBaseTest {
}
}
+ @SuppressWarnings("unlikely-arg-type") // Use of unlikely arg-type is
deliberate
@Test
void aClosedQueryReportHandleKeepsAnsweringWithItsOwnIdentity() throws
Exception {
DataSource ds = slowQueryPool();
@@ -265,6 +267,7 @@ class TestQueryReportIdentity extends JdbcPoolBaseTest {
return layer == 0 ? "facade handle" : "interceptor handle";
}
+ @SuppressWarnings("unlikely-arg-type") // Use of unlikely arg-type is
deliberate
@Test
void everyQueryReportInterceptorAnswersTheSameWayAtBothLayers() throws
Exception {
String[] interceptors = { SlowQueryReport.class.getSimpleName(),
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestResetAbandonedTimerCursorOutParameter.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestResetAbandonedTimerCursorOutParameter.java
index 31808fcd66..310fe94f5f 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestResetAbandonedTimerCursorOutParameter.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestResetAbandonedTimerCursorOutParameter.java
@@ -260,6 +260,7 @@ class TestResetAbandonedTimerCursorOutParameter extends
JdbcPoolBaseTest {
return OUT_VALUE;
}
} else if ("unwrap".equals(name)) {
+ @SuppressWarnings("null")
Class<?> iface = (Class<?>) args[0];
if (DriverCursor.class.equals(iface)) {
// A driver's own cursor method hands back its cursor
@@ -271,6 +272,7 @@ class TestResetAbandonedTimerCursorOutParameter extends
JdbcPoolBaseTest {
}
return delegate.unwrap(iface);
} else if ("isWrapperFor".equals(name)) {
+ @SuppressWarnings("null")
Class<?> iface = (Class<?>) args[0];
return Boolean.valueOf(DriverCursor.class.equals(iface) ||
delegate.isWrapperFor(iface));
}
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestResetAbandonedTimerNestedCursor.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestResetAbandonedTimerNestedCursor.java
index 59218a787e..9e9cfd9d1b 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestResetAbandonedTimerNestedCursor.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestResetAbandonedTimerNestedCursor.java
@@ -343,12 +343,14 @@ class TestResetAbandonedTimerNestedCursor extends
JdbcPoolBaseTest {
return nestedCursor();
}
} else if ("unwrap".equals(name)) {
+ @SuppressWarnings("null")
Class<?> iface = (Class<?>) args[0];
if (DriverCursor.class.equals(iface)) {
return nestedCursor();
}
return delegate.unwrap(iface);
} else if ("isWrapperFor".equals(name)) {
+ @SuppressWarnings("null")
Class<?> iface = (Class<?>) args[0];
return Boolean.valueOf(DriverCursor.class.equals(iface) ||
delegate.isWrapperFor(iface));
}
@@ -556,8 +558,8 @@ class TestResetAbandonedTimerNestedCursor extends
JdbcPoolBaseTest {
assertTimerHandleBeneathTheFacade(
(ResultSet) outer.getObject(CURSOR_COLUMN_NAME),
driverNested, "getObject(String)");
assertTimerHandleBeneathTheFacade(
- (ResultSet) outer.getObject(CURSOR_COLUMN, new
HashMap<String, Class<?>>()),
- driverNested, "getObject(int, Map)");
+ (ResultSet) outer.getObject(CURSOR_COLUMN, new
HashMap<>()), driverNested,
+ "getObject(int, Map)");
assertTimerHandleBeneathTheFacade(
outer.getObject(CURSOR_COLUMN, ResultSet.class),
driverNested, "getObject(int, Class)");
}
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestSlowQueryJmxNotifications.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestSlowQueryJmxNotifications.java
index 0379991ab7..aa15dfb641 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestSlowQueryJmxNotifications.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestSlowQueryJmxNotifications.java
@@ -1185,7 +1185,7 @@ class TestSlowQueryJmxNotifications extends
JdbcPoolBaseTest {
"org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx"
+ "(notifyPool=false,threshold=-1)");
ds.createPool();
- try (Connection ignored = ds.getConnection()) {
+ try (@SuppressWarnings("unused") Connection ignored =
ds.getConnection()) {
// the borrow publishes the state
Assertions.assertNotNull(SlowQueryReportJmx.jmxStateFor(ds.getPool()),
"precondition: the borrow must have published the pool's
state");
@@ -1317,7 +1317,7 @@ class TestSlowQueryJmxNotifications extends
JdbcPoolBaseTest {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName oname = new ObjectName("tomcat.jdbc:type="
+ SlowQueryReportJmx.class.getName() + ",name=" + poolName);
- try (Connection con = ds.getConnection()) {
+ try (@SuppressWarnings("unused") Connection con = ds.getConnection()) {
Assertions.assertTrue(server.isRegistered(oname),
"the premise: the borrow published the pool under the
default name");
// The interceptor property is mutable at runtime, so the close is
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestSlowQueryReportSharedStatistics.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestSlowQueryReportSharedStatistics.java
index 75936395df..b6613833ff 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestSlowQueryReportSharedStatistics.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestSlowQueryReportSharedStatistics.java
@@ -129,7 +129,7 @@ public class TestSlowQueryReportSharedStatistics extends
JdbcPoolBaseTest {
Assertions.assertNotNull(qs, "the executed query must be booked, saw "
+ stats.keySet());
Assertions.assertEquals(1, qs.getNrOfInvocations(),
"two report definitions must book the shared statistics once
per execution, not multiply them");
- Assertions.assertEquals(1, compositeValue(qs, "prepareCount"),
+ Assertions.assertEquals(Integer.valueOf(1), compositeValue(qs,
"prepareCount"),
"the single preparation must be booked once, not once per
definition");
ds.close();
@@ -158,7 +158,7 @@ public class TestSlowQueryReportSharedStatistics extends
JdbcPoolBaseTest {
Assertions.assertNotNull(qs, "the executed query must be booked, saw "
+ stats.keySet());
Assertions.assertEquals(2, qs.getNrOfInvocations(),
"the two executions must book two invocations through the
cache, one each");
- Assertions.assertEquals(1, compositeValue(qs, "prepareCount"),
+ Assertions.assertEquals(Integer.valueOf(1), compositeValue(qs,
"prepareCount"),
"the cache must book its single real preparation exactly
once");
ds.close();
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementCacheRacingPark.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementCacheRacingPark.java
index 6865800ac4..5ce37921b1 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementCacheRacingPark.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementCacheRacingPark.java
@@ -303,7 +303,7 @@ class TestStatementCacheRacingPark extends JdbcPoolBaseTest
{
// must have closed it. Pre-fix both closes believed they had
// parked, neither closed its delegate, and the overwritten one
// stayed open with nothing left that could ever reach it.
- Assertions.assertNotEquals(aClosed, bClosed,
+ Assertions.assertNotEquals(Boolean.valueOf(aClosed),
Boolean.valueOf(bClosed),
"exactly one of the two racing statements may stay open: "
+ "the winner of the park, not the loser (pre-fix "
+ "both stayed open and the loser leaked); " +
observed);
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementDecoratorIdentity.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementDecoratorIdentity.java
index 553bcd81d0..77cf176233 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementDecoratorIdentity.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementDecoratorIdentity.java
@@ -74,6 +74,7 @@ class TestStatementDecoratorIdentity extends JdbcPoolBaseTest
{
}
/* The contract of an open statement handle, for one layer. */
+ @SuppressWarnings("unlikely-arg-type") // Use of unlikely arg-type is
deliberate
private static void assertOpenStatementHandle(Statement handle,
Statement other, Connection pooled, String layer) {
Assertions.assertTrue(handle.equals(handle),
@@ -96,6 +97,7 @@ class TestStatementDecoratorIdentity extends JdbcPoolBaseTest
{
}
/* The contract of a closed statement handle, for one layer. */
+ @SuppressWarnings("unlikely-arg-type") // Use of unlikely arg-type is
deliberate
private static void assertClosedStatementHandle(Statement handle,
int hashBeforeClose, Connection pooled, String layer) {
// Neither method declares a checked exception, so a throwing handler
@@ -117,7 +119,6 @@ class TestStatementDecoratorIdentity extends
JdbcPoolBaseTest {
}
}
- @SuppressWarnings("unlikely-arg-type") // Use of unlikely arg-type is
deliberate
@Test
void aStatementHandleIsEqualOnlyToItselfWhileOpen() throws Exception {
DataSource ds = decoratorPool();
@@ -132,7 +133,6 @@ class TestStatementDecoratorIdentity extends
JdbcPoolBaseTest {
}
}
- @SuppressWarnings("unlikely-arg-type") // Use of unlikely arg-type is
deliberate
@Test
void aClosedStatementHandleKeepsAnsweringWithItsOwnIdentity() throws
Exception {
DataSource ds = decoratorPool();
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementFinalizer.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementFinalizer.java
index 0035b15065..66301bc999 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementFinalizer.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestStatementFinalizer.java
@@ -822,6 +822,7 @@ class TestStatementFinalizer extends JdbcPoolBaseTest {
Assertions.assertNotNull(finalizer);
StatementGateInterceptor.holdFirstClose();
+ @SuppressWarnings("unused")
Statement leaked = first.createStatement(); // its return-time close
is the parking post
CountDownLatch createEntered = new CountDownLatch(1);
@@ -888,7 +889,7 @@ class TestStatementFinalizer extends JdbcPoolBaseTest {
"the next borrow must start with an empty tracker");
try (ResultSet rs = ((PreparedStatement) rawLate).executeQuery()) {
Assertions.fail("the statement that raced the return still
executes: "
- + (rs.next() ? rs.getInt(1) : "?"));
+ + (rs.next() ? Integer.valueOf(rs.getInt(1)) : "?"));
} catch (SQLException expected) {
// a closed statement refuses use - the point of the assertion
}
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/jmx/TestJmxNotificationDelivery.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/jmx/TestJmxNotificationDelivery.java
index e00d7f8ad1..331db6d45c 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/jmx/TestJmxNotificationDelivery.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/jmx/TestJmxNotificationDelivery.java
@@ -131,6 +131,7 @@ class TestJmxNotificationDelivery extends JdbcPoolBaseTest {
* thread stalls notify() for that bound and no further.
*/
private static final class StuckFilter implements NotificationFilter {
+ private static final long serialVersionUID = 1L;
private final CountDownLatch entered = new CountDownLatch(1);
private final CountDownLatch release = new CountDownLatch(1);
private final CountDownLatch completed = new CountDownLatch(1);
@@ -579,7 +580,7 @@ class TestJmxNotificationDelivery extends JdbcPoolBaseTest {
Assertions.assertTrue(jmxOne.entered.await(5,
TimeUnit.SECONDS),
"the notifier thread must be stuck on the gate
notification");
for (int i = 0; i < SPLIT_FLOOD_SIZE; i++) {
- accepted.add(jmxPool.notify(ConnectionPool.POOL_EMPTY,
"split-" + i));
+
accepted.add(Boolean.valueOf(jmxPool.notify(ConnectionPool.POOL_EMPTY, "split-"
+ i)));
}
} finally {
gate.countDown();
@@ -638,7 +639,7 @@ class TestJmxNotificationDelivery extends JdbcPoolBaseTest {
Set<String> byLocal = new HashSet<>(messages(local.received));
for (int i = 0; i < accepted.size(); i++) {
String message = "[" + ConnectionPool.POOL_EMPTY + "] split-"
+ i;
- if (accepted.get(i)) {
+ if (accepted.get(i).booleanValue()) {
Assertions.assertTrue(byJmxOne.contains(message),
"the notification reported as sent must reach
every JMX listener: split-" + i
+ " was accepted but the first JMX
listener did not receive it");
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/jmx/TestJmxRegistration.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/jmx/TestJmxRegistration.java
index 2a9b5869ac..0b315a3ca2 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/jmx/TestJmxRegistration.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/jmx/TestJmxRegistration.java
@@ -331,7 +331,7 @@ class TestJmxRegistration extends JdbcPoolBaseTest {
ObjectName connectionName;
ObjectName cacheName;
- try (Connection borrowed = ds.getConnection()) {
+ try (@SuppressWarnings("unused") Connection borrowed =
ds.getConnection()) {
connectionName = connectionMBeanUnder(server, poolOname);
cacheName = new ObjectName(connectionName.toString() +
",JdbcInterceptor=StatementCache");
Assertions.assertTrue(server.isRegistered(cacheName),
@@ -357,7 +357,7 @@ class TestJmxRegistration extends JdbcPoolBaseTest {
ObjectName republishedConnection = connectionMBeanUnder(server,
republishedPool);
Assertions.assertNotNull(republishedConnection,
"a connection released by the deregistration must
republish itself");
- try (Connection borrowed = ds.getConnection()) {
+ try (@SuppressWarnings("unused") Connection borrowed =
ds.getConnection()) {
ObjectName republishedCache = new ObjectName(
republishedConnection.toString() +
",JdbcInterceptor=StatementCache");
Assertions.assertTrue(server.isRegistered(republishedCache),
diff --git
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/util/TestMessageFactory.java
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/util/TestMessageFactory.java
index 9b82ec7cbc..10d6aff6c0 100644
---
a/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/util/TestMessageFactory.java
+++
b/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/util/TestMessageFactory.java
@@ -112,7 +112,7 @@ class TestMessageFactory {
MessageFactory factory = factoryFor(new PatternBundle());
Assertions.assertEquals("no.such.key",
factory.getInternal("no.such.key"));
// The formatted path reuses the same fallback and cannot throw on it.
- Assertions.assertEquals("no.such.key",
factory.getInternal("no.such.key", "x", 1));
+ Assertions.assertEquals("no.such.key",
factory.getInternal("no.such.key", "x", Integer.valueOf(1)));
}
@Test
diff --git a/test/org/apache/catalina/manager/TestManagerWebapp.java
b/test/org/apache/catalina/manager/TestManagerWebapp.java
index 30f12d4e52..47301177a3 100644
--- a/test/org/apache/catalina/manager/TestManagerWebapp.java
+++ b/test/org/apache/catalina/manager/TestManagerWebapp.java
@@ -542,7 +542,7 @@ public class TestManagerWebapp extends TomcatBaseTest {
Assert.assertTrue(appRoot.mkdirs() && appRoot.isDirectory());
addDeleteOnTearDown(appRoot);
- try (TomcatBaseTest.ContainerInjector ignored =
+ try (@SuppressWarnings("unused") TomcatBaseTest.ContainerInjector
ignored =
TomcatBaseTest.ContainerInjector.inject(ctx.getParent(),
c -> c.getPath().equals("/bug57700"),
c -> {
diff --git
a/test/org/apache/catalina/tribes/tipis/TestAbstractReplicatedMap.java
b/test/org/apache/catalina/tribes/tipis/TestAbstractReplicatedMap.java
index ce803b0e53..0b0cdef0a8 100644
--- a/test/org/apache/catalina/tribes/tipis/TestAbstractReplicatedMap.java
+++ b/test/org/apache/catalina/tribes/tipis/TestAbstractReplicatedMap.java
@@ -548,7 +548,7 @@ public class TestAbstractReplicatedMap {
private static final long serialVersionUID = 1L;
- private void writeObject(ObjectOutputStream out) throws IOException {
+ private void writeObject(@SuppressWarnings("unused")
ObjectOutputStream out) throws IOException {
throw new IOException("Cannot be serialized");
}
}
diff --git a/test/org/apache/el/parser/TestAstIdentifier.java
b/test/org/apache/el/parser/TestAstIdentifier.java
index 18f6a3f9e5..d3050247c8 100644
--- a/test/org/apache/el/parser/TestAstIdentifier.java
+++ b/test/org/apache/el/parser/TestAstIdentifier.java
@@ -152,7 +152,7 @@ public class TestAstIdentifier {
// resolve it
ELProcessor processor = new ELProcessor();
ELContext context = processor.getELManager().getELContext();
- ValueExpression ve =
processor.getELManager().getExpressionFactory().createValueExpression(context,
+ ValueExpression ve =
ELManager.getExpressionFactory().createValueExpression(context,
"${Integer}", Object.class);
Assert.assertTrue(ve.isReadOnly(context));
}
@@ -163,7 +163,7 @@ public class TestAstIdentifier {
ELProcessor processor = new ELProcessor();
processor.getELManager().getELContext().getImportHandler().importStatic("java.lang.Integer.MAX_VALUE");
ELContext context = processor.getELManager().getELContext();
- ValueExpression ve =
processor.getELManager().getExpressionFactory().createValueExpression(context,
+ ValueExpression ve =
ELManager.getExpressionFactory().createValueExpression(context,
"${MAX_VALUE}", Object.class);
Assert.assertTrue(ve.isReadOnly(context));
}
@@ -196,7 +196,7 @@ public class TestAstIdentifier {
public void testUnresolvedIsReadOnly() {
ELProcessor processor = new ELProcessor();
ELContext context = processor.getELManager().getELContext();
- ValueExpression ve =
processor.getELManager().getExpressionFactory().createValueExpression(context,
+ ValueExpression ve =
ELManager.getExpressionFactory().createValueExpression(context,
"${unresolvedName}", Object.class);
ve.isReadOnly(context);
}
diff --git a/test/org/apache/el/stream/TestCollectionOperations.java
b/test/org/apache/el/stream/TestCollectionOperations.java
index 1d70f49af6..577417b66f 100644
--- a/test/org/apache/el/stream/TestCollectionOperations.java
+++ b/test/org/apache/el/stream/TestCollectionOperations.java
@@ -510,9 +510,8 @@ public class TestCollectionOperations {
}
- @SuppressWarnings("unchecked")
private static Stream streamOf(Object... elements) {
- return new Stream((java.util.Iterator<Object>)
Arrays.asList(elements).iterator());
+ return new Stream(Arrays.asList(elements).iterator());
}
diff --git a/test/org/apache/tomcat/integration/httpd/TesterHttpd.java
b/test/org/apache/tomcat/integration/httpd/TesterHttpd.java
index 60b0b26e99..95e2f64550 100644
--- a/test/org/apache/tomcat/integration/httpd/TesterHttpd.java
+++ b/test/org/apache/tomcat/integration/httpd/TesterHttpd.java
@@ -145,7 +145,7 @@ public class TesterHttpd {
private boolean isHttpdReady() throws InterruptedException {
long deadline = System.currentTimeMillis() + 1000;
while (System.currentTimeMillis() < deadline) {
- try (Socket ignored = new Socket("localhost", this.httpdPort)) {
+ try (@SuppressWarnings("unused") Socket ignored = new
Socket("localhost", this.httpdPort)) {
return true;
} catch (IOException e) {
Thread.sleep(100);
diff --git
a/test/org/apache/tomcat/util/net/SSLUtilBaseCertificateSelectionTestBase.java
b/test/org/apache/tomcat/util/net/SSLUtilBaseCertificateSelectionTestBase.java
index fd93e092d8..3aaf5edc50 100644
---
a/test/org/apache/tomcat/util/net/SSLUtilBaseCertificateSelectionTestBase.java
+++
b/test/org/apache/tomcat/util/net/SSLUtilBaseCertificateSelectionTestBase.java
@@ -284,7 +284,9 @@ public abstract class
SSLUtilBaseCertificateSelectionTestBase extends TomcatBase
Map<CertType,Integer> used = new EnumMap<>(CertType.class);
for (KeystoreEntry entry : entries) {
List<CertAndKey> options = certificatePool().get(entry.certType());
- CertAndKey chosen = options.get((used.merge(entry.certType(), 1,
Integer::sum) - 1) % options.size());
+ CertAndKey chosen =
+ options.get((used.merge(entry.certType(),
Integer.valueOf(1), Integer::sum).intValue() - 1) %
+ options.size());
if (entry.keyEntry()) {
keystore.setKeyEntry(entry.alias(), chosen.key(),
TesterSupport.JKS_PASS.toCharArray(),
new X509Certificate[] { chosen.certificate() });
@@ -386,10 +388,10 @@ public abstract class
SSLUtilBaseCertificateSelectionTestBase extends TomcatBase
spi.engineLoad(null, null);
EasyMock.expectLastCall().once();
EasyMock.expect(spi.engineAliases()).andStubAnswer(() ->
Collections.enumeration(aliases));
- EasyMock.expect(spi.engineContainsAlias(EasyMock.anyString()))
- .andStubAnswer(() ->
delegate.containsAlias(EasyMock.getCurrentArgument(0)));
- EasyMock.expect(spi.engineIsKeyEntry(EasyMock.anyString()))
- .andStubAnswer(() ->
delegate.isKeyEntry(EasyMock.getCurrentArgument(0)));
+
EasyMock.expect(Boolean.valueOf(spi.engineContainsAlias(EasyMock.anyString())))
+ .andStubAnswer(() ->
Boolean.valueOf(delegate.containsAlias(EasyMock.getCurrentArgument(0))));
+
EasyMock.expect(Boolean.valueOf(spi.engineIsKeyEntry(EasyMock.anyString())))
+ .andStubAnswer(() ->
Boolean.valueOf(delegate.isKeyEntry(EasyMock.getCurrentArgument(0))));
EasyMock.expect(spi.engineGetCertificate(EasyMock.anyString())).andStubAnswer(()
-> {
String alias = EasyMock.getCurrentArgument(0);
return alias.equals(malformedAlias) ? malformed :
delegate.getCertificate(alias);
diff --git a/test/org/apache/tomcat/util/threads/TestInlineExecutorService.java
b/test/org/apache/tomcat/util/threads/TestInlineExecutorService.java
index adb2741c5a..82cf347c7a 100644
--- a/test/org/apache/tomcat/util/threads/TestInlineExecutorService.java
+++ b/test/org/apache/tomcat/util/threads/TestInlineExecutorService.java
@@ -31,6 +31,7 @@ public class TestInlineExecutorService {
*/
@Test
public void testTerminationWaitsForAllRunningTasks() throws Exception {
+ @SuppressWarnings("resource")
InlineExecutorService executor = new InlineExecutorService();
try {
CountDownLatch tasksStarted = new CountDownLatch(2);
@@ -92,6 +93,7 @@ public class TestInlineExecutorService {
*/
@Test
public void testReentrantExecute() throws Exception {
+ @SuppressWarnings("resource")
InlineExecutorService executor = new InlineExecutorService();
try {
executor.execute(() -> executor.execute(() -> {
@@ -112,6 +114,7 @@ public class TestInlineExecutorService {
*/
@Test
public void testAwaitTerminationWakesOnShutdown() throws Exception {
+ @SuppressWarnings("resource")
InlineExecutorService executor = new InlineExecutorService();
try {
CountDownLatch waiterReturned = new CountDownLatch(1);
@@ -145,6 +148,7 @@ public class TestInlineExecutorService {
*/
@Test
public void testRejectAfterShutdown() throws Exception {
+ @SuppressWarnings("resource")
InlineExecutorService executor = new InlineExecutorService();
executor.shutdown();
diff --git a/test/org/apache/tomcat/util/threads/TestThreadPoolExecutor.java
b/test/org/apache/tomcat/util/threads/TestThreadPoolExecutor.java
index 4957f73152..b805f1efdc 100644
--- a/test/org/apache/tomcat/util/threads/TestThreadPoolExecutor.java
+++ b/test/org/apache/tomcat/util/threads/TestThreadPoolExecutor.java
@@ -376,6 +376,7 @@ public class TestThreadPoolExecutor {
ShutdownAfterOfferQueue queue = new ShutdownAfterOfferQueue();
// No core threads so there is no worker to terminate the pool once
the queue has been emptied
+ @SuppressWarnings("resource")
ThreadPoolExecutor pool = new ThreadPoolExecutor(0, 1, 60,
TimeUnit.SECONDS, queue,
Executors.defaultThreadFactory(), new
ThreadPoolExecutor.AbortPolicy());
queue.pool = pool;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]