Remove redundant throws declarations from internal APIs

Closes gh-31176
This commit is contained in:
Andy Wilkinson
2022-05-26 14:24:55 +01:00
parent cbf42dea14
commit ee45fd2fc8
69 changed files with 157 additions and 193 deletions

View File

@@ -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);
}

View File

@@ -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<ArtemisConfigurationCustomizer> configurationCustomizers)
throws Exception {
JMSConfiguration jmsConfiguration,
ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers) {
for (JMSQueueConfiguration queueConfiguration : jmsConfiguration.getQueueConfigurations()) {
String queueName = queueConfiguration.getName();
configuration.addAddressConfiguration(

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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(

View File

@@ -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));

View File

@@ -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());
}