diff --git a/integration-tests/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java b/integration-tests/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java index b416fc3edf70..a7aec02b83a3 100644 --- a/integration-tests/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java +++ b/integration-tests/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java @@ -158,8 +158,7 @@ void testRollbackRulesOnMethodPreventRollback() throws Exception { try { rb.echoException(new ServletException()); } - catch (ServletException ex) { - + catch (ServletException ignored) { } assertThat(txMan.commits).as("Transaction counts match").isEqualTo(1); } @@ -272,7 +271,7 @@ public void before(Method method, Object[] args, Object target) throws Throwable TransactionInterceptor.currentTransactionStatus(); throw new RuntimeException("Shouldn't have a transaction"); } - catch (NoTransactionException ex) { + catch (NoTransactionException ignored) { // this is Ok } } diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java index b1b196243bf8..3efbc972772c 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java @@ -453,9 +453,9 @@ private ShadowMatch getTargetShadowMatch(Method method, Class targetClass) { ClassUtils.toClassArray(ifcs), targetClass.getClassLoader()); targetMethod = ClassUtils.getMostSpecificMethod(targetMethod, compositeInterface); } - catch (IllegalArgumentException ex) { - // Implemented interfaces probably expose conflicting method signatures... - // Proceed with original target method. + // Implemented interfaces probably expose conflicting method signatures... + // Proceed with original target method. + catch (IllegalArgumentException ignored) { } } } @@ -478,7 +478,7 @@ private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) { try { shadowMatch = pointcutExpression.matchesMethodExecution(methodToMatch); } - catch (ReflectionWorldException ex) { + catch (ReflectionWorldException ignored) { // Failed to introspect target method, probably because it has been loaded // in a special ClassLoader. Let's try the declaring ClassLoader instead... try { @@ -501,7 +501,7 @@ private ShadowMatch getShadowMatch(Method targetMethod, Method originalMethod) { try { shadowMatch = pointcutExpression.matchesMethodExecution(methodToMatch); } - catch (ReflectionWorldException ex) { + catch (ReflectionWorldException ignored) { // Could neither introspect the target class nor the proxy class -> // let's try the original method's declaring class before we give up... try { diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/BeanFactoryAnnotationUtils.java b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/BeanFactoryAnnotationUtils.java index df8ad91c32fa..7387226831a3 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/annotation/BeanFactoryAnnotationUtils.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/annotation/BeanFactoryAnnotationUtils.java @@ -208,8 +208,8 @@ public static boolean isQualifierMatch( } } } - catch (NoSuchBeanDefinitionException ex) { - // Ignore - can't compare qualifiers for a manually registered singleton object + catch (NoSuchBeanDefinitionException ignored) { + // can't compare qualifiers for a manually registered singleton object } } return false; diff --git a/spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java b/spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java index 63951ce330ba..d8dbff7f3289 100644 --- a/spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java +++ b/spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java @@ -523,8 +523,7 @@ private void resolveTypeStringValue(TypedStringValue typedStringValue) { try { typedStringValue.resolveTargetType(this.beanFactory.getBeanClassLoader()); } - catch (ClassNotFoundException ex) { - // ignore + catch (ClassNotFoundException ignored) { } } diff --git a/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java b/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java index b07d8ef7831d..2c698a987ce3 100644 --- a/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java +++ b/spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java @@ -266,8 +266,8 @@ public void afterPropertiesSet() { Method eclMethod = configuration.getClass().getMethod("externalClassLoader", ClassLoader.class); ReflectionUtils.invokeMethod(eclMethod, configuration, this.applicationContext.getClassLoader()); } - catch (NoSuchMethodException ex) { - // Ignore - no Hibernate Validator 5.2+ or similar provider + catch (NoSuchMethodException ignored) { + // no Hibernate Validator 5.2+ or similar provider } } @@ -417,8 +417,8 @@ public T unwrap(@Nullable Class type) { try { return super.unwrap(type); } - catch (ValidationException ex) { - // Ignore - we'll try ValidatorFactory unwrapping next + catch (ValidationException ignored) { + // we'll try ValidatorFactory unwrapping next } } if (this.validatorFactory != null) { diff --git a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java index b99c0c13ccc1..7e54c19129db 100644 --- a/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java +++ b/spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java @@ -233,8 +233,7 @@ void serializableTargetAndAdvice() throws Throwable { try { p2.echo(new IOException()); } - catch (IOException ex) { - + catch (IOException ignored) { } assertThat(cta.getCalls()).isEqualTo(2); } diff --git a/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderClassLoader.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderClassLoader.java index 36bf8512109b..e13b16ee6c17 100644 --- a/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderClassLoader.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderClassLoader.java @@ -84,8 +84,7 @@ protected Class findClass(String name) throws ClassNotFoundException { try (stream) { return stream.readAllBytes(); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } return null; diff --git a/spring-core/src/main/java/org/springframework/cglib/proxy/BridgeMethodResolver.java b/spring-core/src/main/java/org/springframework/cglib/proxy/BridgeMethodResolver.java index 65fcf60600f8..99f42c738e2b 100644 --- a/spring-core/src/main/java/org/springframework/cglib/proxy/BridgeMethodResolver.java +++ b/spring-core/src/main/java/org/springframework/cglib/proxy/BridgeMethodResolver.java @@ -73,7 +73,8 @@ public BridgeMethodResolver(Map declToBridge, ClassLoader classLoader) { } finally { is.close(); } - } catch (IOException ignored) {} + } catch (IOException ignored) { + } } return resolved; } diff --git a/spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java b/spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java index de3e7de1b036..4c6050c8f986 100644 --- a/spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java +++ b/spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java @@ -62,8 +62,8 @@ public static MethodProxy create(Class c1, Class c2, String desc, String name1, try { proxy.init(); } - catch (CodeGenerationException ex) { - // Ignore - to be retried when actually needed later on (possibly not at all) + catch (CodeGenerationException ignored) { + // to be retried when actually needed later on (possibly not at all) } } // SPRING PATCH END diff --git a/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java b/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java index c1228a056979..27725dda9170 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java @@ -438,8 +438,7 @@ private static class KotlinDelegate { return constructor; } } - catch (UnsupportedOperationException ex) { - // ignore + catch (UnsupportedOperationException ignored) { } return null; } diff --git a/spring-core/src/main/java/org/springframework/util/FileCopyUtils.java b/spring-core/src/main/java/org/springframework/util/FileCopyUtils.java index 388ab5e34108..c2c729a25d6d 100644 --- a/spring-core/src/main/java/org/springframework/util/FileCopyUtils.java +++ b/spring-core/src/main/java/org/springframework/util/FileCopyUtils.java @@ -229,8 +229,7 @@ private static void close(Closeable closeable) { try { closeable.close(); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/DefaultStompSession.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/DefaultStompSession.java index 84b549aaa407..5fecbc11e77c 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/DefaultStompSession.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/DefaultStompSession.java @@ -526,8 +526,7 @@ private void resetConnection() { try { conn.close(); } - catch (Throwable ex) { - // ignore + catch (Throwable ignored) { } } } diff --git a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java index 6f04669aa105..f48c0cfc160d 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java @@ -1000,8 +1000,7 @@ private String getHost(String elementNamespace, DataHandler dataHandler) { URI uri = ResourceUtils.toURI(elementNamespace); return uri.getHost(); } - catch (URISyntaxException ex) { - // ignore + catch (URISyntaxException ignored) { } return dataHandler.getName(); } diff --git a/spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/R2dbcTransactionManagerTests.java b/spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/R2dbcTransactionManagerTests.java index b383b633b01b..ab20840c7ff6 100644 --- a/spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/R2dbcTransactionManagerTests.java +++ b/spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/R2dbcTransactionManagerTests.java @@ -710,8 +710,7 @@ public Mono afterCompletion(int status) { try { return Mono.fromRunnable(() -> doAfterCompletion(status)); } - catch (Throwable ex) { - // ignore + catch (Throwable ignored) { } return Mono.empty(); diff --git a/spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java b/spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java index 328068f11167..a5f9e1aeac9f 100644 --- a/spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java +++ b/spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java @@ -100,8 +100,7 @@ public void close() { try { getBody().close(); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java index 35ee7c332658..9203a90a1c39 100644 --- a/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java +++ b/spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java @@ -1129,8 +1129,7 @@ private long parseDateHeader(String name, String value) { try { return simpleDateFormat.parse(value).getTime(); } - catch (ParseException ex) { - // ignore + catch (ParseException ignored) { } } throw new IllegalArgumentException("Cannot parse date value '" + value + "' for '" + name + "' header"); diff --git a/spring-web/src/main/java/org/springframework/http/HttpHeaders.java b/spring-web/src/main/java/org/springframework/http/HttpHeaders.java index ee4d794e0e4c..31426cb4d58e 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpHeaders.java +++ b/spring-web/src/main/java/org/springframework/http/HttpHeaders.java @@ -1223,8 +1223,7 @@ public void setHost(@Nullable InetSocketAddress host) { try { port = Integer.parseInt(portString); } - catch (NumberFormatException ex) { - // ignore + catch (NumberFormatException ignored) { } } diff --git a/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpResponse.java b/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpResponse.java index f7bb0814b837..5e7c3a631274 100644 --- a/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpResponse.java +++ b/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpResponse.java @@ -89,8 +89,7 @@ public void close() { this.httpResponse.close(); } } - catch (IOException ex) { - // Ignore exception on close... + catch (IOException ignored) { } } diff --git a/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpResponse.java b/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpResponse.java index b8bc57f4a264..e7397d39cace 100644 --- a/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpResponse.java +++ b/spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpResponse.java @@ -108,8 +108,7 @@ public void close() { StreamUtils.drain(body); body.close(); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-web/src/main/java/org/springframework/http/client/reactive/HttpComponentsClientHttpResponse.java b/spring-web/src/main/java/org/springframework/http/client/reactive/HttpComponentsClientHttpResponse.java index 98021ce6dd45..0abd5c73cae8 100644 --- a/spring-web/src/main/java/org/springframework/http/client/reactive/HttpComponentsClientHttpResponse.java +++ b/spring-web/src/main/java/org/springframework/http/client/reactive/HttpComponentsClientHttpResponse.java @@ -119,8 +119,7 @@ else if (expiresAttribute != null) { ZonedDateTime expiresDate = ZonedDateTime.parse(expiresAttribute, DateTimeFormatter.RFC_1123_DATE_TIME); return Duration.between(ZonedDateTime.now(expiresDate.getZone()), expiresDate).toSeconds(); } - catch (DateTimeParseException ex) { - // ignore + catch (DateTimeParseException ignored) { } } return -1; diff --git a/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java index 02bb193520e6..d8a0b40fa833 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java @@ -158,20 +158,20 @@ protected void writeContent(Resource resource, HttpOutputMessage outputMessage) in.transferTo(out); out.flush(); } - catch (NullPointerException ex) { - // ignore, see SPR-13620 + catch (NullPointerException ignored) { + // see SPR-13620 } finally { try { in.close(); } - catch (Throwable ex) { - // ignore, see SPR-12999 + catch (Throwable ignored) { + // see SPR-12999 } } } - catch (FileNotFoundException ex) { - // ignore, see SPR-12999 + catch (FileNotFoundException ignored) { + // see SPR-12999 } } diff --git a/spring-web/src/main/java/org/springframework/http/converter/ResourceRegionHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/ResourceRegionHttpMessageConverter.java index 216fdc29361b..d27303f74ead 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/ResourceRegionHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/ResourceRegionHttpMessageConverter.java @@ -183,8 +183,7 @@ protected void writeResourceRegion(ResourceRegion region, HttpOutputMessage outp try { in.close(); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } } @@ -244,8 +243,7 @@ private void writeResourceRegionCollection(Collection resourceRe in.close(); } } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java index be6fa00f99d1..093e13ad7495 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java @@ -270,8 +270,7 @@ private StreamSource readStreamSource(InputStream body) throws IOException { transform(t, new StreamResult(os)); return os.count; } - catch (TransformerException ex) { - // ignore + catch (TransformerException ignored) { } } return null; diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java index 19f82840f30f..dd4148f11c72 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java @@ -439,8 +439,7 @@ public void onNext(AbstractListenerWriteProcessor processor, T data) { // ignore } @Override - public void onError(AbstractListenerWriteProcessor processor, Throwable ex) { - // ignore + public void onError(AbstractListenerWriteProcessor processor, Throwable ignored) { } @Override public void onComplete(AbstractListenerWriteProcessor processor) { diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java b/spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java index 44416259701a..776a56f60df1 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java @@ -309,8 +309,7 @@ private static void delegateTimeout(AsyncListener listener, AsyncEvent event) { try { listener.onTimeout(event); } - catch (Exception ex) { - // Ignore + catch (Exception ignored) { } } @@ -318,8 +317,7 @@ private static void delegateError(AsyncListener listener, AsyncEvent event) { try { listener.onError(event); } - catch (Exception ex) { - // Ignore + catch (Exception ignored) { } } @@ -327,8 +325,7 @@ private static void delegateComplete(AsyncListener listener, AsyncEvent event) { try { listener.onComplete(event); } - catch (Exception ex) { - // Ignore + catch (Exception ignored) { } } diff --git a/spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java b/spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java index bf1077cd88c6..ad482d3aced7 100644 --- a/spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java +++ b/spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java @@ -152,8 +152,7 @@ private static byte[] getResponseBody(ClientHttpResponse response) { try { return FileCopyUtils.copyToByteArray(response.getBody()); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } return new byte[0]; } diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/CallableInterceptorChain.java b/spring-web/src/main/java/org/springframework/web/context/request/async/CallableInterceptorChain.java index a78a9c9d54e2..acf5c84206cf 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/CallableInterceptorChain.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/CallableInterceptorChain.java @@ -113,8 +113,7 @@ private void cancelTask() { try { future.cancel(true); } - catch (Throwable ex) { - // Ignore + catch (Throwable ignored) { } } } diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java b/spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java index cf10f4d2c641..a8e731dbb2fb 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java @@ -235,8 +235,7 @@ private int tryObtainLock() { break; } } - catch (InterruptedException ex) { - // ignore + catch (InterruptedException ignored) { } } diff --git a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextResource.java b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextResource.java index d4aecb9507b6..d8acddc5c7f1 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/ServletContextResource.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/ServletContextResource.java @@ -122,8 +122,7 @@ public boolean isReadable() { try { is.close(); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } return true; } diff --git a/spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceProxyRegistryFactoryBean.java b/spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceProxyRegistryFactoryBean.java index 141bdd6fbd98..91408ee45f1d 100644 --- a/spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceProxyRegistryFactoryBean.java +++ b/spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceProxyRegistryFactoryBean.java @@ -151,8 +151,7 @@ private static void addGroupAdapter( Class clazz = ClassUtils.forName(className, HttpServiceGroupAdapter.class.getClassLoader()); groupAdapters.put(clientType, (HttpServiceGroupAdapter) BeanUtils.instantiateClass(clazz)); } - catch (ClassNotFoundException ex) { - // ignore + catch (ClassNotFoundException ignored) { } } } diff --git a/spring-web/src/test/java/org/springframework/web/context/request/RequestContextListenerTests.java b/spring-web/src/test/java/org/springframework/web/context/request/RequestContextListenerTests.java index b433af80d61a..9972563034d8 100644 --- a/spring-web/src/test/java/org/springframework/web/context/request/RequestContextListenerTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/request/RequestContextListenerTests.java @@ -93,7 +93,7 @@ void requestContextListenerWithDifferentThread() { try { thread.join(); } - catch (InterruptedException ex) { + catch (InterruptedException ignored) { } // Still bound to original thread, but at least completed. assertThat(RequestContextHolder.getRequestAttributes()).isNotNull(); diff --git a/spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/client/MockClientHttpResponse.java b/spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/client/MockClientHttpResponse.java index ae4f6464901d..1287e40b298c 100644 --- a/spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/client/MockClientHttpResponse.java +++ b/spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/client/MockClientHttpResponse.java @@ -100,8 +100,7 @@ public void close() { try { getBody().close(); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletRequest.java b/spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletRequest.java index 837c7c0b942c..42f75d542f53 100644 --- a/spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletRequest.java +++ b/spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletRequest.java @@ -1128,8 +1128,7 @@ private long parseDateHeader(String name, String value) { try { return simpleDateFormat.parse(value).getTime(); } - catch (ParseException ex) { - // ignore + catch (ParseException ignored) { } } throw new IllegalArgumentException("Cannot parse date value '" + value + "' for '" + name + "' header"); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientUtils.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientUtils.java index d311962f756e..dfb07f5bb30a 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientUtils.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientUtils.java @@ -77,8 +77,7 @@ public static String getRequestDescription(HttpMethod httpMethod, URI uri) { try { uri = new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), uri.getPath(), null, null); } - catch (URISyntaxException ex) { - // ignore + catch (URISyntaxException ignored) { } } return httpMethod.name() + " " + uri; diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java index d26c440bc5f6..0423d1c44046 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java @@ -357,8 +357,7 @@ private static Mono> initFormData(ServerHttpReques .cache(); } } - catch (InvalidMediaTypeException ex) { - // Ignore + catch (InvalidMediaTypeException ignored) { } return EMPTY_FORM_DATA; } @@ -379,8 +378,7 @@ private static Mono> initMultipartData(ServerHttpReq .cache(); } } - catch (InvalidMediaTypeException ex) { - // Ignore + catch (InvalidMediaTypeException ignored) { } return EMPTY_MULTIPART_DATA; } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java index 5bbb25678e3e..5fab76c6f988 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java @@ -76,8 +76,7 @@ else if (location instanceof UrlResource) { Assert.isTrue(path.endsWith(FOLDER_SEPARATOR) || path.endsWith(WINDOWS_FOLDER_SEPARATOR), "Resource location does not end with slash: " + path); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java index 91431651f894..22b917b15291 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java @@ -211,8 +211,7 @@ public ProducesRequestCondition combine(ProducesRequestCondition other) { return EMPTY_CONDITION; } } - catch (NotAcceptableStatusException | UnsupportedMediaTypeStatusException ex) { - // Ignore + catch (NotAcceptableStatusException | UnsupportedMediaTypeStatusException ignored) { } } return null; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java index 5a627a8a437c..e6763ad7703a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java @@ -622,8 +622,7 @@ private static CompositeUriComponentsContributor getUriComponentsContributor() { try { return wac.getBean(MVC_URI_COMPONENTS_CONTRIBUTOR_BEAN_NAME, CompositeUriComponentsContributor.class); } - catch (NoSuchBeanDefinitionException ex) { - // Ignore + catch (NoSuchBeanDefinitionException ignored) { } } return defaultUriComponentsContributor; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java index d20d9559ff69..c666792e71d9 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java @@ -788,8 +788,7 @@ private List initViewResolvers() { return getBeanFactory().getBean( DispatcherServlet.LOCALE_RESOLVER_BEAN_NAME, LocaleResolver.class); } - catch (NoSuchBeanDefinitionException ex) { - // ignore + catch (NoSuchBeanDefinitionException ignored) { } } return null; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java index c3bf08e6b683..a6ea5dee5e92 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java @@ -191,8 +191,7 @@ void closeStreamIfNecessary(InputStream body) { try { body.close(); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java index f4f4bda1b299..a5ccc4e73e14 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java @@ -77,8 +77,7 @@ else if (location instanceof UrlResource) { Assert.isTrue(path.endsWith(FOLDER_SEPARATOR) || path.endsWith(WINDOWS_FOLDER_SEPARATOR), "Resource location does not end with slash: " + path); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java index d0cb25855b01..e385da4d1415 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java @@ -611,8 +611,7 @@ static class ResponseStatusTestExceptionResolver { @ExceptionHandler(SocketTimeoutException.class) @ResponseStatus(code = HttpStatus.GATEWAY_TIMEOUT, reason = "gateway.timeout") - public void handleException(SocketTimeoutException ex) { - + public void handleException(SocketTimeoutException ignored) { } } diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/handler/BinaryWebSocketHandler.java b/spring-websocket/src/main/java/org/springframework/web/socket/handler/BinaryWebSocketHandler.java index 730aeb1f76f4..58731ee4bb7a 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/handler/BinaryWebSocketHandler.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/handler/BinaryWebSocketHandler.java @@ -41,8 +41,7 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message) try { session.close(CloseStatus.NOT_ACCEPTABLE.withReason("Text messages not supported")); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/handler/ExceptionWebSocketHandlerDecorator.java b/spring-websocket/src/main/java/org/springframework/web/socket/handler/ExceptionWebSocketHandlerDecorator.java index 96d7a2d697b2..f09fc96b972d 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/handler/ExceptionWebSocketHandlerDecorator.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/handler/ExceptionWebSocketHandlerDecorator.java @@ -93,8 +93,7 @@ public static void tryCloseWithError(WebSocketSession session, Throwable excepti try { session.close(CloseStatus.SERVER_ERROR); } - catch (Throwable ex) { - // ignore + catch (Throwable ignored) { } } } diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/handler/TextWebSocketHandler.java b/spring-websocket/src/main/java/org/springframework/web/socket/handler/TextWebSocketHandler.java index 7060a5ff7de1..09b2115db0bb 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/handler/TextWebSocketHandler.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/handler/TextWebSocketHandler.java @@ -41,8 +41,7 @@ protected void handleBinaryMessage(WebSocketSession session, BinaryMessage messa try { session.close(CloseStatus.NOT_ACCEPTABLE.withReason("Binary messages not supported")); } - catch (IOException ex) { - // ignore + catch (IOException ignored) { } } diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java index e221b66fe728..66d5d83bf0a8 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java @@ -412,8 +412,7 @@ private void sendErrorMessage(WebSocketSession session, Throwable error) { try { session.close(CloseStatus.PROTOCOL_ERROR); } - catch (IOException ex) { - // Ignore + catch (IOException ignored) { } } }