Skip to content

Commit 8ffcfc9

Browse files
committed
Harmonize style of igored exceptions across the codebase
1 parent 831a98c commit 8ffcfc9

File tree

51 files changed

+116
-55
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+116
-55
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementWebServerFactoryCustomizer.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -81,6 +81,7 @@ private void customizeSameAsParentContext(T factory) {
8181
customizers.add(BeanFactoryUtils.beanOfTypeIncludingAncestors(this.beanFactory, customizerClass));
8282
}
8383
catch (NoSuchBeanDefinitionException ex) {
84+
// Ignore
8485
}
8586
}
8687
invokeCustomizers(factory, customizers);

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvoker.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -110,6 +110,7 @@ private void cleanExpiredCachedResponses(long accessTime) {
110110
this.cachedResponses.entrySet().removeIf((entry) -> entry.getValue().isStale(accessTime, this.timeToLive));
111111
}
112112
catch (Exception ex) {
113+
// Ignore
113114
}
114115
}
115116

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthEndpointTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -79,6 +79,7 @@ void healthWhenIndicatorIsSlow(CapturedOutput output) {
7979
Thread.sleep(100);
8080
}
8181
catch (InterruptedException ex) {
82+
// Ignore
8283
}
8384
return this.up;
8485
};

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/SharedMetadataReaderFactoryContextInitializer.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -124,6 +124,7 @@ private void configureConfigurationClassPostProcessor(BeanDefinitionRegistry reg
124124
registry.getBeanDefinition(AnnotationConfigUtils.CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME));
125125
}
126126
catch (NoSuchBeanDefinitionException ex) {
127+
// Ignore
127128
}
128129
}
129130

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,6 +56,7 @@ public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeM
5656
}
5757
}
5858
catch (BindException ex) {
59+
// Ignore
5960
}
6061
return ConditionOutcome.noMatch(message.because("unknown cache type"));
6162
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -500,6 +500,7 @@ private Set<Class<?>> resolveWhenPossible(Set<String> classNames) {
500500
resolved.add(resolve(className, this.classLoader));
501501
}
502502
catch (ClassNotFoundException | NoClassDefFoundError ex) {
503+
// Ignore
503504
}
504505
}
505506
return resolved;

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizer.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -164,6 +164,7 @@ private abstract static class AbstractOptions {
164164
lookup.put(getCanonicalName(field.getName()), option);
165165
}
166166
catch (IllegalAccessException ex) {
167+
// Ignore
167168
}
168169
}
169170
});

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -514,6 +514,7 @@ private Resource getIndexHtmlResource(Resource location) {
514514
}
515515
}
516516
catch (Exception ex) {
517+
// Ignore
517518
}
518519
return null;
519520
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/DefaultErrorViewResolver.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -126,6 +126,7 @@ private ModelAndView resolveResource(String viewName, Map<String, Object> model)
126126
}
127127
}
128128
catch (Exception ex) {
129+
// Ignore
129130
}
130131
}
131132
return null;

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -584,6 +584,7 @@ public Object postProcessAfterInitialization(Object bean, String beanName) throw
584584
jobRegistry.register(getJobFactory());
585585
}
586586
catch (DuplicateJobException ex) {
587+
// Ignore
587588
}
588589
}
589590
return bean;

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -106,6 +106,7 @@ void filterIsRegisteredWithAsyncErrorAndRequestDispatcherTypes() {
106106
delegatingFilterProxy.doFilter(null, null, null);
107107
}
108108
catch (Exception ex) {
109+
// Ignore
109110
}
110111
assertThat(delegatingFilterProxy).extracting("delegate")
111112
.isSameAs(context.getBean(SessionRepositoryFilter.class));

spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/lifecycle/TcpConnectServiceReadinessCheck.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -72,6 +72,7 @@ private void check(RunningService service, int port, Socket socket) throws IOExc
7272
}
7373
}
7474
catch (SocketTimeoutException ex) {
75+
// Ignore
7576
}
7677
}
7778

spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTypeExcludeFilter.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@ public final class JsonTypeExcludeFilter extends StandardAnnotationCustomizableT
4343
includes.add(ClassUtils.forName(JACKSON_MODULE, null));
4444
}
4545
catch (Exception ex) {
46+
// Ignore
4647
}
4748
includes.add(JsonComponent.class);
4849
DEFAULT_INCLUDES = Collections.unmodifiableSet(includes);

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -205,6 +205,7 @@ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) t
205205
registry.removeBeanDefinition(ImportsConfiguration.BEAN_NAME);
206206
}
207207
catch (NoSuchBeanDefinitionException ex) {
208+
// Ignore
208209
}
209210
}
210211

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java

