Browse Source

Rename exception variables in empty catch blocks

The Spring codebase sometimes ignores exceptions in catch blocks on
purpose. This is often called out by an inline comment.
We should make this more obvious by renaming the exception argument in
the catch block to declare whether the exception is "ignored" or
"expected".

See gh-35047

Signed-off-by: Vincent Potucek <vpotucek@me.com>
[brian.clozel@broadcom.com: rework commit message]
Signed-off-by: Brian Clozel <brian.clozel@broadcom.com>
pull/35061/head
Vincent Potucek 8 months ago committed by Brian Clozel
parent
commit
0d4dfb6c1f
  1. 5
      integration-tests/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java
  2. 10
      spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java
  3. 4
      spring-beans/src/main/java/org/springframework/beans/factory/annotation/BeanFactoryAnnotationUtils.java
  4. 3
      spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java
  5. 8
      spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java
  6. 3
      spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java
  7. 3
      spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderClassLoader.java
  8. 3
      spring-core/src/main/java/org/springframework/cglib/proxy/BridgeMethodResolver.java
  9. 4
      spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java
  10. 3
      spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java
  11. 3
      spring-core/src/main/java/org/springframework/util/FileCopyUtils.java
  12. 3
      spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/DefaultStompSession.java
  13. 3
      spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java
  14. 3
      spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/R2dbcTransactionManagerTests.java
  15. 3
      spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java
  16. 3
      spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java
  17. 3
      spring-web/src/main/java/org/springframework/http/HttpHeaders.java
  18. 3
      spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpResponse.java
  19. 3
      spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpResponse.java
  20. 3
      spring-web/src/main/java/org/springframework/http/client/reactive/HttpComponentsClientHttpResponse.java
  21. 12
      spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java
  22. 6
      spring-web/src/main/java/org/springframework/http/converter/ResourceRegionHttpMessageConverter.java
  23. 3
      spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java
  24. 3
      spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java
  25. 9
      spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java
  26. 3
      spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java
  27. 3
      spring-web/src/main/java/org/springframework/web/context/request/async/CallableInterceptorChain.java
  28. 3
      spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java
  29. 3
      spring-web/src/main/java/org/springframework/web/context/support/ServletContextResource.java
  30. 3
      spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceProxyRegistryFactoryBean.java
  31. 2
      spring-web/src/test/java/org/springframework/web/context/request/RequestContextListenerTests.java
  32. 3
      spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/client/MockClientHttpResponse.java
  33. 3
      spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletRequest.java
  34. 3
      spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientUtils.java
  35. 6
      spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java
  36. 3
      spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java
  37. 3
      spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java
  38. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java
  39. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java
  40. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java
  41. 3
      spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java
  42. 3
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java
  43. 3
      spring-websocket/src/main/java/org/springframework/web/socket/handler/BinaryWebSocketHandler.java
  44. 3
      spring-websocket/src/main/java/org/springframework/web/socket/handler/ExceptionWebSocketHandlerDecorator.java
  45. 3
      spring-websocket/src/main/java/org/springframework/web/socket/handler/TextWebSocketHandler.java
  46. 3
      spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java

5
integration-tests/src/test/java/org/springframework/aop/framework/autoproxy/AdvisorAutoProxyCreatorIntegrationTests.java

