Skip to content

Commit ee45fd2

Browse files
committed
Remove redundant throws declarations from internal APIs
Closes spring-projectsgh-31176
1 parent cbf42de commit ee45fd2

File tree

69 files changed

+157
-193
lines changed

Some content is hidden

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

69 files changed

+157
-193
lines changed

buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.boot.build.classpath;
1818

19-
import java.io.IOException;
2019
import java.util.TreeSet;
2120
import java.util.stream.Collectors;
2221

@@ -52,7 +51,7 @@ public FileCollection getClasspath() {
5251
}
5352

5453
@TaskAction
55-
public void checkForProhibitedDependencies() throws IOException {
54+
public void checkForProhibitedDependencies() {
5655
TreeSet<String> prohibited = this.classpath.getResolvedConfiguration().getResolvedArtifacts().stream()
5756
.map((artifact) -> artifact.getModuleVersion().getId()).filter(this::prohibited)
5857
.map((id) -> id.getGroup() + ":" + id.getName()).collect(Collectors.toCollection(TreeSet::new));

buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenExec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class MavenExec extends JavaExec {
4343

4444
private File projectDir;
4545

46-
public MavenExec() throws IOException {
46+
public MavenExec() {
4747
setClasspath(mavenConfiguration(getProject()));
4848
args("--batch-mode");
4949
setMain("org.apache.maven.cli.MavenCli");

buildSrc/src/test/java/org/springframework/boot/build/bom/BomPluginIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class BomPluginIntegrationTests {
4545
private File buildFile;
4646

4747
@BeforeEach
48-
void setup(@TempDir File projectDir) throws IOException {
48+
void setup(@TempDir File projectDir) {
4949
this.projectDir = projectDir;
5050
this.buildFile = new File(this.projectDir, "build.gradle");
5151
}

buildSrc/src/test/java/org/springframework/boot/build/optional/OptionalDependenciesPluginIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class OptionalDependenciesPluginIntegrationTests {
4141
private File buildFile;
4242

4343
@BeforeEach
44-
void setup(@TempDir File projectDir) throws IOException {
44+
void setup(@TempDir File projectDir) {
4545
this.projectDir = projectDir;
4646
this.buildFile = new File(this.projectDir, "build.gradle");
4747
}

buildSrc/src/test/java/org/springframework/boot/build/testing/TestFailuresPluginIntegrationTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ class TestFailuresPluginIntegrationTests {
4444
private File projectDir;
4545

4646
@BeforeEach
47-
void setup(@TempDir File projectDir) throws IOException {
47+
void setup(@TempDir File projectDir) {
4848
this.projectDir = projectDir;
4949
}
5050

5151
@Test
52-
void singleProject() throws IOException {
52+
void singleProject() {
5353
createProject(this.projectDir);
5454
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
5555
.withArguments("build").withPluginClasspath().buildAndFail();
@@ -59,7 +59,7 @@ void singleProject() throws IOException {
5959
}
6060

6161
@Test
62-
void multiProject() throws IOException {
62+
void multiProject() {
6363
createMultiProjectBuild();
6464
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
6565
.withArguments("build").withPluginClasspath().buildAndFail();
@@ -69,7 +69,7 @@ void multiProject() throws IOException {
6969
}
7070

7171
@Test
72-
void multiProjectContinue() throws IOException {
72+
void multiProjectContinue() {
7373
createMultiProjectBuild();
7474
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
7575
.withArguments("build", "--continue").withPluginClasspath().buildAndFail();
@@ -81,7 +81,7 @@ void multiProjectContinue() throws IOException {
8181
}
8282

8383
@Test
84-
void multiProjectParallel() throws IOException {
84+
void multiProjectParallel() {
8585
createMultiProjectBuild();
8686
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
8787
.withArguments("build", "--parallel", "--stacktrace").withPluginClasspath().buildAndFail();

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
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-2022 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.
@@ -53,14 +53,14 @@ public AuditListener auditListener(AuditEventRepository auditEventRepository) {
5353
@Bean
5454
@ConditionalOnClass(name = "org.springframework.security.authentication.event.AbstractAuthenticationEvent")
5555
@ConditionalOnMissingBean(AbstractAuthenticationAuditListener.class)
56-
public AuthenticationAuditListener authenticationAuditListener() throws Exception {
56+
public AuthenticationAuditListener authenticationAuditListener() {
5757
return new AuthenticationAuditListener();
5858
}
5959

6060
@Bean
6161
@ConditionalOnClass(name = "org.springframework.security.access.event.AbstractAuthorizationEvent")
6262
@ConditionalOnMissingBean(AbstractAuthorizationAuditListener.class)
63-
public AuthorizationAuditListener authorizationAuditListener() throws Exception {
63+
public AuthorizationAuditListener authorizationAuditListener() {
6464
return new AuthorizationAuditListener();
6565
}
6666

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,21 +240,16 @@ private Response convertToJaxRsResponse(Object response, String httpMethod) {
240240
Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT;
241241
return Response.status(status).build();
242242
}
243-
try {
244-
if (!(response instanceof WebEndpointResponse)) {
245-
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
246-
}
247-
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
248-
return Response.status(webEndpointResponse.getStatus())
249-
.header("Content-Type", webEndpointResponse.getContentType())
250-
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
251-
}
252-
catch (IOException ex) {
253-
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
243+
if (!(response instanceof WebEndpointResponse)) {
244+
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
254245
}
246+
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
247+
return Response.status(webEndpointResponse.getStatus())
248+
.header("Content-Type", webEndpointResponse.getContentType())
249+
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
255250
}
256251

257-
private Object convertIfNecessary(Object body) throws IOException {
252+
private Object convertIfNecessary(Object body) {
258253
for (Function<Object, Object> converter : BODY_CONVERTERS) {
259254
body = converter.apply(body);
260255
}

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 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.
@@ -249,7 +249,7 @@ void hikariDataSourceConfigurationPropertiesBeanCanBeSerialized() {
249249

250250
@Test
251251
@SuppressWarnings("unchecked")
252-
void endpointResponseUsesToStringOfCharSequenceAsPropertyValue() throws IOException {
252+
void endpointResponseUsesToStringOfCharSequenceAsPropertyValue() {
253253
ApplicationContextRunner contextRunner = new ApplicationContextRunner().withInitializer((context) -> {
254254
ConfigurableEnvironment environment = context.getEnvironment();
255255
environment.getPropertySources().addFirst(new MapPropertySource("test",
@@ -267,7 +267,7 @@ void endpointResponseUsesToStringOfCharSequenceAsPropertyValue() throws IOExcept
267267

268268
@Test
269269
@SuppressWarnings("unchecked")
270-
void endpointResponseUsesPlaceholderForComplexValueAsPropertyValue() throws IOException {
270+
void endpointResponseUsesPlaceholderForComplexValueAsPropertyValue() {
271271
ApplicationContextRunner contextRunner = new ApplicationContextRunner().withInitializer((context) -> {
272272
ConfigurableEnvironment environment = context.getEnvironment();
273273
environment.getPropertySources().addFirst(new MapPropertySource("test",

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

Lines changed: 3 additions & 5 deletions
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-2022 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.
@@ -16,8 +16,6 @@
1616

1717
package org.springframework.boot.autoconfigure.cache;
1818

19-
import java.io.IOException;
20-
2119
import com.hazelcast.core.HazelcastInstance;
2220
import com.hazelcast.spring.cache.HazelcastCacheManager;
2321

@@ -50,8 +48,8 @@
5048
class HazelcastCacheConfiguration {
5149

5250
@Bean
53-
HazelcastCacheManager cacheManager(CacheManagerCustomizers customizers, HazelcastInstance existingHazelcastInstance)
54-
throws IOException {
51+
HazelcastCacheManager cacheManager(CacheManagerCustomizers customizers,
52+
HazelcastInstance existingHazelcastInstance) {
5553
HazelcastCacheManager cacheManager = new HazelcastCacheManager(existingHazelcastInstance);
5654
return customizers.customize(cacheManager);
5755
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.java

Lines changed: 3 additions & 3 deletions
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-2022 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.
@@ -65,8 +65,8 @@ org.apache.activemq.artemis.core.config.Configuration artemisConfiguration() {
6565
@Bean(initMethod = "start", destroyMethod = "stop")
6666
@ConditionalOnMissingBean
6767
EmbeddedActiveMQ embeddedActiveMq(org.apache.activemq.artemis.core.config.Configuration configuration,
68-
JMSConfiguration jmsConfiguration, ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers)
69-
throws Exception {
68+
JMSConfiguration jmsConfiguration,
69+
ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers) {
7070
for (JMSQueueConfiguration queueConfiguration : jmsConfiguration.getQueueConfigurations()) {
7171
String queueName = queueConfiguration.getName();
7272
configuration.addAddressConfiguration(

0 commit comments

Comments
 (0)