+2
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ private Method getMainMethod(MergedContextConfiguration mergedConfig, UseMainMet
167167
mainMethod = ReflectionUtils.findMethod(kotlinClass, "main", String[].class);
168168
}
169169
catch (ClassNotFoundException ex) {
170+
// Ignore
170171
}
171172
}
172173
Assert.state(mainMethod != null || useMainMethod == UseMainMethod.WHEN_AVAILABLE,
@@ -548,6 +549,7 @@ private ApplicationContext run(ThrowingSupplier<ConfigurableApplicationContext>
548549
}
549550
}
550551
catch (AbandonedRunException ex) {
552+
// Ignore
551553
}
552554
catch (Exception ex) {
553555
if (this.failedContexts.size() == 1) {

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -203,6 +203,7 @@ public ApplicationContextAssert<C> doesNotHaveBean(String name) {
203203
getApplicationContext(), name, bean));
204204
}
205205
catch (NoSuchBeanDefinitionException ex) {
206+
// Ignore
206207
}
207208
return this;
208209
}

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -316,6 +316,7 @@ private void closeQuietly(Closeable closeable) {
316316
closeable.close();
317317
}
318318
catch (IOException ex) {
319+
// Ignore
319320
}
320321
}
321322

spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -1095,6 +1095,7 @@ void assertDoesNotHavePath() {
10951095
failWithMessage("Expecting no JSON path \"%s\"", this.expression);
10961096
}
10971097
catch (PathNotFoundException ex) {
1098+
// Ignore
10981099
}
10991100
}
11001101

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/lifecycle/TestcontainersLifecycleBeanFactoryPostProcessor.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,6 +50,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
5050
}
5151
}
5252
catch (NoSuchBeanDefinitionException ex) {
53+
// Ignore
5354
}
5455
}
5556
}

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ContainerConnectionDetailsFactory.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -93,6 +93,7 @@ public final D getConnectionDetails(ContainerConnectionSource<C> source) {
9393
}
9494
}
9595
catch (NoClassDefFoundError ex) {
96+
// Ignore
9697
}
9798
return null;
9899
}

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PrivateKeyParser.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -203,6 +203,7 @@ private PrivateKey parse(byte[] bytes) {
203203
return keyFactory.generatePrivate(keySpec);
204204
}
205205
catch (InvalidKeySpecException | NoSuchAlgorithmException ex) {
206+
// Ignore
206207
}
207208
}
208209
return null;

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/TotalProgressListenerTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -78,6 +78,7 @@ public void onUpdate(TestImageUpdateEvent event) {
7878
Thread.sleep(10);
7979
}
8080
catch (InterruptedException ex) {
81+
// Ignore
8182
}
8283
}
8384

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSON.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2010 The Android Open Source Project
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,8 @@ static Double toDouble(Object value) {
5151
try {
5252
return Double.valueOf((String) value);
5353
}
54-
catch (NumberFormatException ignored) {
54+
catch (NumberFormatException ex) {
55+
// Ignore
5556
}
5657
}
5758
return null;
@@ -68,7 +69,8 @@ static Integer toInteger(Object value) {
6869
try {
6970
return (int) Double.parseDouble((String) value);
7071
}
71-
catch (NumberFormatException ignored) {
72+
catch (NumberFormatException ex) {
73+
// Ignore
7274
}
7375
}
7476
return null;
@@ -85,7 +87,8 @@ static Long toLong(Object value) {
8587
try {
8688
return (long) Double.parseDouble((String) value);
8789
}
88-
catch (NumberFormatException ignored) {
90+
catch (NumberFormatException ex) {
91+
// Ignore
8992
}
9093
}
9194
return null;

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2010 The Android Open Source Project
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -827,7 +827,8 @@ else if (o.getClass().isArray()) {
827827
return o.toString();
828828
}
829829
}
830-
catch (Exception ignored) {
830+
catch (Exception ex) {
831+
// Ignore
831832
}
832833
return null;
833834
}

0 commit comments

Comments
 (0)