From ee45fd2fc8855e2428e23690331925d45a2d81f5 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 26 May 2022 14:24:55 +0100 Subject: [PATCH] Remove redundant throws declarations from internal APIs Closes gh-31176 --- ...eckClasspathForProhibitedDependencies.java | 3 +-- .../boot/build/mavenplugin/MavenExec.java | 2 +- .../build/bom/BomPluginIntegrationTests.java | 2 +- ...nalDependenciesPluginIntegrationTests.java | 2 +- .../TestFailuresPluginIntegrationTests.java | 10 +++++----- .../audit/AuditAutoConfiguration.java | 6 +++--- .../jersey/JerseyEndpointResourceFactory.java | 19 +++++++------------ ...rtiesReportEndpointSerializationTests.java | 6 +++--- .../cache/HazelcastCacheConfiguration.java | 8 +++----- .../ArtemisEmbeddedServerConfiguration.java | 6 +++--- .../EmbeddedLdapAutoConfiguration.java | 4 ++-- .../jta/AtomikosJtaConfiguration.java | 4 ++-- ...10WebSocketServletWebServerCustomizer.java | 5 ++--- ...aSourceScriptDatabaseInitializerTests.java | 2 +- .../jmx/ParentAwareNamingStrategyTests.java | 9 ++++----- .../LiquibaseAutoConfigurationTests.java | 2 +- .../web/ServerPropertiesTests.java | 8 ++++---- .../grape/MavenResolverGrapeEngine.java | 5 ++--- .../tests/DevToolsIntegrationTests.java | 5 ++--- .../OptionalLiveReloadServer.java | 4 ++-- .../boot/devtools/restart/Restarter.java | 12 ++++++------ .../OptionalLiveReloadServerTests.java | 2 +- .../boot/devtools/restart/RestarterTests.java | 2 +- .../MyRestClientTests.java | 4 ++-- .../withoutdb/MyRepositoryTests.java | 4 ++-- .../server/ExampleEndpoint.java | 4 ++-- .../jmx/MyJmxTests.java | 5 ++--- .../springwebfluxtests/MyControllerTests.java | 4 ++-- .../utilities/testresttemplate/MyTests.java | 4 ++-- .../RestDocsTestExecutionListener.java | 4 ++-- ...cyInjectionTestExecutionListenerTests.java | 4 ++-- .../context/SpringBootContextLoaderTests.java | 2 +- ...ClassModeBeforeMethodIntegrationTests.java | 4 ++-- ...tingBeanWithQualifierIntegrationTests.java | 2 +- ...ClassModeBeforeMethodIntegrationTests.java | 2 +- .../mockito/SpyBeanWithJdkProxyTests.java | 2 +- .../build/BuildpackCoordinatesTests.java | 12 ++++++------ .../platform/io/FilePermissionsTests.java | 6 +++--- ...gurationMetadataRepositoryJsonBuilder.java | 4 ++-- .../bundling/AbstractBootArchiveTests.java | 17 ++++++----------- .../loader/tools/AbstractPackagerTests.java | 4 ++-- .../loader/tools/MainClassFinderTests.java | 5 ++--- .../boot/loader/tools/TestJarFile.java | 8 ++++---- .../loader/jar/CentralDirectoryEndRecord.java | 4 ++-- .../boot/maven/JarIntegrationTests.java | 5 ++--- .../boot/maven/WarIntegrationTests.java | 5 ++--- .../springframework/boot/maven/StartMojo.java | 4 ++-- .../springframework/boot/maven/StopMojo.java | 6 +++--- .../tomcat/TomcatEmbeddedContext.java | 5 ++--- .../SpringApplicationShutdownHookTests.java | 2 +- .../ConfigurationPropertyNameTests.java | 4 ++-- .../DurationToStringConverterTests.java | 4 ++-- .../convert/PeriodToStringConverterTests.java | 4 ++-- ...rrentlyInCreationFailureAnalyzerTests.java | 6 +++--- .../TomcatServletWebServerFactoryTests.java | 3 +-- ...AbstractReactiveWebServerFactoryTests.java | 8 ++------ .../AbstractServletWebServerFactoryTests.java | 10 +++------- .../smoketest/atmosphere/ChatService.java | 4 ++-- .../SampleAtmosphereApplication.java | 4 ++-- .../batch/SampleBatchApplication.java | 6 +++--- .../SampleParentContextApplication.java | 4 ++-- ...mpleIntegrationParentApplicationTests.java | 4 ++-- .../CorsSampleActuatorApplicationTests.java | 6 +++--- .../SampleMethodSecurityApplication.java | 4 ++-- .../webservices/endpoint/HolidayEndpoint.java | 9 ++------- .../websocket/jetty/snake/SnakeTimer.java | 2 +- .../websocket/jetty10/snake/SnakeTimer.java | 4 ++-- .../websocket/tomcat/snake/SnakeTimer.java | 2 +- .../websocket/undertow/snake/SnakeTimer.java | 2 +- 69 files changed, 157 insertions(+), 193 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java b/buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java index f0ea6caa8af..fa84f09755e 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/classpath/CheckClasspathForProhibitedDependencies.java @@ -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 { } @TaskAction - public void checkForProhibitedDependencies() throws IOException { + public void checkForProhibitedDependencies() { TreeSet 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)); diff --git a/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenExec.java b/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenExec.java index 0536e69c0f7..4a0a6b8d7bb 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenExec.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenExec.java @@ -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"); diff --git a/buildSrc/src/test/java/org/springframework/boot/build/bom/BomPluginIntegrationTests.java b/buildSrc/src/test/java/org/springframework/boot/build/bom/BomPluginIntegrationTests.java index 075db3749a3..6bc78ebc584 100644 --- a/buildSrc/src/test/java/org/springframework/boot/build/bom/BomPluginIntegrationTests.java +++ b/buildSrc/src/test/java/org/springframework/boot/build/bom/BomPluginIntegrationTests.java @@ -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"); } diff --git a/buildSrc/src/test/java/org/springframework/boot/build/optional/OptionalDependenciesPluginIntegrationTests.java b/buildSrc/src/test/java/org/springframework/boot/build/optional/OptionalDependenciesPluginIntegrationTests.java index fa43a615d31..6f9afc4bf9c 100644 --- a/buildSrc/src/test/java/org/springframework/boot/build/optional/OptionalDependenciesPluginIntegrationTests.java +++ b/buildSrc/src/test/java/org/springframework/boot/build/optional/OptionalDependenciesPluginIntegrationTests.java @@ -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"); } diff --git a/buildSrc/src/test/java/org/springframework/boot/build/testing/TestFailuresPluginIntegrationTests.java b/buildSrc/src/test/java/org/springframework/boot/build/testing/TestFailuresPluginIntegrationTests.java index 38dd5b4de60..b0e11fbee55 100644 --- a/buildSrc/src/test/java/org/springframework/boot/build/testing/TestFailuresPluginIntegrationTests.java +++ b/buildSrc/src/test/java/org/springframework/boot/build/testing/TestFailuresPluginIntegrationTests.java @@ -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 { } @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 { } @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 { } @Test - void multiProjectParallel() throws IOException { + void multiProjectParallel() { createMultiProjectBuild(); BuildResult result = GradleRunner.create().withDebug(true).withProjectDir(this.projectDir) .withArguments("build", "--parallel", "--stacktrace").withPluginClasspath().buildAndFail(); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfiguration.java index 7af9e5f4e37..db9083f5fa0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfiguration.java @@ -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 { @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(); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java index dfa775a73fc..cf769a6ed21 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java +++ b/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 { 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 converter : BODY_CONVERTERS) { body = converter.apply(body); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java index db963815e54..798ff711899 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointSerializationTests.java @@ -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 { @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 { @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", diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java index c78cf732dc9..569d03e0738 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/HazelcastCacheConfiguration.java @@ -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 @@ 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; 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); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.java index 336b87c695c..1c1841a55a8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisEmbeddedServerConfiguration.java @@ -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 { @Bean(initMethod = "start", destroyMethod = "stop") @ConditionalOnMissingBean EmbeddedActiveMQ embeddedActiveMq(org.apache.activemq.artemis.core.config.Configuration configuration, - JMSConfiguration jmsConfiguration, ObjectProvider configurationCustomizers) - throws Exception { + JMSConfiguration jmsConfiguration, + ObjectProvider configurationCustomizers) { for (JMSQueueConfiguration queueConfiguration : jmsConfiguration.getQueueConfigurations()) { String queueName = queueConfiguration.getName(); configuration.addAddressConfiguration( diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java index 8abb907c1e6..fc3adccafc6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java @@ -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 { } } - private void importLdif(ApplicationContext applicationContext) throws LDAPException { + private void importLdif(ApplicationContext applicationContext) { String location = this.embeddedProperties.getLdif(); if (StringUtils.hasText(location)) { try { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java index 393494c0a23..45060c2870e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/jta/AtomikosJtaConfiguration.java @@ -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 { @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); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/Jetty10WebSocketServletWebServerCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/Jetty10WebSocketServletWebServerCustomizer.java index c378d6683d0..f8376cc07f1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/Jetty10WebSocketServletWebServerCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/servlet/Jetty10WebSocketServletWebServerCustomizer.java @@ -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 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); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceScriptDatabaseInitializerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceScriptDatabaseInitializerTests.java index 35548abe8bc..4ac56d5d18e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceScriptDatabaseInitializerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceScriptDatabaseInitializerTests.java @@ -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); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java index 5f0531971b2..f16b8324de5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jmx/ParentAwareNamingStrategyTests.java @@ -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 { 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 { } @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 { } @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 { } @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( diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java index 58959e3c7b7..da2c65f98d9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfigurationTests.java @@ -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)); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index ea1ede9841b..1fca027e6f8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -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 { } @Test - void tomcatMaxHttpPostSizeMatchesConnectorDefault() throws Exception { + void tomcatMaxHttpPostSizeMatchesConnectorDefault() { assertThat(this.properties.getTomcat().getMaxHttpFormPostSize().toBytes()) .isEqualTo(getDefaultConnector().getMaxPostSize()); } @@ -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()); } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/MavenResolverGrapeEngine.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/MavenResolverGrapeEngine.java index 575ebee0a56..f7b9621a01d 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/MavenResolverGrapeEngine.java +++ b/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; 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 { 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 { } } - private List resolve(List dependencies) throws ArtifactResolutionException { + private List resolve(List dependencies) { try { CollectRequest collectRequest = getCollectRequest(dependencies); DependencyRequest dependencyRequest = getDependencyRequest(collectRequest); diff --git a/spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java b/spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java index cfac1eb58d4..24c2f9434a9 100644 --- a/spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/intTest/java/org/springframework/boot/devtools/tests/DevToolsIntegrationTests.java @@ -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 @@ 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 { .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) }, diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java index 12d13cc640a..1ce4ea5bc85 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java @@ -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 { startServer(); } - void startServer() throws Exception { + void startServer() { if (this.server != null) { try { if (!this.server.isStarted()) { diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java index 1ce565362b6..28fff62bc54 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java @@ -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 { 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 { } } - 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 { } } - 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); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServerTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServerTests.java index dfae3b454ef..31e2376abae 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServerTests.java +++ b/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; class OptionalLiveReloadServerTests { @Test - void nullServer() throws Exception { + void nullServer() { OptionalLiveReloadServer server = new OptionalLiveReloadServer(null); server.startServer(); server.triggerReload(); diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java index 456b9539c2b..cd19dd5bbd5 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/RestarterTests.java @@ -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(); diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredrestclient/MyRestClientTests.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredrestclient/MyRestClientTests.java index 101250ccce1..90a1a82c2e4 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredrestclient/MyRestClientTests.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredrestclient/MyRestClientTests.java @@ -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 { 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"); diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredspringdatajpa/withoutdb/MyRepositoryTests.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredspringdatajpa/withoutdb/MyRepositoryTests.java index b122f1ac087..74205bc8a3d 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredspringdatajpa/withoutdb/MyRepositoryTests.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredspringdatajpa/withoutdb/MyRepositoryTests.java @@ -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 { 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"); diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredwebservices/server/ExampleEndpoint.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredwebservices/server/ExampleEndpoint.java index 82dda7cac16..56c7adfdcbe 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredwebservices/server/ExampleEndpoint.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/autoconfiguredwebservices/server/ExampleEndpoint.java @@ -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 { @PayloadRoot(localPart = "ExampleRequest") @ResponsePayload - public Source handleRequest() throws Exception { + public Source handleRequest() { return new StringSource("42"); } diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/jmx/MyJmxTests.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/jmx/MyJmxTests.java index ba544a77c2a..ede8846b379 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/jmx/MyJmxTests.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/jmx/MyJmxTests.java @@ -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 @@ 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 { private MBeanServer mBeanServer; @Test - void exampleTest() throws MalformedObjectNameException { + void exampleTest() { assertThat(this.mBeanServer.getDomains()).contains("java.lang"); // ... } diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/springwebfluxtests/MyControllerTests.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/springwebfluxtests/MyControllerTests.java index 914e4bcb056..fba3badfb0f 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/springwebfluxtests/MyControllerTests.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/springbootapplications/springwebfluxtests/MyControllerTests.java @@ -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 { private UserVehicleService userVehicleService; @Test - void testExample() throws Exception { + void testExample() { // @formatter:off given(this.userVehicleService.getVehicleDetails("sboot")) .willReturn(new VehicleDetails("Honda", "Civic")); diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/utilities/testresttemplate/MyTests.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/utilities/testresttemplate/MyTests.java index 04c9210217d..b8dd9378793 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/utilities/testresttemplate/MyTests.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/utilities/testresttemplate/MyTests.java @@ -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 { private TestRestTemplate template = new TestRestTemplate(); @Test - void testRequest() throws Exception { + void testRequest() { ResponseEntity headers = this.template.getForEntity("https://myhost.example.com/example", String.class); assertThat(headers.getHeaders().getLocation()).hasHost("other.example.com"); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestExecutionListener.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestExecutionListener.java index aca959aa393..c9760a5b96d 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestExecutionListener.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestExecutionListener.java @@ -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 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()); diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java index d21a8800307..93150cb23dd 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/SpringBootDependencyInjectionTestExecutionListenerTests.java @@ -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 { } @Test - void originalFailureIsThrownWhenReportGenerationFails() throws Exception { + void originalFailureIsThrownWhenReportGenerationFails() { TestContext testContext = mock(TestContext.class); IllegalStateException originalFailure = new IllegalStateException(); given(testContext.getTestInstance()).willThrow(originalFailure); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java index 42e0b425662..be4617f5b14 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/SpringBootContextLoaderTests.java @@ -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(); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java index d7f58040a31..1e0ded9aeb8 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java @@ -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 { private ExampleServiceCaller caller; @Test - void testMocking() throws Exception { + void testMocking() { given(this.exampleService.greeting()).willReturn("Boot"); assertThat(this.caller.sayGreeting()).isEqualTo("I say Boot"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java index a758fdb8c35..15ab29b8d2b 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests.java @@ -53,7 +53,7 @@ class SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests { private ApplicationContext applicationContext; @Test - void testMocking() throws Exception { + void testMocking() { this.caller.sayGreeting(); then(this.service).should().greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java index 875deecc1e9..57a9ac01283 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests.java @@ -47,7 +47,7 @@ class SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests { private ExampleServiceCaller caller; @Test - void testSpying() throws Exception { + void testSpying() { this.caller.sayGreeting(); then(this.exampleService).should().greeting(); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithJdkProxyTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithJdkProxyTests.java index 002ca14decd..6d3f9893c41 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithJdkProxyTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/SpyBeanWithJdkProxyTests.java @@ -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"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java index ef7711aef36..568ee4f1e57 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuildpackCoordinatesTests.java +++ b/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 @@ /* - * 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 { } @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 { } @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 { } @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 { } @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 { } @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'") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/FilePermissionsTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/FilePermissionsTests.java index a3bcbe21b2d..cb70a7dad4c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/io/FilePermissionsTests.java +++ b/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 @@ /* - * 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 { @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 { } @Test - void umaskForPathWithNullPath() throws IOException { + void umaskForPathWithNullPath() { assertThatIllegalArgumentException().isThrownBy(() -> FilePermissions.umaskForPath(null)); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java index 9e3abf6fe1a..cfd08488d08 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/ConfigurationMetadataRepositoryJsonBuilder.java @@ -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 { 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); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java index f40c04324ec..e5cced6a177 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java +++ b/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 { @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 { 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"); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java index 09c4e16757c..25806851a44 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/AbstractPackagerTests.java +++ b/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

{ protected TestJarFile testJarFile; @BeforeEach - void setup() throws IOException { + void setup() { this.testJarFile = new TestJarFile(this.tempDir); } @@ -628,7 +628,7 @@ abstract class AbstractPackagerTests

{ 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()); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java index d5d3c93ae82..f26dabbe2c6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/MainClassFinderTests.java @@ -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 @@ 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 { private TestJarFile testJarFile; @BeforeEach - void setup(@TempDir File tempDir) throws IOException { + void setup(@TempDir File tempDir) { this.testJarFile = new TestJarFile(tempDir); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java index 6bf63dc842c..2b3c73d22a9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java @@ -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 { private final List 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 { 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; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java index 32c274ba17a..b971b590abd 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryEndRecord.java @@ -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 { 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); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java index 9232fe6fbd8..52ac6e40720 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/JarIntegrationTests.java @@ -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 { } @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 sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api", "BOOT-INF/lib/spring-aop", diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java index 6efc9810fdb..bb215ec09ca 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java @@ -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 { } @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 sortedLibs = Arrays.asList( diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java index 2b4c99f38bf..16035801429 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java +++ b/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 { } } - 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 { } 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)); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java index 86bef74bf44..a254a9833cc 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java @@ -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 { 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()); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java index 3ed36e2d59b..b57637ff4b1 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java @@ -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; 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 { super.setManager(manager); } - void deferredLoadOnStartup() throws LifecycleException { + void deferredLoadOnStartup() { doWithThreadContextClassLoader(getLoader().getClassLoader(), () -> getLoadOnStartupWrappers(findChildren()).forEach(this::load)); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java index 2671b13e1ec..42b8eac0024 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationShutdownHookTests.java @@ -100,7 +100,7 @@ class SpringApplicationShutdownHookTests { } @Test - void runDueToExitDuringRefreshWhenContextHasBeenClosedDoesNotDeadlock() throws InterruptedException { + void runDueToExitDuringRefreshWhenContextHasBeenClosedDoesNotDeadlock() { GenericApplicationContext context = new GenericApplicationContext(); TestSpringApplicationShutdownHook shutdownHook = new TestSpringApplicationShutdownHook(); shutdownHook.registerApplicationContext(context); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java index 8c757ec386b..addb9efc579 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java @@ -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(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/DurationToStringConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/DurationToStringConverterTests.java index 19dd01effbe..a24400bf6b9 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/DurationToStringConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/DurationToStringConverterTests.java @@ -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 { assertThat(converted).isEqualTo("1s"); } - static Stream conversionServices() throws Exception { + static Stream conversionServices() { return ConversionServiceArguments.with(new DurationToStringConverter()); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/PeriodToStringConverterTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/PeriodToStringConverterTests.java index 96d37d0a969..6470c84f151 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/PeriodToStringConverterTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/convert/PeriodToStringConverterTests.java @@ -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 { assertThat(converted).isEqualTo("371d"); } - static Stream conversionServices() throws Exception { + static Stream conversionServices() { return ConversionServiceArguments.with(new PeriodToStringConverter()); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java index 3324acb5711..5be9489dbad 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzerTests.java @@ -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 { } @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"); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java index 468209c8cd0..0fb4f517d88 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java +++ b/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; 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 } @Test - void nonExistentUploadDirectoryIsCreatedUponMultipartUpload() throws IOException, URISyntaxException { + void nonExistentUploadDirectoryIsCreatedUponMultipartUpload() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0); AtomicReference servletContextReference = new AtomicReference<>(); factory.addInitializers((servletContext) -> { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java index ad0b5f098d2..893ea0dfc24 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java @@ -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; 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 { } @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 { } @Test - protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed() - throws InterruptedException, ExecutionException, IOException { + protected void whenHttp2IsEnabledAndSslIsDisabledThenHttp11CanStillBeUsed() { AbstractReactiveWebServerFactory factory = getFactory(); Http2 http2 = new Http2(); http2.setEnabled(true); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java index 37b3ea74c45..e1c39b5ad6e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java @@ -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 { } @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 { } @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 { } @Test - void whenARequestIsActiveAfterGracefulShutdownEndsThenStopWillComplete() - throws InterruptedException, BrokenBarrierException { + void whenARequestIsActiveAfterGracefulShutdownEndsThenStopWillComplete() throws InterruptedException { AbstractServletWebServerFactory factory = getFactory(); factory.setShutdown(Shutdown.GRACEFUL); BlockingServlet blockingServlet = new BlockingServlet(); diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/ChatService.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/ChatService.java index 2dbb3229cd7..4a522045936 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/ChatService.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/ChatService.java @@ -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 { @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; } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/SampleAtmosphereApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/SampleAtmosphereApplication.java index cdb3d7435bb..d4fbdee2329 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/SampleAtmosphereApplication.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-atmosphere/src/main/java/smoketest/atmosphere/SampleAtmosphereApplication.java @@ -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 { return registration; } - public static void main(String[] args) throws Exception { + public static void main(String[] args) { SpringApplication.run(SampleAtmosphereApplication.class, args); } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-batch/src/main/java/smoketest/batch/SampleBatchApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-batch/src/main/java/smoketest/batch/SampleBatchApplication.java index cba6e41a2b1..9e6507cd462 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-batch/src/main/java/smoketest/batch/SampleBatchApplication.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-batch/src/main/java/smoketest/batch/SampleBatchApplication.java @@ -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 { } @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(); } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/main/java/smoketest/parent/SampleParentContextApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/main/java/smoketest/parent/SampleParentContextApplication.java index a7157b793ec..34af61a72ee 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/main/java/smoketest/parent/SampleParentContextApplication.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/main/java/smoketest/parent/SampleParentContextApplication.java @@ -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; @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); } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/SampleIntegrationParentApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/SampleIntegrationParentApplicationTests.java index 4fde078b592..b918d093b10 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-parent-context/src/test/java/smoketest/parent/consumer/SampleIntegrationParentApplicationTests.java +++ b/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 @@ /* - * 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; 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, diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/CorsSampleActuatorApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/CorsSampleActuatorApplicationTests.java index 880413cd52b..f898c6f2fdb 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-secure-webflux/src/test/java/smoketest/secure/webflux/CorsSampleActuatorApplicationTests.java +++ b/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 @@ /* - * 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 { } @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(); } diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-method-security/src/main/java/smoketest/security/method/SampleMethodSecurityApplication.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-method-security/src/main/java/smoketest/security/method/SampleMethodSecurityApplication.java index 5488198ccb9..2f77338b652 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-web-method-security/src/main/java/smoketest/security/method/SampleMethodSecurityApplication.java +++ b/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 @@ /* - * 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 { @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(), diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java index bd6b8625778..a00f4d0f78d 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-webservices/src/main/java/smoketest/webservices/endpoint/HolidayEndpoint.java @@ -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; 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 { 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(); diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/snake/SnakeTimer.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/snake/SnakeTimer.java index fac7fda4400..2a8924fcbd4 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty/src/main/java/smoketest/websocket/jetty/snake/SnakeTimer.java +++ b/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 { broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString())); } - public static void broadcast(String message) throws Exception { + public static void broadcast(String message) { Collection snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes()); for (Snake snake : snakes) { try { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty10/src/main/java/smoketest/websocket/jetty10/snake/SnakeTimer.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty10/src/main/java/smoketest/websocket/jetty10/snake/SnakeTimer.java index c140a4703b8..fba04c5671f 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-jetty10/src/main/java/smoketest/websocket/jetty10/snake/SnakeTimer.java +++ b/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 @@ /* - * 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 { broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString())); } - public static void broadcast(String message) throws Exception { + public static void broadcast(String message) { Collection snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes()); for (Snake snake : snakes) { try { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/snake/SnakeTimer.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/snake/SnakeTimer.java index 869d8b24142..82be974569e 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-tomcat/src/main/java/smoketest/websocket/tomcat/snake/SnakeTimer.java +++ b/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 { broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString())); } - public static void broadcast(String message) throws Exception { + public static void broadcast(String message) { Collection snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes()); for (Snake snake : snakes) { try { diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/snake/SnakeTimer.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/snake/SnakeTimer.java index c30b276ed10..1b044c018be 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-websocket-undertow/src/main/java/smoketest/websocket/undertow/snake/SnakeTimer.java +++ b/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 { broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString())); } - public static void broadcast(String message) throws Exception { + public static void broadcast(String message) { Collection snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes()); for (Snake snake : snakes) { try {