mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Remove redundant throws declarations from internal APIs
Closes gh-31176
This commit is contained in:
parent
cbf42dea14
commit
ee45fd2fc8
@ -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<String> prohibited = this.classpath.getResolvedConfiguration().getResolvedArtifacts().stream()
|
||||
.map((artifact) -> artifact.getModuleVersion().getId()).filter(this::prohibited)
|
||||
.map((id) -> id.getGroup() + ":" + id.getName()).collect(Collectors.toCollection(TreeSet::new));
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -240,21 +240,16 @@ public class JerseyEndpointResourceFactory {
|
||||
Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT;
|
||||
return Response.status(status).build();
|
||||
}
|
||||
try {
|
||||
if (!(response instanceof WebEndpointResponse)) {
|
||||
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
|
||||
}
|
||||
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
|
||||
return Response.status(webEndpointResponse.getStatus())
|
||||
.header("Content-Type", webEndpointResponse.getContentType())
|
||||
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
|
||||
if (!(response instanceof WebEndpointResponse)) {
|
||||
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
|
||||
}
|
||||
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
|
||||
return Response.status(webEndpointResponse.getStatus())
|
||||
.header("Content-Type", webEndpointResponse.getContentType())
|
||||
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
|
||||
}
|
||||
|
||||
private Object convertIfNecessary(Object body) throws IOException {
|
||||
private Object convertIfNecessary(Object body) {
|
||||
for (Function<Object, Object> converter : BODY_CONVERTERS) {
|
||||
body = converter.apply(body);
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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(
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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(
|
||||
|
@ -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));
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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<File> resolve(List<Dependency> dependencies) throws ArtifactResolutionException {
|
||||
private List<File> resolve(List<Dependency> dependencies) {
|
||||
try {
|
||||
CollectRequest collectRequest = getCollectRequest(dependencies);
|
||||
DependencyRequest dependencyRequest = getDependencyRequest(collectRequest);
|
||||
|
@ -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) },
|
||||
|
@ -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()) {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
|
@ -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("<ExampleResponse>42</ExampleResponse>");
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
// ...
|
||||
}
|
||||
|
@ -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"));
|
||||
|
@ -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<String> headers = this.template.getForEntity("https://myhost.example.com/example", String.class);
|
||||
assertThat(headers.getHeaders().getLocation()).hasHost("other.example.com");
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class SpyBeanOnTestFieldForExistingBeanWithQualifierIntegrationTests {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Test
|
||||
void testMocking() throws Exception {
|
||||
void testMocking() {
|
||||
this.caller.sayGreeting();
|
||||
then(this.service).should().greeting();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class SpyBeanWithDirtiesContextClassModeBeforeMethodIntegrationTests {
|
||||
private ExampleServiceCaller caller;
|
||||
|
||||
@Test
|
||||
void testSpying() throws Exception {
|
||||
void testSpying() {
|
||||
this.caller.sayGreeting();
|
||||
then(this.exampleService).should().greeting();
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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'")
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -112,16 +112,11 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
||||
|
||||
@BeforeEach
|
||||
void createTask() {
|
||||
try {
|
||||
File projectDir = new File(this.temp, "project");
|
||||
projectDir.mkdirs();
|
||||
this.project = GradleProjectBuilder.builder().withProjectDir(projectDir).build();
|
||||
this.project.setDescription("Test project for " + this.taskClass.getSimpleName());
|
||||
this.task = configure(this.project.getTasks().create("testArchive", this.taskClass));
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
File projectDir = new File(this.temp, "project");
|
||||
projectDir.mkdirs();
|
||||
this.project = GradleProjectBuilder.builder().withProjectDir(projectDir).build();
|
||||
this.project.setDescription("Test project for " + this.taskClass.getSimpleName());
|
||||
this.task = configure(this.project.getTasks().create("testArchive", this.taskClass));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -586,7 +581,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
||||
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");
|
||||
|
@ -92,7 +92,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
|
||||
protected TestJarFile testJarFile;
|
||||
|
||||
@BeforeEach
|
||||
void setup() throws IOException {
|
||||
void setup() {
|
||||
this.testJarFile = new TestJarFile(this.tempDir);
|
||||
}
|
||||
|
||||
@ -628,7 +628,7 @@ abstract class AbstractPackagerTests<P extends Packager> {
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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<ZipEntrySource> entries = new ArrayList<>();
|
||||
|
||||
public TestJarFile(File temporaryDirectory) throws IOException {
|
||||
public TestJarFile(File temporaryDirectory) {
|
||||
this.temporaryDirectory = temporaryDirectory;
|
||||
this.jarSource = new File(temporaryDirectory, "jar-source");
|
||||
}
|
||||
@ -115,11 +115,11 @@ public class TestJarFile {
|
||||
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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<String> sortedLibs = Arrays.asList("BOOT-INF/lib/jakarta.servlet-api", "BOOT-INF/lib/spring-aop",
|
||||
|
@ -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<String> sortedLibs = Arrays.asList(
|
||||
|
@ -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));
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class SpringApplicationShutdownHookTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void runDueToExitDuringRefreshWhenContextHasBeenClosedDoesNotDeadlock() throws InterruptedException {
|
||||
void runDueToExitDuringRefreshWhenContextHasBeenClosedDoesNotDeadlock() {
|
||||
GenericApplicationContext context = new GenericApplicationContext();
|
||||
TestSpringApplicationShutdownHook shutdownHook = new TestSpringApplicationShutdownHook();
|
||||
shutdownHook.registerApplicationContext(context);
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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<? extends Arguments> conversionServices() throws Exception {
|
||||
static Stream<? extends Arguments> conversionServices() {
|
||||
return ConversionServiceArguments.with(new DurationToStringConverter());
|
||||
}
|
||||
|
||||
|
@ -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<? extends Arguments> conversionServices() throws Exception {
|
||||
static Stream<? extends Arguments> conversionServices() {
|
||||
return ConversionServiceArguments.with(new PeriodToStringConverter());
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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<ServletContext> servletContextReference = new AtomicReference<>();
|
||||
factory.addInitializers((servletContext) -> {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -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();
|
||||
|
@ -80,7 +80,7 @@ public final class SnakeTimer {
|
||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
||||
}
|
||||
|
||||
public static void broadcast(String message) throws Exception {
|
||||
public static void broadcast(String message) {
|
||||
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
||||
for (Snake snake : snakes) {
|
||||
try {
|
||||
|
@ -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<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
||||
for (Snake snake : snakes) {
|
||||
try {
|
||||
|
@ -80,7 +80,7 @@ public final class SnakeTimer {
|
||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
||||
}
|
||||
|
||||
public static void broadcast(String message) throws Exception {
|
||||
public static void broadcast(String message) {
|
||||
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
||||
for (Snake snake : snakes) {
|
||||
try {
|
||||
|
@ -80,7 +80,7 @@ public final class SnakeTimer {
|
||||
broadcast(String.format("{'type': 'update', 'data' : [%s]}", sb.toString()));
|
||||
}
|
||||
|
||||
public static void broadcast(String message) throws Exception {
|
||||
public static void broadcast(String message) {
|
||||
Collection<Snake> snakes = new CopyOnWriteArrayList<>(SnakeTimer.getSnakes());
|
||||
for (Snake snake : snakes) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user