Browse Source

Remove redundant throws declarations from internal APIs

Closes gh-31176
pull/31224/head
Andy Wilkinson 4 years ago
parent
commit
ee45fd2fc8
  1. 3
      buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java
  2. 2
      buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenExec.java
  3. 2
      buildSrc/src/test/java/org/springframework/boot/build/bom/BomPluginIntegrationTests.java
  4. 2
      buildSrc/src/test/java/org/springframework/boot/build/optional/OptionalDependenciesPluginIntegrationTests.java
  5. 10
      buildSrc/src/test/java/org/springframework/boot/build/testing/TestFailuresPluginIntegrationTests.java
  6. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfiguration.java
  7. 19
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java
  8. 6
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java
  9. 8
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java
  10. 6
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.java
  11. 4
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java
  12. 4
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java
  13. 5
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/Jetty10WebSocketServletWebServerCustomizer.java
  14. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceScriptDatabaseInitializerTests.java
  15. 9
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java
  16. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java
  17. 8
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java
  18. 5
      spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/MavenResolverGrapeEngine.java
  19. 5
      spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java
  20. 4
      spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java
  21. 12
      spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java
  22. 2
      spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServerTests.java
  23. 2
      spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java
  24. 4
      spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredrestclient/MyRestClientTests.java
  25. 4
      spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredspringdatajpa/withoutdb/MyRepositoryTests.java
  26. 4
      spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredwebservices/server/ExampleEndpoint.java
  27. 5
      spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/jmx/MyJmxTests.java
  28. 4
      spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/springwebfluxtests/MyControllerTests.java
  29. 4
      spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/utilities/testresttemplate/MyTests.java
  30. 4
      spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestExecutionListener.java
  31. 4
      spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java
  32. 2
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java
  33. 4
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java
  34. 2
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java
  35. 2
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java
  36. 2
      spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithJdkProxyTests.java
  37. 12
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java
  38. 6
      spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/FilePermissionsTests.java
  39. 4
      spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java
  40. 17
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java
  41. 4
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java
  42. 5
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java
  43. 8
      spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java
  44. 4
      spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java
  45. 5
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java
  46. 5
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java
  47. 4
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java
  48. 6
      spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java
  49. 5
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java
  50. 2
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java
  51. 4
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java
  52. 4
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/DurationToStringConverterTests.java
  53. 4
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/PeriodToStringConverterTests.java
  54. 6
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java
  55. 3
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java
  56. 8
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java
  57. 10
      spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java
  58. 4
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/ChatService.java
  59. 4
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/SampleAtmosphereApplication.java
  60. 6
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-batch/src/main/java/smoketest/batch/SampleBatchApplication.java
  61. 4
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/main/java/smoketest/parent/SampleParentContextApplication.java
  62. 4
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/SampleIntegrationParentApplicationTests.java
  63. 6
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/CorsSampleActuatorApplicationTests.java
  64. 4
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-method-security/src/main/java/smoketest/security/method/SampleMethodSecurityApplication.java
  65. 9
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java
  66. 2
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/snake/SnakeTimer.java
  67. 4
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty10/src/main/java/smoketest/websocket/jetty10/snake/SnakeTimer.java
  68. 2
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/snake/SnakeTimer.java
  69. 2
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/snake/SnakeTimer.java

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

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.boot.build.classpath;
import java.io.IOException;
import java.util.TreeSet;
import java.util.stream.Collectors;
@ -52,7 +51,7 @@ public class CheckClasspathForProhibitedDependencies extends DefaultTask { @@ -52,7 +51,7 @@ public class CheckClasspathForProhibitedDependencies extends DefaultTask {
}
@TaskAction
public void checkForProhibitedDependencies() throws IOException {
public void checkForProhibitedDependencies() {
TreeSet<String> prohibited = this.classpath.getResolvedConfiguration().getResolvedArtifacts().stream()
.map((artifact) -> artifact.getModuleVersion().getId()).filter(this::prohibited)
.map((id) -> id.getGroup() + ":" + id.getName()).collect(Collectors.toCollection(TreeSet::new));

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

@ -43,7 +43,7 @@ public class MavenExec extends JavaExec { @@ -43,7 +43,7 @@ public class MavenExec extends JavaExec {
private File projectDir;
public MavenExec() throws IOException {
public MavenExec() {
setClasspath(mavenConfiguration(getProject()));
args("--batch-mode");
setMain("org.apache.maven.cli.MavenCli");

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

@ -45,7 +45,7 @@ class BomPluginIntegrationTests { @@ -45,7 +45,7 @@ class BomPluginIntegrationTests {
private File buildFile;
@BeforeEach
void setup(@TempDir File projectDir) throws IOException {
void setup(@TempDir File projectDir) {
this.projectDir = projectDir;
this.buildFile = new File(this.projectDir, "build.gradle");
}

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

@ -41,7 +41,7 @@ class OptionalDependenciesPluginIntegrationTests { @@ -41,7 +41,7 @@ class OptionalDependenciesPluginIntegrationTests {
private File buildFile;
@BeforeEach
void setup(@TempDir File projectDir) throws IOException {
void setup(@TempDir File projectDir) {
this.projectDir = projectDir;
this.buildFile = new File(this.projectDir, "build.gradle");
}

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

@ -44,12 +44,12 @@ class TestFailuresPluginIntegrationTests { @@ -44,12 +44,12 @@ class TestFailuresPluginIntegrationTests {
private File projectDir;
@BeforeEach
void setup(@TempDir File projectDir) throws IOException {
void setup(@TempDir File projectDir) {
this.projectDir = projectDir;
}
@Test
void singleProject() throws IOException {
void singleProject() {
createProject(this.projectDir);
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
.withArguments("build").withPluginClasspath().buildAndFail();
@ -59,7 +59,7 @@ class TestFailuresPluginIntegrationTests { @@ -59,7 +59,7 @@ class TestFailuresPluginIntegrationTests {
}
@Test
void multiProject() throws IOException {
void multiProject() {
createMultiProjectBuild();
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
.withArguments("build").withPluginClasspath().buildAndFail();
@ -69,7 +69,7 @@ class TestFailuresPluginIntegrationTests { @@ -69,7 +69,7 @@ class TestFailuresPluginIntegrationTests {
}
@Test
void multiProjectContinue() throws IOException {
void multiProjectContinue() {
createMultiProjectBuild();
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
.withArguments("build", "--continue").withPluginClasspath().buildAndFail();
@ -81,7 +81,7 @@ class TestFailuresPluginIntegrationTests { @@ -81,7 +81,7 @@ class TestFailuresPluginIntegrationTests {
}
@Test
void multiProjectParallel() throws IOException {
void multiProjectParallel() {
createMultiProjectBuild();
BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir)
.withArguments("build", "--parallel", "--stacktrace").withPluginClasspath().buildAndFail();

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -53,14 +53,14 @@ public class AuditAutoConfiguration { @@ -53,14 +53,14 @@ public class AuditAutoConfiguration {
@Bean
@ConditionalOnClass(name = "org.springframework.security.authentication.event.AbstractAuthenticationEvent")
@ConditionalOnMissingBean(AbstractAuthenticationAuditListener.class)
public AuthenticationAuditListener authenticationAuditListener() throws Exception {
public AuthenticationAuditListener authenticationAuditListener() {
return new AuthenticationAuditListener();
}
@Bean
@ConditionalOnClass(name = "org.springframework.security.access.event.AbstractAuthorizationEvent")
@ConditionalOnMissingBean(AbstractAuthorizationAuditListener.class)
public AuthorizationAuditListener authorizationAuditListener() throws Exception {
public AuthorizationAuditListener authorizationAuditListener() {
return new AuthorizationAuditListener();
}

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

@ -240,21 +240,16 @@ public class JerseyEndpointResourceFactory { @@ -240,21 +240,16 @@ public class JerseyEndpointResourceFactory {
Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT;
return Response.status(status).build();
}
try {
if (!(response instanceof WebEndpointResponse)) {
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
}
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
return Response.status(webEndpointResponse.getStatus())
.header("Content-Type", webEndpointResponse.getContentType())
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
}
catch (IOException ex) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
if (!(response instanceof WebEndpointResponse)) {
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
}
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
return Response.status(webEndpointResponse.getStatus())
.header("Content-Type", webEndpointResponse.getContentType())
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
}
private Object convertIfNecessary(Object body) throws IOException {
private Object convertIfNecessary(Object body) {
for (Function<Object, Object> converter : BODY_CONVERTERS) {
body = converter.apply(body);
}

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -249,7 +249,7 @@ class ConfigurationPropertiesReportEndpointSerializationTests { @@ -249,7 +249,7 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
@Test
@SuppressWarnings("unchecked")
void endpointResponseUsesToStringOfCharSequenceAsPropertyValue() throws IOException {
void endpointResponseUsesToStringOfCharSequenceAsPropertyValue() {
ApplicationContextRunner contextRunner = new ApplicationContextRunner().withInitializer((context) -> {
ConfigurableEnvironment environment = context.getEnvironment();
environment.getPropertySources().addFirst(new MapPropertySource("test",
@ -267,7 +267,7 @@ class ConfigurationPropertiesReportEndpointSerializationTests { @@ -267,7 +267,7 @@ class ConfigurationPropertiesReportEndpointSerializationTests {
@Test
@SuppressWarnings("unchecked")
void endpointResponseUsesPlaceholderForComplexValueAsPropertyValue() throws IOException {
void endpointResponseUsesPlaceholderForComplexValueAsPropertyValue() {
ApplicationContextRunner contextRunner = new ApplicationContextRunner().withInitializer((context) -> {
ConfigurableEnvironment environment = context.getEnvironment();
environment.getPropertySources().addFirst(new MapPropertySource("test",

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,8 +16,6 @@ @@ -16,8 +16,6 @@
package org.springframework.boot.autoconfigure.cache;
import java.io.IOException;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.spring.cache.HazelcastCacheManager;
@ -50,8 +48,8 @@ import org.springframework.context.annotation.Configuration; @@ -50,8 +48,8 @@ import org.springframework.context.annotation.Configuration;
class HazelcastCacheConfiguration {
@Bean
HazelcastCacheManager cacheManager(CacheManagerCustomizers customizers, HazelcastInstance existingHazelcastInstance)
throws IOException {
HazelcastCacheManager cacheManager(CacheManagerCustomizers customizers,
HazelcastInstance existingHazelcastInstance) {
HazelcastCacheManager cacheManager = new HazelcastCacheManager(existingHazelcastInstance);
return customizers.customize(cacheManager);
}

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -65,8 +65,8 @@ class ArtemisEmbeddedServerConfiguration { @@ -65,8 +65,8 @@ class ArtemisEmbeddedServerConfiguration {
@Bean(initMethod = "start", destroyMethod = "stop")
@ConditionalOnMissingBean
EmbeddedActiveMQ embeddedActiveMq(org.apache.activemq.artemis.core.config.Configuration configuration,
JMSConfiguration jmsConfiguration, ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers)
throws Exception {
JMSConfiguration jmsConfiguration,
ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers) {
for (JMSQueueConfiguration queueConfiguration : jmsConfiguration.getQueueConfigurations()) {
String queueName = queueConfiguration.getName();
configuration.addAddressConfiguration(

4
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -127,7 +127,7 @@ public class EmbeddedLdapAutoConfiguration { @@ -127,7 +127,7 @@ public class EmbeddedLdapAutoConfiguration {
}
}
private void importLdif(ApplicationContext applicationContext) throws LDAPException {
private void importLdif(ApplicationContext applicationContext) {
String location = this.embeddedProperties.getLdif();
if (StringUtils.hasText(location)) {
try {

4
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -82,7 +82,7 @@ class AtomikosJtaConfiguration { @@ -82,7 +82,7 @@ class AtomikosJtaConfiguration {
@Bean(initMethod = "init", destroyMethod = "close")
@ConditionalOnMissingBean(TransactionManager.class)
UserTransactionManager atomikosTransactionManager(UserTransactionService userTransactionService) throws Exception {
UserTransactionManager atomikosTransactionManager(UserTransactionService userTransactionService) {
UserTransactionManager manager = new UserTransactionManager();
manager.setStartupTransactionService(false);
manager.setForceShutdown(true);

5
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/Jetty10WebSocketServletWebServerCustomizer.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -77,8 +77,7 @@ class Jetty10WebSocketServletWebServerCustomizer @@ -77,8 +77,7 @@ class Jetty10WebSocketServletWebServerCustomizer
ReflectionUtils.invokeMethod(ensureWebSocketComponents, null, server, servletContext);
}
private void ensureContainer(Class<?> container, ServletContext servletContext)
throws ClassNotFoundException {
private void ensureContainer(Class<?> container, ServletContext servletContext) {
Method ensureContainer = ReflectionUtils.findMethod(container, "ensureContainer", ServletContext.class);
ReflectionUtils.invokeMethod(ensureContainer, null, servletContext);
}

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

@ -64,7 +64,7 @@ class BatchDataSourceScriptDatabaseInitializerTests { @@ -64,7 +64,7 @@ class BatchDataSourceScriptDatabaseInitializerTests {
@ParameterizedTest
@EnumSource(value = DatabaseDriver.class, mode = Mode.EXCLUDE, names = { "FIREBIRD", "GAE", "HANA", "INFORMIX",
"JTDS", "PHOENIX", "REDSHIFT", "TERADATA", "TESTCONTAINERS", "UNKNOWN" })
void batchSchemaCanBeLocated(DatabaseDriver driver) throws IOException, SQLException {
void batchSchemaCanBeLocated(DatabaseDriver driver) throws SQLException {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
BatchProperties properties = new BatchProperties();
DataSource dataSource = mock(DataSource.class);

9
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java

@ -16,7 +16,6 @@ @@ -16,7 +16,6 @@
package org.springframework.boot.autoconfigure.jmx;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.junit.jupiter.api.Test;
@ -38,7 +37,7 @@ class ParentAwareNamingStrategyTests { @@ -38,7 +37,7 @@ class ParentAwareNamingStrategyTests {
private ApplicationContextRunner contextRunner = new ApplicationContextRunner();
@Test
void objectNameMatchesManagedResourceByDefault() throws MalformedObjectNameException {
void objectNameMatchesManagedResourceByDefault() {
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((context) -> {
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(new AnnotationJmxAttributeSource());
strategy.setApplicationContext(context);
@ -48,7 +47,7 @@ class ParentAwareNamingStrategyTests { @@ -48,7 +47,7 @@ class ParentAwareNamingStrategyTests {
}
@Test
void uniqueObjectNameAddsIdentityProperty() throws MalformedObjectNameException {
void uniqueObjectNameAddsIdentityProperty() {
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((context) -> {
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(new AnnotationJmxAttributeSource());
strategy.setApplicationContext(context);
@ -62,7 +61,7 @@ class ParentAwareNamingStrategyTests { @@ -62,7 +61,7 @@ class ParentAwareNamingStrategyTests {
}
@Test
void sameBeanInParentContextAddsContextProperty() throws MalformedObjectNameException {
void sameBeanInParentContextAddsContextProperty() {
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((parent) -> this.contextRunner
.withBean("testManagedResource", TestManagedResource.class).withParent(parent).run((context) -> {
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(
@ -77,7 +76,7 @@ class ParentAwareNamingStrategyTests { @@ -77,7 +76,7 @@ class ParentAwareNamingStrategyTests {
}
@Test
void uniqueObjectNameAndSameBeanInParentContextOnlyAddsIdentityProperty() throws MalformedObjectNameException {
void uniqueObjectNameAndSameBeanInParentContextOnlyAddsIdentityProperty() {
this.contextRunner.withBean("testManagedResource", TestManagedResource.class).run((parent) -> this.contextRunner
.withBean("testManagedResource", TestManagedResource.class).withParent(parent).run((context) -> {
ParentAwareNamingStrategy strategy = new ParentAwareNamingStrategy(

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java

@ -468,7 +468,7 @@ class LiquibaseAutoConfigurationTests { @@ -468,7 +468,7 @@ class LiquibaseAutoConfigurationTests {
private String name = UUID.randomUUID().toString();
@Bean
SimpleDriverDataSource dataSource() throws SQLException {
SimpleDriverDataSource dataSource() {
SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
dataSource.setDriverClass(CustomH2Driver.class);
dataSource.setUrl(String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false", this.name));

8
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -366,7 +366,7 @@ class ServerPropertiesTests { @@ -366,7 +366,7 @@ class ServerPropertiesTests {
}
@Test
void tomcatMaxHttpPostSizeMatchesConnectorDefault() throws Exception {
void tomcatMaxHttpPostSizeMatchesConnectorDefault() {
assertThat(this.properties.getTomcat().getMaxHttpFormPostSize().toBytes())
.isEqualTo(getDefaultConnector().getMaxPostSize());
}
@ -378,13 +378,13 @@ class ServerPropertiesTests { @@ -378,13 +378,13 @@ class ServerPropertiesTests {
}
@Test
void tomcatMaxHttpFormPostSizeMatchesConnectorDefault() throws Exception {
void tomcatMaxHttpFormPostSizeMatchesConnectorDefault() {
assertThat(this.properties.getTomcat().getMaxHttpFormPostSize().toBytes())
.isEqualTo(getDefaultConnector().getMaxPostSize());
}
@Test
void tomcatUriEncodingMatchesConnectorDefault() throws Exception {
void tomcatUriEncodingMatchesConnectorDefault() {
assertThat(this.properties.getTomcat().getUriEncoding().name())
.isEqualTo(getDefaultConnector().getURIEncoding());
}

5
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/MavenResolverGrapeEngine.java

@ -35,7 +35,6 @@ import org.eclipse.aether.collection.CollectRequest; @@ -35,7 +35,6 @@ import org.eclipse.aether.collection.CollectRequest;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.Exclusion;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;
import org.eclipse.aether.resolution.DependencyRequest;
import org.eclipse.aether.resolution.DependencyResult;
@ -119,7 +118,7 @@ public class MavenResolverGrapeEngine implements GrapeEngine { @@ -119,7 +118,7 @@ public class MavenResolverGrapeEngine implements GrapeEngine {
classLoader.addURL(file.toURI().toURL());
}
}
catch (ArtifactResolutionException | MalformedURLException ex) {
catch (MalformedURLException ex) {
throw new DependencyResolutionFailedException(ex);
}
return null;
@ -286,7 +285,7 @@ public class MavenResolverGrapeEngine implements GrapeEngine { @@ -286,7 +285,7 @@ public class MavenResolverGrapeEngine implements GrapeEngine {
}
}
private List<File> resolve(List<Dependency> dependencies) throws ArtifactResolutionException {
private List<File> resolve(List<Dependency> dependencies) {
try {
CollectRequest collectRequest = getCollectRequest(dependencies);
DependencyRequest dependencyRequest = getDependencyRequest(collectRequest);

5
spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.springframework.boot.devtools.tests;
import java.io.File;
import java.io.IOException;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.client.StandardHttpRequestRetryHandler;
@ -153,7 +152,7 @@ class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests { @@ -153,7 +152,7 @@ class DevToolsIntegrationTests extends AbstractDevToolsIntegrationTests {
.isEqualTo(HttpStatus.NOT_FOUND);
}
static Object[] parameters() throws IOException {
static Object[] parameters() {
Directories directories = new Directories(buildOutput, temp);
return new Object[] { new Object[] { new LocalApplicationLauncher(directories) },
new Object[] { new ExplodedRemoteApplicationLauncher(directories) },

4
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -49,7 +49,7 @@ public class OptionalLiveReloadServer implements InitializingBean { @@ -49,7 +49,7 @@ public class OptionalLiveReloadServer implements InitializingBean {
startServer();
}
void startServer() throws Exception {
void startServer() {
if (this.server != null) {
try {
if (!this.server.isStarted()) {

12
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -321,12 +321,12 @@ public class Restarter { @@ -321,12 +321,12 @@ public class Restarter {
System.runFinalization();
}
private void cleanupCaches() throws Exception {
private void cleanupCaches() {
Introspector.flushCaches();
cleanupKnownCaches();
}
private void cleanupKnownCaches() throws Exception {
private void cleanupKnownCaches() {
// Whilst not strictly necessary it helps to cleanup soft reference caches
// early rather than waiting for memory limits to be reached
ResolvableType.clearCache();
@ -338,13 +338,13 @@ public class Restarter { @@ -338,13 +338,13 @@ public class Restarter {
}
}
private void cleanCachedIntrospectionResultsCache() throws Exception {
private void cleanCachedIntrospectionResultsCache() {
clear(CachedIntrospectionResults.class, "acceptedClassLoaders");
clear(CachedIntrospectionResults.class, "strongClassCache");
clear(CachedIntrospectionResults.class, "softClassCache");
}
private void clearAnnotationUtilsCache() throws Exception {
private void clearAnnotationUtilsCache() {
try {
AnnotationUtils.clearCache();
}
@ -365,7 +365,7 @@ public class Restarter { @@ -365,7 +365,7 @@ public class Restarter {
}
}
private void clear(Class<?> type, String fieldName) throws Exception {
private void clear(Class<?> type, String fieldName) {
try {
Field field = type.getDeclaredField(fieldName);
field.setAccessible(true);

2
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServerTests.java

@ -33,7 +33,7 @@ import static org.mockito.Mockito.never; @@ -33,7 +33,7 @@ import static org.mockito.Mockito.never;
class OptionalLiveReloadServerTests {
@Test
void nullServer() throws Exception {
void nullServer() {
OptionalLiveReloadServer server = new OptionalLiveReloadServer(null);
server.startServer();
server.triggerReload();

2
spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java

@ -79,7 +79,7 @@ class RestarterTests { @@ -79,7 +79,7 @@ class RestarterTests {
}
@Test
void testRestart(CapturedOutput output) throws Exception {
void testRestart(CapturedOutput output) {
Restarter.clearInstance();
Thread thread = new Thread(SampleApplication::main);
thread.start();

4
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredrestclient/MyRestClientTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -37,7 +37,7 @@ class MyRestClientTests { @@ -37,7 +37,7 @@ class MyRestClientTests {
private MockRestServiceServer server;
@Test
void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails() throws Exception {
void getVehicleDetailsWhenResultIsSuccessShouldReturnDetails() {
this.server.expect(requestTo("/greet/details")).andRespond(withSuccess("hello", MediaType.TEXT_PLAIN));
String greeting = this.service.callRestService();
assertThat(greeting).isEqualTo("hello");

4
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredspringdatajpa/withoutdb/MyRepositoryTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ class MyRepositoryTests { @@ -34,7 +34,7 @@ class MyRepositoryTests {
private UserRepository repository;
@Test
void testExample() throws Exception {
void testExample() {
this.entityManager.persist(new User("sboot", "1234"));
User user = this.repository.findByUsername("sboot");
assertThat(user.getUsername()).isEqualTo("sboot");

4
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredwebservices/server/ExampleEndpoint.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,7 +28,7 @@ public class ExampleEndpoint { @@ -28,7 +28,7 @@ public class ExampleEndpoint {
@PayloadRoot(localPart = "ExampleRequest")
@ResponsePayload
public Source handleRequest() throws Exception {
public Source handleRequest() {
return new StringSource("<ExampleResponse>42</ExampleResponse>");
}

5
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/jmx/MyJmxTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.springframework.boot.docs.features.testing.springbootapplications.jmx;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ -38,7 +37,7 @@ class MyJmxTests { @@ -38,7 +37,7 @@ class MyJmxTests {
private MBeanServer mBeanServer;
@Test
void exampleTest() throws MalformedObjectNameException {
void exampleTest() {
assertThat(this.mBeanServer.getDomains()).contains("java.lang");
// ...
}

4
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/springwebfluxtests/MyControllerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -36,7 +36,7 @@ class MyControllerTests { @@ -36,7 +36,7 @@ class MyControllerTests {
private UserVehicleService userVehicleService;
@Test
void testExample() throws Exception {
void testExample() {
// @formatter:off
given(this.userVehicleService.getVehicleDetails("sboot"))
.willReturn(new VehicleDetails("Honda", "Civic"));

4
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/utilities/testresttemplate/MyTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,7 +28,7 @@ class MyTests { @@ -28,7 +28,7 @@ class MyTests {
private TestRestTemplate template = new TestRestTemplate();
@Test
void testRequest() throws Exception {
void testRequest() {
ResponseEntity<String> headers = this.template.getForEntity("https://myhost.example.com/example", String.class);
assertThat(headers.getHeaders().getLocation()).hasHost("other.example.com");
}

4
spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestExecutionListener.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -60,7 +60,7 @@ public class RestDocsTestExecutionListener extends AbstractTestExecutionListener @@ -60,7 +60,7 @@ public class RestDocsTestExecutionListener extends AbstractTestExecutionListener
private static class DocumentationHandler {
private void beforeTestMethod(TestContext testContext) throws Exception {
private void beforeTestMethod(TestContext testContext) {
ManualRestDocumentation restDocumentation = findManualRestDocumentation(testContext);
if (restDocumentation != null) {
restDocumentation.beforeTest(testContext.getTestClass(), testContext.getTestMethod().getName());

4
spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -71,7 +71,7 @@ class SpringBootDependencyInjectionTestExecutionListenerTests { @@ -71,7 +71,7 @@ class SpringBootDependencyInjectionTestExecutionListenerTests {
}
@Test
void originalFailureIsThrownWhenReportGenerationFails() throws Exception {
void originalFailureIsThrownWhenReportGenerationFails() {
TestContext testContext = mock(TestContext.class);
IllegalStateException originalFailure = new IllegalStateException();
given(testContext.getTestInstance()).willThrow(originalFailure);

2
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java

@ -135,7 +135,7 @@ class SpringBootContextLoaderTests { @@ -135,7 +135,7 @@ class SpringBootContextLoaderTests {
}
@Test
void propertySourceOrdering() throws Exception {
void propertySourceOrdering() {
TestContext context = new ExposedTestContextManager(PropertySourceOrdering.class).getExposedTestContext();
ConfigurableEnvironment environment = (ConfigurableEnvironment) context.getApplicationContext()
.getEnvironment();

4
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -48,7 +48,7 @@ class MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests { @@ -48,7 +48,7 @@ class MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {
private ExampleServiceCaller caller;
@Test
void testMocking() throws Exception {
void testMocking() {
given(this.exampleService.greeting()).willReturn("Boot");
assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot");
}

2
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java

@ -53,7 +53,7 @@ class SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests { @@ -53,7 +53,7 @@ class SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
private ApplicationContext applicationContext;
@Test
void testMocking() throws Exception {
void testMocking() {
this.caller.sayGreeting();
then(this.service).should().greeting();
}

2
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java

@ -47,7 +47,7 @@ class SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests { @@ -47,7 +47,7 @@ class SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {
private ExampleServiceCaller caller;
@Test
void testSpying() throws Exception {
void testSpying() {
this.caller.sayGreeting();
then(this.exampleService).should().greeting();
}

2
spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithJdkProxyTests.java

@ -47,7 +47,7 @@ class SpyBeanWithJdkProxyTests { @@ -47,7 +47,7 @@ class SpyBeanWithJdkProxyTests {
private ExampleRepository repository;
@Test
void jdkProxyCanBeSpied() throws Exception {
void jdkProxyCanBeSpied() {
Example example = this.service.find("id");
assertThat(example.id).isEqualTo("id");
then(this.repository).should().find("id");

12
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -49,7 +49,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests { @@ -49,7 +49,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
}
@Test
void fromTomlWhenMissingDescriptorThrowsException() throws Exception {
void fromTomlWhenMissingDescriptorThrowsException() {
ByteArrayInputStream coordinates = new ByteArrayInputStream("".getBytes());
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
.withMessageContaining("Buildpack descriptor 'buildpack.toml' is required")
@ -57,7 +57,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests { @@ -57,7 +57,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
}
@Test
void fromTomlWhenMissingIDThrowsException() throws Exception {
void fromTomlWhenMissingIDThrowsException() {
InputStream coordinates = createTomlStream(null, null, true, false);
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
.withMessageContaining("Buildpack descriptor must contain ID")
@ -65,7 +65,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests { @@ -65,7 +65,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
}
@Test
void fromTomlWhenMissingVersionThrowsException() throws Exception {
void fromTomlWhenMissingVersionThrowsException() {
InputStream coordinates = createTomlStream("example/buildpack1", null, true, false);
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
.withMessageContaining("Buildpack descriptor must contain version")
@ -73,7 +73,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests { @@ -73,7 +73,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
}
@Test
void fromTomlWhenMissingStacksAndOrderThrowsException() throws Exception {
void fromTomlWhenMissingStacksAndOrderThrowsException() {
InputStream coordinates = createTomlStream("example/buildpack1", "0.0.1", false, false);
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
.withMessageContaining("Buildpack descriptor must contain either 'stacks' or 'order'")
@ -81,7 +81,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests { @@ -81,7 +81,7 @@ class BuildpackCoordinatesTests extends AbstractJsonTests {
}
@Test
void fromTomlWhenContainsBothStacksAndOrderThrowsException() throws Exception {
void fromTomlWhenContainsBothStacksAndOrderThrowsException() {
InputStream coordinates = createTomlStream("example/buildpack1", "0.0.1", true, true);
assertThatIllegalArgumentException().isThrownBy(() -> BuildpackCoordinates.fromToml(coordinates, this.archive))
.withMessageContaining("Buildpack descriptor must not contain both 'stacks' and 'order'")

6
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/FilePermissionsTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -58,7 +58,7 @@ class FilePermissionsTests { @@ -58,7 +58,7 @@ class FilePermissionsTests {
@Test
@DisabledOnOs(OS.WINDOWS)
void umaskForPathWithNonExistentFile() throws IOException {
void umaskForPathWithNonExistentFile() {
assertThatIOException()
.isThrownBy(() -> FilePermissions.umaskForPath(Paths.get(this.tempDir.toString(), "does-not-exist")));
}
@ -72,7 +72,7 @@ class FilePermissionsTests { @@ -72,7 +72,7 @@ class FilePermissionsTests {
}
@Test
void umaskForPathWithNullPath() throws IOException {
void umaskForPathWithNullPath() {
assertThatIllegalArgumentException().isThrownBy(() -> FilePermissions.umaskForPath(null));
}

4
spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -91,7 +91,7 @@ public final class ConfigurationMetadataRepositoryJsonBuilder { @@ -91,7 +91,7 @@ public final class ConfigurationMetadataRepositoryJsonBuilder {
return result;
}
private SimpleConfigurationMetadataRepository add(InputStream in, Charset charset) throws IOException {
private SimpleConfigurationMetadataRepository add(InputStream in, Charset charset) {
try {
RawConfigurationMetadata metadata = this.reader.read(in, charset);
return create(metadata);

17
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java

@ -112,16 +112,11 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> { @@ -112,16 +112,11 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@BeforeEach
void createTask() {
try {
File projectDir = new File(this.temp, "project");
projectDir.mkdirs();
this.project = GradleProjectBuilder.builder().withProjectDir(projectDir).build();
this.project.setDescription("Test project for " + this.taskClass.getSimpleName());
this.task = configure(this.project.getTasks().create("testArchive", this.taskClass));
}
catch (IOException ex) {
throw new RuntimeException(ex);
}
File projectDir = new File(this.temp, "project");
projectDir.mkdirs();
this.project = GradleProjectBuilder.builder().withProjectDir(projectDir).build();
this.project.setDescription("Test project for " + this.taskClass.getSimpleName());
this.task = configure(this.project.getTasks().create("testArchive", this.taskClass));
}
@Test
@ -586,7 +581,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> { @@ -586,7 +581,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
return file;
}
private T configure(T task) throws IOException {
private T configure(T task) {
AbstractArchiveTask archiveTask = task;
archiveTask.getArchiveBaseName().set("test");
File destination = new File(this.temp, "destination");

4
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java

@ -92,7 +92,7 @@ abstract class AbstractPackagerTests<P extends Packager> { @@ -92,7 +92,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
protected TestJarFile testJarFile;
@BeforeEach
void setup() throws IOException {
void setup() {
this.testJarFile = new TestJarFile(this.tempDir);
}
@ -628,7 +628,7 @@ abstract class AbstractPackagerTests<P extends Packager> { @@ -628,7 +628,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
return new Library(null, file, scope, null, unpackRequired, false, included);
}
protected final P createPackager() throws IOException {
protected final P createPackager() {
return createPackager(this.testJarFile.getFile());
}

5
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.springframework.boot.loader.tools;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.jar.JarFile;
@ -45,7 +44,7 @@ class MainClassFinderTests { @@ -45,7 +44,7 @@ class MainClassFinderTests {
private TestJarFile testJarFile;
@BeforeEach
void setup(@TempDir File tempDir) throws IOException {
void setup(@TempDir File tempDir) {
this.testJarFile = new TestJarFile(tempDir);
}

8
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -46,7 +46,7 @@ public class TestJarFile { @@ -46,7 +46,7 @@ public class TestJarFile {
private final List<ZipEntrySource> entries = new ArrayList<>();
public TestJarFile(File temporaryDirectory) throws IOException {
public TestJarFile(File temporaryDirectory) {
this.temporaryDirectory = temporaryDirectory;
this.jarSource = new File(temporaryDirectory, "jar-source");
}
@ -115,11 +115,11 @@ public class TestJarFile { @@ -115,11 +115,11 @@ public class TestJarFile {
return this.jarSource;
}
public File getFile() throws IOException {
public File getFile() {
return getFile("jar");
}
public File getFile(String extension) throws IOException {
public File getFile(String extension) {
File file = new File(this.temporaryDirectory, UUID.randomUUID() + "." + extension);
ZipUtil.pack(this.entries.toArray(new ZipEntrySource[0]), file);
return file;

4
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -221,7 +221,7 @@ class CentralDirectoryEndRecord { @@ -221,7 +221,7 @@ class CentralDirectoryEndRecord {
private final long offset;
private Zip64Locator(long offset, byte[] block) throws IOException {
private Zip64Locator(long offset, byte[] block) {
this.offset = offset;
this.zip64EndOffset = Bytes.littleEndianValue(block, ZIP64_LOCOFF, 8);
}

5
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -407,8 +407,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests { @@ -407,8 +407,7 @@ class JarIntegrationTests extends AbstractArchiveIntegrationTests {
}
@TestTemplate
void whenJarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild)
throws InterruptedException {
void whenJarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild) {
mavenBuild.project("jar-output-timestamp").execute((project) -> {
File repackaged = new File(project, "target/jar-output-timestamp-0.0.1.BUILD-SNAPSHOT.jar");
List<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api", "BOOT-INF/lib/spring-aop",

5
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -113,8 +113,7 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests { @@ -113,8 +113,7 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests {
}
@TestTemplate
void whenWarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild)
throws InterruptedException {
void whenWarIsRepackagedWithOutputTimestampConfiguredThenLibrariesAreSorted(MavenBuild mavenBuild) {
mavenBuild.project("war-output-timestamp").execute((project) -> {
File repackaged = new File(project, "target/war-output-timestamp-0.0.1.BUILD-SNAPSHOT.war");
List<String> sortedLibs = Arrays.asList(

4
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java

@ -188,7 +188,7 @@ public class StartMojo extends AbstractRunMojo { @@ -188,7 +188,7 @@ public class StartMojo extends AbstractRunMojo {
}
}
private void waitForForkedSpringApplication() throws IOException, MojoFailureException, MojoExecutionException {
private void waitForForkedSpringApplication() throws IOException, MojoExecutionException {
try {
getLog().debug("Connecting to local MBeanServer at port " + this.jmxPort);
try (JMXConnector connector = execute(this.wait, this.maxAttempts, new CreateJmxConnector(this.jmxPort))) {
@ -210,7 +210,7 @@ public class StartMojo extends AbstractRunMojo { @@ -210,7 +210,7 @@ public class StartMojo extends AbstractRunMojo {
}
private void doWaitForSpringApplication(MBeanServerConnection connection)
throws IOException, MojoExecutionException, MojoFailureException {
throws MojoExecutionException, MojoFailureException {
final SpringApplicationAdminClient client = new SpringApplicationAdminClient(connection, this.jmxName);
try {
execute(this.wait, this.maxAttempts, () -> (client.isReady() ? true : null));

6
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -111,14 +111,14 @@ public class StopMojo extends AbstractMojo { @@ -111,14 +111,14 @@ public class StopMojo extends AbstractMojo {
return true;
}
private void stopForkedProcess() throws IOException, MojoFailureException, MojoExecutionException {
private void stopForkedProcess() throws IOException, MojoExecutionException {
try (JMXConnector connector = SpringApplicationAdminClient.connect(this.jmxPort)) {
MBeanServerConnection connection = connector.getMBeanServerConnection();
doStop(connection);
}
}
private void stop() throws IOException, MojoFailureException, MojoExecutionException {
private void stop() throws IOException, MojoExecutionException {
doStop(ManagementFactory.getPlatformMBeanServer());
}

5
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -25,7 +25,6 @@ import java.util.stream.Stream; @@ -25,7 +25,6 @@ import java.util.stream.Stream;
import javax.servlet.ServletException;
import org.apache.catalina.Container;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Manager;
import org.apache.catalina.Wrapper;
import org.apache.catalina.core.StandardContext;
@ -60,7 +59,7 @@ class TomcatEmbeddedContext extends StandardContext { @@ -60,7 +59,7 @@ class TomcatEmbeddedContext extends StandardContext {
super.setManager(manager);
}
void deferredLoadOnStartup() throws LifecycleException {
void deferredLoadOnStartup() {
doWithThreadContextClassLoader(getLoader().getClassLoader(),
() -> getLoadOnStartupWrappers(findChildren()).forEach(this::load));
}

2
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java

@ -100,7 +100,7 @@ class SpringApplicationShutdownHookTests { @@ -100,7 +100,7 @@ class SpringApplicationShutdownHookTests {
}
@Test
void runDueToExitDuringRefreshWhenContextHasBeenClosedDoesNotDeadlock() throws InterruptedException {
void runDueToExitDuringRefreshWhenContextHasBeenClosedDoesNotDeadlock() {
GenericApplicationContext context = new GenericApplicationContext();
TestSpringApplicationShutdownHook shutdownHook = new TestSpringApplicationShutdownHook();
shutdownHook.registerApplicationContext(context);

4
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java

@ -723,12 +723,12 @@ class ConfigurationPropertyNameTests { @@ -723,12 +723,12 @@ class ConfigurationPropertyNameTests {
}
@Test
void hasIndexedElementWhenHasIndexedElementReturnsTrue() throws Exception {
void hasIndexedElementWhenHasIndexedElementReturnsTrue() {
assertThat(ConfigurationPropertyName.of("foo[bar]").hasIndexedElement()).isTrue();
}
@Test
void hasIndexedElementWhenHasNoIndexedElementReturnsFalse() throws Exception {
void hasIndexedElementWhenHasNoIndexedElementReturnsFalse() {
assertThat(ConfigurationPropertyName.of("foo.bar").hasIndexedElement()).isFalse();
}

4
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/DurationToStringConverterTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -55,7 +55,7 @@ class DurationToStringConverterTests { @@ -55,7 +55,7 @@ class DurationToStringConverterTests {
assertThat(converted).isEqualTo("1s");
}
static Stream<? extends Arguments> conversionServices() throws Exception {
static Stream<? extends Arguments> conversionServices() {
return ConversionServiceArguments.with(new DurationToStringConverter());
}

4
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/PeriodToStringConverterTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -78,7 +78,7 @@ class PeriodToStringConverterTests { @@ -78,7 +78,7 @@ class PeriodToStringConverterTests {
assertThat(converted).isEqualTo("371d");
}
static Stream<? extends Arguments> conversionServices() throws Exception {
static Stream<? extends Arguments> conversionServices() {
return ConversionServiceArguments.with(new PeriodToStringConverter());
}

6
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -131,13 +131,13 @@ class BeanCurrentlyInCreationFailureAnalyzerTests { @@ -131,13 +131,13 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
}
@Test
void cycleWithCircularReferencesAllowed() throws IOException {
void cycleWithCircularReferencesAllowed() {
FailureAnalysis analysis = performAnalysis(CyclicBeanMethodsConfiguration.class, true);
assertThat(analysis.getAction()).contains("Despite circular references being allowed");
}
@Test
void cycleWithCircularReferencesProhibited() throws IOException {
void cycleWithCircularReferencesProhibited() {
FailureAnalysis analysis = performAnalysis(CyclicBeanMethodsConfiguration.class, false);
assertThat(analysis.getAction()).contains("As a last resort");
}

3
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java

@ -19,7 +19,6 @@ package org.springframework.boot.web.embedded.tomcat; @@ -19,7 +19,6 @@ package org.springframework.boot.web.embedded.tomcat;
import java.io.File;
import java.io.IOException;
import java.net.SocketException;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
@ -513,7 +512,7 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory @@ -513,7 +512,7 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory
}
@Test
void nonExistentUploadDirectoryIsCreatedUponMultipartUpload() throws IOException, URISyntaxException {
void nonExistentUploadDirectoryIsCreatedUponMultipartUpload() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
AtomicReference<ServletContext> servletContextReference = new AtomicReference<>();
factory.addInitializers((servletContext) -> {

8
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java

@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
package org.springframework.boot.web.reactive.server;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
@ -27,10 +26,8 @@ import java.time.Duration; @@ -27,10 +26,8 @@ import java.time.Duration;
import java.util.Arrays;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@ -455,7 +452,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { @@ -455,7 +452,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
}
@Test
void whenARequestIsActiveThenStopWillComplete() throws InterruptedException, BrokenBarrierException {
void whenARequestIsActiveThenStopWillComplete() throws InterruptedException {
AbstractReactiveWebServerFactory factory = getFactory();
BlockingHandler blockingHandler = new BlockingHandler();
this.webServer = factory.getWebServer(blockingHandler);
@ -501,8 +498,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { @@ -501,8 +498,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
}
@Test
protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed()
throws InterruptedException, ExecutionException, IOException {
protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed() {
AbstractReactiveWebServerFactory factory = getFactory();
Http2 http2 = new Http2();
http2.setEnabled(true);

10
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java

@ -47,9 +47,7 @@ import java.util.Map; @@ -47,9 +47,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RunnableFuture;
@ -1161,7 +1159,7 @@ public abstract class AbstractServletWebServerFactoryTests { @@ -1161,7 +1159,7 @@ public abstract class AbstractServletWebServerFactoryTests {
}
@Test
void whenARequestIsActiveThenStopWillComplete() throws InterruptedException, BrokenBarrierException {
void whenARequestIsActiveThenStopWillComplete() throws InterruptedException {
AbstractServletWebServerFactory factory = getFactory();
BlockingServlet blockingServlet = new BlockingServlet();
this.webServer = factory
@ -1201,8 +1199,7 @@ public abstract class AbstractServletWebServerFactoryTests { @@ -1201,8 +1199,7 @@ public abstract class AbstractServletWebServerFactoryTests {
}
@Test
protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed()
throws InterruptedException, ExecutionException, IOException, URISyntaxException {
protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed() throws IOException, URISyntaxException {
AbstractServletWebServerFactory factory = getFactory();
Http2 http2 = new Http2();
http2.setEnabled(true);
@ -1213,8 +1210,7 @@ public abstract class AbstractServletWebServerFactoryTests { @@ -1213,8 +1210,7 @@ public abstract class AbstractServletWebServerFactoryTests {
}
@Test
void whenARequestIsActiveAfterGracefulShutdownEndsThenStopWillComplete()
throws InterruptedException, BrokenBarrierException {
void whenARequestIsActiveAfterGracefulShutdownEndsThenStopWillComplete() throws InterruptedException {
AbstractServletWebServerFactory factory = getFactory();
factory.setShutdown(Shutdown.GRACEFUL);
BlockingServlet blockingServlet = new BlockingServlet();

4
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/ChatService.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -47,7 +47,7 @@ public class ChatService { @@ -47,7 +47,7 @@ public class ChatService {
@org.atmosphere.config.service.Message(encoders = JacksonEncoderDecoder.class,
decoders = JacksonEncoderDecoder.class)
public Message onMessage(Message message) throws IOException {
public Message onMessage(Message message) {
this.logger.info("Author " + message.getAuthor() + " sent message " + message.getMessage());
return message;
}

4
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/SampleAtmosphereApplication.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -61,7 +61,7 @@ public class SampleAtmosphereApplication { @@ -61,7 +61,7 @@ public class SampleAtmosphereApplication {
return registration;
}
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
SpringApplication.run(SampleAtmosphereApplication.class, args);
}

6
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-batch/src/main/java/smoketest/batch/SampleBatchApplication.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -53,12 +53,12 @@ public class SampleBatchApplication { @@ -53,12 +53,12 @@ public class SampleBatchApplication {
}
@Bean
public Job job() throws Exception {
public Job job() {
return this.jobs.get("job").start(step1()).build();
}
@Bean
protected Step step1() throws Exception {
protected Step step1() {
return this.steps.get("step1").tasklet(tasklet()).build();
}

4
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/main/java/smoketest/parent/SampleParentContextApplication.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -34,7 +34,7 @@ import org.springframework.integration.file.FileWritingMessageHandler; @@ -34,7 +34,7 @@ import org.springframework.integration.file.FileWritingMessageHandler;
@SpringBootApplication
public class SampleParentContextApplication {
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
new SpringApplicationBuilder(Parent.class).child(SampleParentContextApplication.class).run(args);
}

4
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/SampleIntegrationParentApplicationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -46,7 +46,7 @@ import static org.hamcrest.Matchers.containsString; @@ -46,7 +46,7 @@ import static org.hamcrest.Matchers.containsString;
class SampleIntegrationParentApplicationTests {
@Test
void testVanillaExchange(@TempDir Path temp) throws Exception {
void testVanillaExchange(@TempDir Path temp) {
File inputDir = new File(temp.toFile(), "input");
File outputDir = new File(temp.toFile(), "output");
try (ConfigurableApplicationContext app = SpringApplication.run(SampleParentContextApplication.class,

6
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/CorsSampleActuatorApplicationTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -41,13 +41,13 @@ class CorsSampleActuatorApplicationTests { @@ -41,13 +41,13 @@ class CorsSampleActuatorApplicationTests {
}
@Test
void preflightRequestToEndpointShouldReturnOk() throws Exception {
void preflightRequestToEndpointShouldReturnOk() {
this.webClient.options().uri("/actuator/env").header("Origin", "http://localhost:8080")
.header("Access-Control-Request-Method", "GET").exchange().expectStatus().isOk();
}
@Test
void preflightRequestWhenCorsConfigInvalidShouldReturnForbidden() throws Exception {
void preflightRequestWhenCorsConfigInvalidShouldReturnForbidden() {
this.webClient.options().uri("/actuator/env").header("Origin", "http://localhost:9095")
.header("Access-Control-Request-Method", "GET").exchange().expectStatus().isForbidden();
}

4
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-method-security/src/main/java/smoketest/security/method/SampleMethodSecurityApplication.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -54,7 +54,7 @@ public class SampleMethodSecurityApplication implements WebMvcConfigurer { @@ -54,7 +54,7 @@ public class SampleMethodSecurityApplication implements WebMvcConfigurer {
@SuppressWarnings("deprecation")
@Bean
public InMemoryUserDetailsManager inMemoryUserDetailsManager() throws Exception {
public InMemoryUserDetailsManager inMemoryUserDetailsManager() {
return new InMemoryUserDetailsManager(
User.withDefaultPasswordEncoder().username("admin").password("admin")
.roles("ADMIN", "USER", "ACTUATOR").build(),

9
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,11 +19,7 @@ package smoketest.webservices.endpoint; @@ -19,11 +19,7 @@ package smoketest.webservices.endpoint;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactoryConfigurationException;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.Namespace;
import org.jdom2.filter.Filters;
import org.jdom2.xpath.XPathExpression;
@ -47,8 +43,7 @@ public class HolidayEndpoint { @@ -47,8 +43,7 @@ public class HolidayEndpoint {
private HumanResourceService humanResourceService;
public HolidayEndpoint(HumanResourceService humanResourceService)
throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException {
public HolidayEndpoint(HumanResourceService humanResourceService) {
this.humanResourceService = humanResourceService;
Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
XPathFactory xPathFactory = XPathFactory.instance();

2
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/snake/SnakeTimer.java

@ -80,7 +80,7 @@ public final class SnakeTimer { @@ -80,7 +80,7 @@ public final class SnakeTimer {
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
}
public static void broadcast(String message) throws Exception {
public static void broadcast(String message) {
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
for (Snake snake : snakes) {
try {

4
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty10/src/main/java/smoketest/websocket/jetty10/snake/SnakeTimer.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -80,7 +80,7 @@ public final class SnakeTimer { @@ -80,7 +80,7 @@ public final class SnakeTimer {
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
}
public static void broadcast(String message) throws Exception {
public static void broadcast(String message) {
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
for (Snake snake : snakes) {
try {

2
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/snake/SnakeTimer.java

@ -80,7 +80,7 @@ public final class SnakeTimer { @@ -80,7 +80,7 @@ public final class SnakeTimer {
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
}
public static void broadcast(String message) throws Exception {
public static void broadcast(String message) {
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
for (Snake snake : snakes) {
try {

2
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/snake/SnakeTimer.java

@ -80,7 +80,7 @@ public final class SnakeTimer { @@ -80,7 +80,7 @@ public final class SnakeTimer {
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
}
public static void broadcast(String message) throws Exception {
public static void broadcast(String message) {
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
for (Snake snake : snakes) {
try {

Loading…
Cancel
Save