Merge pull request #25986 from dreis2211

* pr/25986:
  Update copyright year of changed file
  Remove unused method parameters

Closes gh-25986
pull/26041/head
Stephane Nicoll 4 years ago
commit b9bfc1523f

@ -1,5 +1,5 @@
/*
* Copyright 2019-2021 the original author or authors.
* Copyright 2012-2021 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.
@ -110,7 +110,7 @@ class AsciidoctorConventions {
asciidoctorTask.baseDirFollowsSourceDir();
createSyncDocumentationSourceTask(project, asciidoctorTask);
if (asciidoctorTask instanceof AsciidoctorTask) {
configureAsciidoctorHtmlTask(project, (AsciidoctorTask) asciidoctorTask);
configureAsciidoctorHtmlTask((AsciidoctorTask) asciidoctorTask);
}
}
@ -144,7 +144,7 @@ class AsciidoctorConventions {
return syncDocumentationSource;
}
private void configureAsciidoctorHtmlTask(Project project, AsciidoctorTask asciidoctorTask) {
private void configureAsciidoctorHtmlTask(AsciidoctorTask asciidoctorTask) {
asciidoctorTask.outputOptions((outputOptions) -> outputOptions.backends("spring-html"));
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -22,6 +22,7 @@ import org.gradle.api.attributes.Usage;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.publish.PublishingExtension;
import org.gradle.api.publish.VariantVersionMappingStrategy;
import org.gradle.api.publish.maven.MavenPom;
import org.gradle.api.publish.maven.MavenPomDeveloperSpec;
import org.gradle.api.publish.maven.MavenPomIssueManagement;
@ -78,8 +79,7 @@ class MavenPublishingConventions {
private void customizeMavenPublication(MavenPublication publication, Project project) {
customizePom(publication.getPom(), project);
project.getPlugins().withType(JavaPlugin.class)
.all((javaPlugin) -> customizeJavaMavenPublication(publication, project));
project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> customizeJavaMavenPublication(publication));
}
private void customizePom(MavenPom pom, Project project) {
@ -97,11 +97,11 @@ class MavenPublishingConventions {
}
}
private void customizeJavaMavenPublication(MavenPublication publication, Project project) {
private void customizeJavaMavenPublication(MavenPublication publication) {
publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_API, (mappingStrategy) -> mappingStrategy
.fromResolutionOf(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME)));
publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_RUNTIME,
(mappingStrategy) -> mappingStrategy.fromResolutionResult()));
publication.versionMapping(
(strategy) -> strategy.usage(Usage.JAVA_RUNTIME, VariantVersionMappingStrategy::fromResolutionResult));
}
private void customizeOrganization(MavenPomOrganization organization) {

@ -49,7 +49,6 @@ import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.DependsOn;
import org.springframework.core.env.Environment;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
import org.springframework.util.StringUtils;
@ -63,8 +62,7 @@ import org.springframework.util.StringUtils;
@Deprecated
class DataSourceInitializationConfiguration {
private static DataSource determineDataSource(Supplier<DataSource> dataSource, String username, String password,
DataSourceProperties properties) {
private static DataSource determineDataSource(Supplier<DataSource> dataSource, String username, String password) {
if (StringUtils.hasText(username) && StringUtils.hasText(password)) {
DataSourceBuilder.derivedFrom(dataSource.get()).type(SimpleDriverDataSource.class).username(username)
.password(password).build();
@ -92,14 +90,14 @@ class DataSourceInitializationConfiguration {
@Bean
DataSourceScriptDatabaseInitializer ddlOnlyScriptDataSourceInitializer(ObjectProvider<DataSource> dataSource,
DataSourceProperties properties, ResourceLoader resourceLoader) {
DataSourceProperties properties) {
DatabaseInitializationSettings settings = new DatabaseInitializationSettings();
settings.setSchemaLocations(scriptLocations(properties.getSchema(), "schema", properties.getPlatform()));
settings.setContinueOnError(properties.isContinueOnError());
settings.setSeparator(properties.getSeparator());
settings.setEncoding(properties.getSqlScriptEncoding());
DataSource initializationDataSource = determineDataSource(dataSource::getObject,
properties.getSchemaUsername(), properties.getSchemaPassword(), properties);
properties.getSchemaUsername(), properties.getSchemaPassword());
return new InitializationModeDataSourceScriptDatabaseInitializer(initializationDataSource, settings,
properties.getInitializationMode());
}
@ -107,14 +105,14 @@ class DataSourceInitializationConfiguration {
@Bean
@DependsOn("ddlOnlyScriptDataSourceInitializer")
DataSourceScriptDatabaseInitializer dmlOnlyScriptDataSourceInitializer(ObjectProvider<DataSource> dataSource,
DataSourceProperties properties, ResourceLoader resourceLoader) {
DataSourceProperties properties) {
DatabaseInitializationSettings settings = new DatabaseInitializationSettings();
settings.setDataLocations(scriptLocations(properties.getData(), "data", properties.getPlatform()));
settings.setContinueOnError(properties.isContinueOnError());
settings.setSeparator(properties.getSeparator());
settings.setEncoding(properties.getSqlScriptEncoding());
DataSource initializationDataSource = determineDataSource(dataSource::getObject,
properties.getDataUsername(), properties.getDataPassword(), properties);
properties.getDataUsername(), properties.getDataPassword());
return new InitializationModeDataSourceScriptDatabaseInitializer(initializationDataSource, settings,
properties.getInitializationMode());
}
@ -149,7 +147,7 @@ class DataSourceInitializationConfiguration {
@Bean
DataSourceScriptDatabaseInitializer scriptDataSourceInitializer(DataSource dataSource,
DataSourceProperties properties, ResourceLoader resourceLoader) {
DataSourceProperties properties) {
DatabaseInitializationSettings settings = new DatabaseInitializationSettings();
settings.setSchemaLocations(scriptLocations(properties.getSchema(), "schema", properties.getPlatform()));
settings.setDataLocations(scriptLocations(properties.getData(), "data", properties.getPlatform()));

@ -217,7 +217,7 @@ class ConfigDataEnvironmentContributors implements Iterable<ConfigDataEnvironmen
private Binder getBinder(ConfigDataActivationContext activationContext,
Predicate<ConfigDataEnvironmentContributor> filter, Set<BinderOption> options) {
boolean failOnInactiveSource = options.contains(BinderOption.FAIL_ON_BIND_TO_INACTIVE_SOURCE);
Iterable<ConfigurationPropertySource> sources = () -> getBinderSources(activationContext,
Iterable<ConfigurationPropertySource> sources = () -> getBinderSources(
filter.and((contributor) -> failOnInactiveSource || contributor.isActive(activationContext)));
PlaceholdersResolver placeholdersResolver = new ConfigDataEnvironmentContributorPlaceholdersResolver(this.root,
activationContext, failOnInactiveSource);
@ -225,8 +225,7 @@ class ConfigDataEnvironmentContributors implements Iterable<ConfigDataEnvironmen
return new Binder(sources, placeholdersResolver, null, null, bindHandler);
}
private Iterator<ConfigurationPropertySource> getBinderSources(ConfigDataActivationContext activationContext,
Predicate<ConfigDataEnvironmentContributor> filter) {
private Iterator<ConfigurationPropertySource> getBinderSources(Predicate<ConfigDataEnvironmentContributor> filter) {
return this.root.stream().filter(this::hasConfigurationPropertySource).filter(filter)
.map(ConfigDataEnvironmentContributor::getConfigurationPropertySource).iterator();
}

@ -57,11 +57,6 @@ class ConfigDataProperties {
* @param activate the activate properties
*/
ConfigDataProperties(@Name("import") List<ConfigDataLocation> imports, Activate activate) {
this(imports, activate, Collections.emptyList());
}
private ConfigDataProperties(List<ConfigDataLocation> imports, Activate activate,
List<ConfigurationProperty> boundProperties) {
this.imports = (imports != null) ? imports : Collections.emptyList();
this.activate = activate;
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -52,15 +52,14 @@ public class ConfigTreeConfigDataLocationResolver implements ConfigDataLocationR
public List<ConfigTreeConfigDataResource> resolve(ConfigDataLocationResolverContext context,
ConfigDataLocation location) {
try {
return resolve(context, location.getNonPrefixedValue(PREFIX));
return resolve(location.getNonPrefixedValue(PREFIX));
}
catch (IOException ex) {
throw new ConfigDataLocationNotFoundException(location, ex);
}
}
private List<ConfigTreeConfigDataResource> resolve(ConfigDataLocationResolverContext context, String location)
throws IOException {
private List<ConfigTreeConfigDataResource> resolve(String location) throws IOException {
Assert.isTrue(location.endsWith("/"),
() -> String.format("Config tree location '%s' must end with '/'", location));
if (!this.resourceLoader.isPattern(location)) {

@ -753,7 +753,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
ElementType[] type = new ElementType[size];
System.arraycopy(this.type, 0, type, 0, this.size);
System.arraycopy(additional.type, 0, type, this.size, additional.size);
CharSequence[] resolved = newResolved(0, size);
CharSequence[] resolved = newResolved(size);
for (int i = 0; i < additional.size; i++) {
resolved[this.size + i] = additional.get(i);
}
@ -761,13 +761,13 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
}
Elements chop(int size) {
CharSequence[] resolved = newResolved(0, size);
CharSequence[] resolved = newResolved(size);
return new Elements(this.source, size, this.start, this.end, this.type, resolved);
}
Elements subElements(int offset) {
int size = this.size - offset;
CharSequence[] resolved = newResolved(offset, size);
CharSequence[] resolved = newResolved(size);
int[] start = new int[size];
System.arraycopy(this.start, offset, start, 0, size);
int[] end = new int[size];
@ -777,7 +777,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
return new Elements(this.source, size, start, end, type, resolved);
}
private CharSequence[] newResolved(int offset, int size) {
private CharSequence[] newResolved(int size) {
CharSequence[] resolved = new CharSequence[size];
if (this.resolved != null) {
System.arraycopy(this.resolved, 0, resolved, 0, Math.min(size, this.size));

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -86,10 +86,10 @@ public class EnvironmentPostProcessorApplicationListener implements SmartApplica
onApplicationEnvironmentPreparedEvent((ApplicationEnvironmentPreparedEvent) event);
}
if (event instanceof ApplicationPreparedEvent) {
onApplicationPreparedEvent((ApplicationPreparedEvent) event);
onApplicationPreparedEvent();
}
if (event instanceof ApplicationFailedEvent) {
onApplicationFailedEvent((ApplicationFailedEvent) event);
onApplicationFailedEvent();
}
}
@ -101,11 +101,11 @@ public class EnvironmentPostProcessorApplicationListener implements SmartApplica
}
}
private void onApplicationPreparedEvent(ApplicationPreparedEvent event) {
private void onApplicationPreparedEvent() {
finish();
}
private void onApplicationFailedEvent(ApplicationFailedEvent event) {
private void onApplicationFailedEvent() {
finish();
}

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -29,7 +29,6 @@ import ch.qos.logback.core.util.FileSize;
import ch.qos.logback.core.util.OptionHelper;
import org.springframework.boot.logging.LogFile;
import org.springframework.boot.logging.LoggingInitializationContext;
/**
* Default logback configuration used by Spring Boot. Uses {@link LogbackConfigurator} to
@ -46,7 +45,7 @@ class DefaultLogbackConfiguration {
private final LogFile logFile;
DefaultLogbackConfiguration(LoggingInitializationContext initializationContext, LogFile logFile) {
DefaultLogbackConfiguration(LogFile logFile) {
this.logFile = logFile;
}
@ -106,13 +105,12 @@ class DefaultLogbackConfiguration {
appender.setEncoder(encoder);
config.start(encoder);
appender.setFile(logFile);
setRollingPolicy(appender, config, logFile);
setRollingPolicy(appender, config);
config.appender("FILE", appender);
return appender;
}
private void setRollingPolicy(RollingFileAppender<ILoggingEvent> appender, LogbackConfigurator config,
String logFile) {
private void setRollingPolicy(RollingFileAppender<ILoggingEvent> appender, LogbackConfigurator config) {
SizeAndTimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new SizeAndTimeBasedRollingPolicy<>();
rollingPolicy.setContext(config.getContext());
rollingPolicy.setFileNamePattern(

@ -151,7 +151,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
new LogbackLoggingSystemProperties(environment, context::putProperty).apply(logFile);
LogbackConfigurator configurator = debug ? new DebugLogbackConfigurator(context)
: new LogbackConfigurator(context);
new DefaultLogbackConfiguration(initializationContext, logFile).apply(configurator);
new DefaultLogbackConfiguration(logFile).apply(configurator);
context.setPackagingDataEnabled(true);
}

Loading…
Cancel
Save