@ -158,8 +158,7 @@ class AdvisorAutoProxyCreatorIntegrationTests { @@ -158,8 +158,7 @@ class AdvisorAutoProxyCreatorIntegrationTests {
try {
rb.echoException(new ServletException());
}
catch (ServletException ex) {
catch (ServletException ignored) {
}
assertThat(txMan.commits).as("Transaction counts match").isEqualTo(1);
}
@ -272,7 +271,7 @@ class OrderedTxCheckAdvisor extends StaticMethodMatcherPointcutAdvisor implement @@ -272,7 +271,7 @@ class OrderedTxCheckAdvisor extends StaticMethodMatcherPointcutAdvisor implement
TransactionInterceptor.currentTransactionStatus();
throw new RuntimeException("Shouldn't have a transaction");
}
catch (NoTransactionException ex) {
catch (NoTransactionException ignored) {
// this is Ok
}
}

10
spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcut.java

@ -453,9 +453,9 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut @@ -453,9 +453,9 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
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 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut @@ -478,7 +478,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
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 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut @@ -501,7 +501,7 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
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 {

4
spring-beans/src/main/java/org/springframework/beans/factory/annotation/BeanFactoryAnnotationUtils.java

@ -208,8 +208,8 @@ public abstract class BeanFactoryAnnotationUtils { @@ -208,8 +208,8 @@ public abstract class BeanFactoryAnnotationUtils {
}
}
}
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;

3
spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java

@ -523,8 +523,7 @@ final class PostProcessorRegistrationDelegate { @@ -523,8 +523,7 @@ final class PostProcessorRegistrationDelegate {
try {
typedStringValue.resolveTargetType(this.beanFactory.getBeanClassLoader());
}
catch (ClassNotFoundException ex) {
// ignore
catch (ClassNotFoundException ignored) {
}
}

8
spring-context/src/main/java/org/springframework/validation/beanvalidation/LocalValidatorFactoryBean.java

@ -266,8 +266,8 @@ public class LocalValidatorFactoryBean extends SpringValidatorAdapter @@ -266,8 +266,8 @@ public class LocalValidatorFactoryBean extends SpringValidatorAdapter
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 class LocalValidatorFactoryBean extends SpringValidatorAdapter @@ -417,8 +417,8 @@ public class LocalValidatorFactoryBean extends SpringValidatorAdapter
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) {

3
spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java

@ -233,8 +233,7 @@ abstract class AbstractAopProxyTests { @@ -233,8 +233,7 @@ abstract class AbstractAopProxyTests {
try {
p2.echo(new IOException());
}
catch (IOException ex) {
catch (IOException ignored) {
}
assertThat(cta.getCalls()).isEqualTo(2);
}

3
spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderClassLoader.java

@ -84,8 +84,7 @@ final class CompileWithForkedClassLoaderClassLoader extends ClassLoader { @@ -84,8 +84,7 @@ final class CompileWithForkedClassLoaderClassLoader extends ClassLoader {
try (stream) {
return stream.readAllBytes();
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}
return null;

3
spring-core/src/main/java/org/springframework/cglib/proxy/BridgeMethodResolver.java

@ -73,7 +73,8 @@ class BridgeMethodResolver { @@ -73,7 +73,8 @@ class BridgeMethodResolver {
} finally {
is.close();
}
} catch (IOException ignored) {}
} catch (IOException ignored) {
}
}
return resolved;
}

4
spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java

@ -62,8 +62,8 @@ public class MethodProxy { @@ -62,8 +62,8 @@ public class MethodProxy {
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

3
spring-core/src/main/java/org/springframework/core/io/support/SpringFactoriesLoader.java

@ -438,8 +438,7 @@ public class SpringFactoriesLoader { @@ -438,8 +438,7 @@ public class SpringFactoriesLoader {
return constructor;
}
}
catch (UnsupportedOperationException ex) {
// ignore
catch (UnsupportedOperationException ignored) {
}
return null;
}

3
spring-core/src/main/java/org/springframework/util/FileCopyUtils.java

@ -229,8 +229,7 @@ public abstract class FileCopyUtils { @@ -229,8 +229,7 @@ public abstract class FileCopyUtils {
try {
closeable.close();
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

3
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/DefaultStompSession.java

@ -526,8 +526,7 @@ public class DefaultStompSession implements ConnectionHandlingStompSession { @@ -526,8 +526,7 @@ public class DefaultStompSession implements ConnectionHandlingStompSession {
try {
conn.close();
}
catch (Throwable ex) {
// ignore
catch (Throwable ignored) {
}
}
}

3
spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java

@ -1000,8 +1000,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi @@ -1000,8 +1000,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
URI uri = ResourceUtils.toURI(elementNamespace);
return uri.getHost();
}
catch (URISyntaxException ex) {
// ignore
catch (URISyntaxException ignored) {
}
return dataHandler.getName();
}

3
spring-r2dbc/src/test/java/org/springframework/r2dbc/connection/R2dbcTransactionManagerTests.java

@ -710,8 +710,7 @@ class R2dbcTransactionManagerTests { @@ -710,8 +710,7 @@ class R2dbcTransactionManagerTests {
try {
return Mono.fromRunnable(() -> doAfterCompletion(status));
}
catch (Throwable ex) {
// ignore
catch (Throwable ignored) {
}
return Mono.empty();

3
spring-test/src/main/java/org/springframework/mock/http/client/MockClientHttpResponse.java

@ -100,8 +100,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie @@ -100,8 +100,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie
try {
getBody().close();
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

3
spring-test/src/main/java/org/springframework/mock/web/MockHttpServletRequest.java

@ -1129,8 +1129,7 @@ public class MockHttpServletRequest implements HttpServletRequest { @@ -1129,8 +1129,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
try {
return simpleDateFormat.parse(value).getTime();
}
catch (ParseException ex) {
// ignore
catch (ParseException ignored) {
}
}
throw new IllegalArgumentException("Cannot parse date value '" + value + "' for '" + name + "' header");

3
spring-web/src/main/java/org/springframework/http/HttpHeaders.java

@ -1223,8 +1223,7 @@ public class HttpHeaders implements Serializable { @@ -1223,8 +1223,7 @@ public class HttpHeaders implements Serializable {
try {
port = Integer.parseInt(portString);
}
catch (NumberFormatException ex) {
// ignore
catch (NumberFormatException ignored) {
}
}

3
spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpResponse.java

@ -89,8 +89,7 @@ final class HttpComponentsClientHttpResponse implements ClientHttpResponse { @@ -89,8 +89,7 @@ final class HttpComponentsClientHttpResponse implements ClientHttpResponse {
this.httpResponse.close();
}
}
catch (IOException ex) {
// Ignore exception on close...
catch (IOException ignored) {
}
}

3
spring-web/src/main/java/org/springframework/http/client/ReactorClientHttpResponse.java

@ -108,8 +108,7 @@ final class ReactorClientHttpResponse implements ClientHttpResponse { @@ -108,8 +108,7 @@ final class ReactorClientHttpResponse implements ClientHttpResponse {
StreamUtils.drain(body);
body.close();
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

3
spring-web/src/main/java/org/springframework/http/client/reactive/HttpComponentsClientHttpResponse.java

@ -119,8 +119,7 @@ class HttpComponentsClientHttpResponse extends AbstractClientHttpResponse { @@ -119,8 +119,7 @@ class HttpComponentsClientHttpResponse extends AbstractClientHttpResponse {
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;

12
spring-web/src/main/java/org/springframework/http/converter/ResourceHttpMessageConverter.java

@ -158,20 +158,20 @@ public class ResourceHttpMessageConverter extends AbstractHttpMessageConverter<R @@ -158,20 +158,20 @@ public class ResourceHttpMessageConverter extends AbstractHttpMessageConverter<R
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
}
}

6
spring-web/src/main/java/org/springframework/http/converter/ResourceRegionHttpMessageConverter.java

@ -183,8 +183,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa @@ -183,8 +183,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa
try {
in.close();
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}
}
@ -244,8 +243,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa @@ -244,8 +243,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa
in.close();
}
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

3
spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java

@ -270,8 +270,7 @@ public class SourceHttpMessageConverter<T extends Source> extends AbstractHttpMe @@ -270,8 +270,7 @@ public class SourceHttpMessageConverter<T extends Source> extends AbstractHttpMe
transform(t, new StreamResult(os));
return os.count;
}
catch (TransformerException ex) {
// ignore
catch (TransformerException ignored) {
}
}
return null;

3
spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java

@ -439,8 +439,7 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T, @@ -439,8 +439,7 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T,
// ignore
}
@Override
public <T> void onError(AbstractListenerWriteProcessor<T> processor, Throwable ex) {
// ignore
public <T> void onError(AbstractListenerWriteProcessor<T> processor, Throwable ignored) {
}
@Override
public <T> void onComplete(AbstractListenerWriteProcessor<T> processor) {

9
spring-web/src/main/java/org/springframework/http/server/reactive/ServletHttpHandlerAdapter.java

@ -309,8 +309,7 @@ public class ServletHttpHandlerAdapter implements Servlet { @@ -309,8 +309,7 @@ public class ServletHttpHandlerAdapter implements Servlet {
try {
listener.onTimeout(event);
}
catch (Exception ex) {
// Ignore
catch (Exception ignored) {
}
}
@ -318,8 +317,7 @@ public class ServletHttpHandlerAdapter implements Servlet { @@ -318,8 +317,7 @@ public class ServletHttpHandlerAdapter implements Servlet {
try {
listener.onError(event);
}
catch (Exception ex) {
// Ignore
catch (Exception ignored) {
}
}
@ -327,8 +325,7 @@ public class ServletHttpHandlerAdapter implements Servlet { @@ -327,8 +325,7 @@ public class ServletHttpHandlerAdapter implements Servlet {
try {
listener.onComplete(event);
}
catch (Exception ex) {
// Ignore
catch (Exception ignored) {
}
}

3
spring-web/src/main/java/org/springframework/web/client/HttpMessageConverterExtractor.java

@ -152,8 +152,7 @@ public class HttpMessageConverterExtractor<T> implements ResponseExtractor<T> { @@ -152,8 +152,7 @@ public class HttpMessageConverterExtractor<T> implements ResponseExtractor<T> {
try {
return FileCopyUtils.copyToByteArray(response.getBody());
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
return new byte[0];
}

3
spring-web/src/main/java/org/springframework/web/context/request/async/CallableInterceptorChain.java

@ -113,8 +113,7 @@ class CallableInterceptorChain { @@ -113,8 +113,7 @@ class CallableInterceptorChain {
try {
future.cancel(true);
}
catch (Throwable ex) {
// Ignore
catch (Throwable ignored) {
}
}
}

3
spring-web/src/main/java/org/springframework/web/context/request/async/StandardServletAsyncWebRequest.java

@ -235,8 +235,7 @@ public class StandardServletAsyncWebRequest extends ServletWebRequest implements @@ -235,8 +235,7 @@ public class StandardServletAsyncWebRequest extends ServletWebRequest implements
break;
}
}
catch (InterruptedException ex) {
// ignore
catch (InterruptedException ignored) {
}
}

3
spring-web/src/main/java/org/springframework/web/context/support/ServletContextResource.java

@ -122,8 +122,7 @@ public class ServletContextResource extends AbstractFileResolvingResource implem @@ -122,8 +122,7 @@ public class ServletContextResource extends AbstractFileResolvingResource implem
try {
is.close();
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
return true;
}

3
spring-web/src/main/java/org/springframework/web/service/registry/HttpServiceProxyRegistryFactoryBean.java

@ -151,8 +151,7 @@ public final class HttpServiceProxyRegistryFactoryBean @@ -151,8 +151,7 @@ public final class HttpServiceProxyRegistryFactoryBean
Class<?> clazz = ClassUtils.forName(className, HttpServiceGroupAdapter.class.getClassLoader());
groupAdapters.put(clientType, (HttpServiceGroupAdapter<?>) BeanUtils.instantiateClass(clazz));
}
catch (ClassNotFoundException ex) {
// ignore
catch (ClassNotFoundException ignored) {
}
}
}

2
spring-web/src/test/java/org/springframework/web/context/request/RequestContextListenerTests.java

@ -93,7 +93,7 @@ class RequestContextListenerTests { @@ -93,7 +93,7 @@ class RequestContextListenerTests {
try {
thread.join();
}
catch (InterruptedException ex) {
catch (InterruptedException ignored) {
}
// Still bound to original thread, but at least completed.
assertThat(RequestContextHolder.getRequestAttributes()).isNotNull();

3
spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/client/MockClientHttpResponse.java

@ -100,8 +100,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie @@ -100,8 +100,7 @@ public class MockClientHttpResponse extends MockHttpInputMessage implements Clie
try {
getBody().close();
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

3
spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletRequest.java

@ -1128,8 +1128,7 @@ public class MockHttpServletRequest implements HttpServletRequest { @@ -1128,8 +1128,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
try {
return simpleDateFormat.parse(value).getTime();
}
catch (ParseException ex) {
// ignore
catch (ParseException ignored) {
}
}
throw new IllegalArgumentException("Cannot parse date value '" + value + "' for '" + name + "' header");

3
spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientUtils.java

@ -77,8 +77,7 @@ abstract class WebClientUtils { @@ -77,8 +77,7 @@ abstract class WebClientUtils {
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;

6
spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java

@ -357,8 +357,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder { @@ -357,8 +357,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
.cache();
}
}
catch (InvalidMediaTypeException ex) {
// Ignore
catch (InvalidMediaTypeException ignored) {
}
return EMPTY_FORM_DATA;
}
@ -379,8 +378,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder { @@ -379,8 +378,7 @@ class DefaultServerRequestBuilder implements ServerRequest.Builder {
.cache();
}
}
catch (InvalidMediaTypeException ex) {
// Ignore
catch (InvalidMediaTypeException ignored) {
}
return EMPTY_MULTIPART_DATA;
}

3
spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceHandlerUtils.java

@ -76,8 +76,7 @@ public abstract class ResourceHandlerUtils { @@ -76,8 +76,7 @@ public abstract class ResourceHandlerUtils {
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) {
}
}

3
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java

@ -211,8 +211,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro @@ -211,8 +211,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
return EMPTY_CONDITION;
}
}
catch (NotAcceptableStatusException | UnsupportedMediaTypeStatusException ex) {
// Ignore
catch (NotAcceptableStatusException | UnsupportedMediaTypeStatusException ignored) {
}
}
return null;

3
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java

@ -622,8 +622,7 @@ public class MvcUriComponentsBuilder { @@ -622,8 +622,7 @@ public class MvcUriComponentsBuilder {
try {
return wac.getBean(MVC_URI_COMPONENTS_CONTRIBUTOR_BEAN_NAME, CompositeUriComponentsContributor.class);
}
catch (NoSuchBeanDefinitionException ex) {
// Ignore
catch (NoSuchBeanDefinitionException ignored) {
}
}
return defaultUriComponentsContributor;

3
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java

@ -788,8 +788,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter @@ -788,8 +788,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
return getBeanFactory().getBean(
DispatcherServlet.LOCALE_RESOLVER_BEAN_NAME, LocaleResolver.class);
}
catch (NoSuchBeanDefinitionException ex) {
// ignore
catch (NoSuchBeanDefinitionException ignored) {
}
}
return null;

3
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java

@ -191,8 +191,7 @@ public class RequestPartMethodArgumentResolver extends AbstractMessageConverterM @@ -191,8 +191,7 @@ public class RequestPartMethodArgumentResolver extends AbstractMessageConverterM
try {
body.close();
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

3
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHandlerUtils.java

@ -77,8 +77,7 @@ public abstract class ResourceHandlerUtils { @@ -77,8 +77,7 @@ public abstract class ResourceHandlerUtils {
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) {
}
}

3
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolverTests.java

@ -611,8 +611,7 @@ class ExceptionHandlerExceptionResolverTests { @@ -611,8 +611,7 @@ class ExceptionHandlerExceptionResolverTests {
@ExceptionHandler(SocketTimeoutException.class)
@ResponseStatus(code = HttpStatus.GATEWAY_TIMEOUT, reason = "gateway.timeout")
public void handleException(SocketTimeoutException ex) {
public void handleException(SocketTimeoutException ignored) {
}
}

3
spring-websocket/src/main/java/org/springframework/web/socket/handler/BinaryWebSocketHandler.java

@ -41,8 +41,7 @@ public class BinaryWebSocketHandler extends AbstractWebSocketHandler { @@ -41,8 +41,7 @@ public class BinaryWebSocketHandler extends AbstractWebSocketHandler {
try {
session.close(CloseStatus.NOT_ACCEPTABLE.withReason("Text messages not supported"));
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

3
spring-websocket/src/main/java/org/springframework/web/socket/handler/ExceptionWebSocketHandlerDecorator.java

@ -93,8 +93,7 @@ public class ExceptionWebSocketHandlerDecorator extends WebSocketHandlerDecorato @@ -93,8 +93,7 @@ public class ExceptionWebSocketHandlerDecorator extends WebSocketHandlerDecorato
try {
session.close(CloseStatus.SERVER_ERROR);
}
catch (Throwable ex) {
// ignore
catch (Throwable ignored) {
}
}
}

3
spring-websocket/src/main/java/org/springframework/web/socket/handler/TextWebSocketHandler.java

@ -41,8 +41,7 @@ public class TextWebSocketHandler extends AbstractWebSocketHandler { @@ -41,8 +41,7 @@ public class TextWebSocketHandler extends AbstractWebSocketHandler {
try {
session.close(CloseStatus.NOT_ACCEPTABLE.withReason("Binary messages not supported"));
}
catch (IOException ex) {
// ignore
catch (IOException ignored) {
}
}

3
spring-websocket/src/main/java/org/springframework/web/socket/messaging/StompSubProtocolHandler.java

@ -412,8 +412,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE @@ -412,8 +412,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
try {
session.close(CloseStatus.PROTOCOL_ERROR);
}
catch (IOException ex) {
// Ignore
catch (IOException ignored) {
}
}
}

Loading…
Cancel
Save