From cddd794a071bc89a148be9eacd8782b4dc24ba95 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 27 Jul 2018 12:50:23 +0100 Subject: [PATCH 1/5] Polish --- .../tasks/buildinfo/BuildInfoProperties.java | 67 +++++-------------- .../tasks/bundling/BootZipCopyAction.java | 1 - .../bundling/LaunchScriptConfiguration.java | 5 +- 3 files changed, 18 insertions(+), 55 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java index 850ce266c81..d335f2209b3 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java @@ -182,62 +182,29 @@ public class BuildInfoProperties implements Serializable { if (this == obj) { return true; } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { + if (obj == null || getClass() != obj.getClass()) { return false; } BuildInfoProperties other = (BuildInfoProperties) obj; - if (this.additionalProperties == null) { - if (other.additionalProperties != null) { - return false; - } + boolean result = true; + result = result + && nullSafeEquals(this.additionalProperties, other.additionalProperties); + result = result && nullSafeEquals(this.artifact, other.artifact); + result = result && nullSafeEquals(this.group, other.group); + result = result && nullSafeEquals(this.name, other.name); + result = result && nullSafeEquals(this.version, other.version); + result = result && nullSafeEquals(this.time, other.time); + return result; + } + + private boolean nullSafeEquals(Object o1, Object o2) { + if (o1 == o2) { + return true; } - else if (!this.additionalProperties.equals(other.additionalProperties)) { + if (o1 == null || o2 == null) { return false; } - if (this.artifact == null) { - if (other.artifact != null) { - return false; - } - } - else if (!this.artifact.equals(other.artifact)) { - return false; - } - if (this.group == null) { - if (other.group != null) { - return false; - } - } - else if (!this.group.equals(other.group)) { - return false; - } - if (this.name == null) { - if (other.name != null) { - return false; - } - } - else if (!this.name.equals(other.name)) { - return false; - } - if (this.version == null) { - if (other.version != null) { - return false; - } - } - else if (!this.version.equals(other.version)) { - return false; - } - if (this.time == null) { - if (other.time != null) { - return false; - } - } - else if (!this.time.equals(other.time)) { - return false; - } - return true; + return (o1.equals(o2)); } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java index c2166fd8c59..ea4b10259e6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java @@ -119,7 +119,6 @@ class BootZipCopyAction implements CopyAction { return () -> true; } - @SuppressWarnings("unchecked") private Spec createExclusionSpec( Spec loaderEntries) { return Specs.union(loaderEntries, this.exclusions); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java index 4152e2a8c14..f42ce7a0ca5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java @@ -88,10 +88,7 @@ public class LaunchScriptConfiguration implements Serializable { if (this == obj) { return true; } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { + if (obj == null || getClass() != obj.getClass()) { return false; } LaunchScriptConfiguration other = (LaunchScriptConfiguration) obj; From ec1100a8960c19a05e55efed6256af022f3c38c5 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 27 Jul 2018 20:58:53 +0100 Subject: [PATCH 2/5] Upgrade to spring-javaformat 0.0.6 Closes gh-13932 --- pom.xml | 4 ++-- .../spring-boot-gradle-plugin/build.gradle | 21 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 8590fb9bf47..838de708a93 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ - 0.0.3 + 0.0.6 @@ -36,7 +36,7 @@ com.puppycrawl.tools checkstyle - 8.8 + 8.11 io.spring.javaformat diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle index 939c79c4aab..10341c0d21e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle @@ -1,8 +1,20 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + } + dependencies { + classpath("io.spring.javaformat:spring-javaformat-gradle-plugin:0.0.6") + } +} + plugins { id 'java' id 'eclipse' } +apply plugin: 'io.spring.javaformat' + repositories { mavenLocal() mavenCentral() @@ -29,15 +41,6 @@ test { } } -eclipseJdt { - inputFile = rootProject.file('../../../eclipse/org.eclipse.jdt.core.prefs') - doLast { - project.file('.settings/org.eclipse.jdt.ui.prefs').withWriter { writer -> - writer << file('../../../eclipse/org.eclipse.jdt.ui.prefs').text - } - } -} - javadoc { options { author() From 7fc455654a19c3a988c6ca2116ce04001163adb4 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 27 Jul 2018 22:54:20 +0100 Subject: [PATCH 3/5] Fix checkstyle ternary issues Fix checkstyle issues with ternary expressions following the spring-javaformat upgrade. See gh-13932 --- .../CloudFoundryWebEndpointDiscoverer.java | 2 +- ...CloudFoundryActuatorAutoConfiguration.java | 4 ++-- ...CloudFoundryActuatorAutoConfiguration.java | 4 ++-- .../condition/ConditionsReportEndpoint.java | 4 ++-- ...earchHealthIndicatorAutoConfiguration.java | 2 +- ...ourceHealthIndicatorAutoConfiguration.java | 2 +- .../metrics/MeterRegistryConfigurer.java | 6 ++--- .../metrics/PropertiesMeterFilter.java | 6 ++--- .../properties/PropertiesConfigAdapter.java | 2 +- .../WavefrontPropertiesConfigAdapter.java | 2 +- .../TomcatMetricsAutoConfiguration.java | 3 ++- ...entContextConfigurationImportSelector.java | 10 ++++---- .../web/server/ManagementPortType.java | 6 ++--- .../servlet/MockServletWebServerFactory.java | 10 ++++---- .../boot/actuate/audit/AuditEvent.java | 2 +- .../actuate/audit/AuditEventsEndpoint.java | 2 +- .../boot/actuate/beans/BeansEndpoint.java | 2 +- ...ConfigurationPropertiesReportEndpoint.java | 2 +- .../ElasticsearchHealthIndicator.java | 2 +- .../JacksonJmxOperationResponseMapper.java | 2 +- .../endpoint/web/PathMappedEndpoints.java | 8 +++---- .../web/ServletEndpointRegistrar.java | 2 +- .../jersey/JerseyEndpointResourceFactory.java | 2 +- ...AbstractWebFluxEndpointHandlerMapping.java | 4 ++-- .../AbstractWebMvcEndpointHandlerMapping.java | 4 ++-- .../boot/actuate/env/EnvironmentEndpoint.java | 2 +- .../boot/actuate/flyway/FlywayEndpoint.java | 4 ++-- .../CompositeReactiveHealthIndicator.java | 8 +++---- .../health/OrderedHealthAggregator.java | 4 ++-- .../jdbc/DataSourceHealthIndicator.java | 2 +- .../actuate/liquibase/LiquibaseEndpoint.java | 4 ++-- .../boot/actuate/logging/LoggersEndpoint.java | 4 ++-- .../management/HeapDumpWebEndpoint.java | 2 +- .../actuate/metrics/amqp/RabbitMetrics.java | 2 +- .../web/client/RestTemplateExchangeTags.java | 2 +- .../metrics/web/servlet/WebMvcTags.java | 6 ++--- .../actuate/solr/SolrHealthIndicator.java | 2 +- .../web/mappings/MappingsEndpoint.java | 2 +- .../DispatcherServletHandlerMappings.java | 2 +- .../trace/reactive/HttpTraceWebFilter.java | 10 ++++---- .../ServerWebExchangeTraceableRequest.java | 4 ++-- .../reactive/TraceableServerHttpResponse.java | 4 ++-- .../web/trace/servlet/HttpTraceFilter.java | 4 ++-- ...gurationPropertiesReportEndpointTests.java | 2 +- .../ReflectiveOperationInvokerTests.java | 4 ++-- .../jmx/JmxEndpointExporterTests.java | 4 ++-- .../endpoint/jmx/TestJmxOperation.java | 4 ++-- .../AbstractWebEndpointIntegrationTests.java | 4 ++-- .../trace/http/HttpExchangeTracerTests.java | 2 +- .../AutoConfigurationImportSelector.java | 4 ++-- .../AutoConfigurationMetadataLoader.java | 14 +++++------ .../AutoConfigurationSorter.java | 4 ++-- ...ImportAutoConfigurationImportSelector.java | 4 ++-- ...bitListenerContainerFactoryConfigurer.java | 4 ++-- .../amqp/RabbitAutoConfiguration.java | 2 +- .../autoconfigure/amqp/RabbitProperties.java | 6 ++--- .../cache/CacheManagerCustomizers.java | 4 ++-- .../condition/AbstractNestedCondition.java | 4 ++-- ...ReportAutoConfigurationImportListener.java | 6 ++--- .../condition/ConditionMessage.java | 6 ++--- .../condition/ConditionOutcome.java | 4 ++-- .../condition/OnBeanCondition.java | 2 +- .../condition/OnJavaCondition.java | 4 ++-- .../condition/OnPropertyCondition.java | 2 +- .../condition/OnResourceCondition.java | 6 ++--- .../couchbase/CouchbaseAutoConfiguration.java | 2 +- .../couchbase/CouchbaseProperties.java | 4 ++-- .../NoSuchBeanDefinitionFailureAnalyzer.java | 15 ++++++------ .../flyway/FlywayAutoConfiguration.java | 2 +- .../flyway/FlywayProperties.java | 2 +- .../http/HttpEncodingProperties.java | 4 ++-- ...ttpMessageConvertersAutoConfiguration.java | 4 ++-- .../info/ProjectInfoAutoConfiguration.java | 4 ++-- .../jdbc/DataSourceAutoConfiguration.java | 4 ++-- .../jdbc/DataSourceInitializer.java | 4 ++-- .../jdbc/DataSourceProperties.java | 4 ++-- .../boot/autoconfigure/jms/JmsProperties.java | 6 ++--- .../ActiveMQConnectionFactoryFactory.java | 4 ++-- .../liquibase/LiquibaseAutoConfiguration.java | 2 +- .../mongo/MongoClientFactory.java | 10 ++++---- .../autoconfigure/mongo/MongoProperties.java | 4 ++-- .../mongo/ReactiveMongoClientFactory.java | 14 +++++------ .../EmbeddedMongoAutoConfiguration.java | 15 ++++++------ .../jpa/DataSourceInitializedPublisher.java | 4 ++-- .../orm/jpa/HibernateSettings.java | 2 +- .../autoconfigure/orm/jpa/JpaProperties.java | 2 +- .../quartz/QuartzAutoConfiguration.java | 2 +- ...h2ClientPropertiesRegistrationAdapter.java | 10 ++++---- .../session/SessionStoreMappings.java | 2 +- .../AbstractViewResolverProperties.java | 4 ++-- .../TemplateAvailabilityProviders.java | 8 +++---- .../TransactionManagerCustomizers.java | 4 ++-- .../autoconfigure/web/ResourceProperties.java | 2 +- .../TomcatWebServerFactoryCustomizer.java | 4 ++-- .../AbstractErrorWebExceptionHandler.java | 2 +- .../web/servlet/WebMvcAutoConfiguration.java | 2 +- .../servlet/error/BasicErrorController.java | 2 +- .../error/ErrorMvcAutoConfiguration.java | 6 +++-- ...stJpaDependencyAutoConfigurationTests.java | 2 +- .../servlet/MockServletWebServerFactory.java | 10 ++++---- ...gApplicationWebApplicationInitializer.java | 2 +- .../boot/cli/command/CommandRunner.java | 8 +++---- .../cli/command/archive/ArchiveCommand.java | 2 +- .../boot/cli/command/core/HelpCommand.java | 4 ++-- .../boot/cli/command/core/HintCommand.java | 4 ++-- .../cli/command/init/InitializrService.java | 2 +- .../init/ProjectGenerationRequest.java | 2 +- .../cli/command/init/ProjectGenerator.java | 10 ++++---- .../cli/command/install/InstallCommand.java | 4 ++-- .../cli/command/install/UninstallCommand.java | 4 ++-- .../cli/command/options/OptionHandler.java | 3 ++- .../cli/command/options/SourceOptions.java | 2 +- .../cli/command/shell/CommandCompleter.java | 4 ++-- .../boot/cli/command/shell/Shell.java | 4 ++-- .../compiler/ExtendedGroovyClassLoader.java | 2 +- ...veDependencyCoordinatesTransformation.java | 4 ++-- ...ManagementArtifactCoordinatesResolver.java | 8 +++---- .../cli/compiler/grape/AetherGrapeEngine.java | 4 ++-- ...ositorySystemSessionAutoConfiguration.java | 6 ++--- .../grape/DependencyResolutionContext.java | 6 ++--- .../cli/compiler/maven/MavenSettings.java | 7 +++--- .../init/AbstractHttpClientMockTests.java | 12 +++++----- .../init/ProjectGenerationRequestTests.java | 6 ++--- .../RemoteDevToolsAutoConfiguration.java | 18 +++++++++------ .../DevToolsHomePropertiesPostProcessor.java | 4 ++-- .../client/ClassPathChangeUploader.java | 12 +++++----- .../restart/classloader/ClassLoaderFile.java | 4 ++-- .../tunnel/client/HttpTunnelConnection.java | 6 ++--- .../client/ClassPathChangeUploaderTests.java | 4 ++-- .../test/MockClientHttpRequestFactory.java | 2 +- .../spock/SpockTestRestTemplateExample.java | 4 ++-- .../migrator/PropertiesMigrationReport.java | 2 +- .../properties/AnnotationsPropertySource.java | 8 +++---- .../PropertyMappingContextCustomizer.java | 4 ++-- .../web/servlet/WebDriverScope.java | 4 ++-- .../context/ImportsContextCustomizer.java | 10 ++++---- .../SpringBootConfigurationFinder.java | 2 +- .../test/context/SpringBootContextLoader.java | 4 ++-- .../SpringBootTestContextBootstrapper.java | 10 ++++---- .../assertj/ApplicationContextAssert.java | 4 ++-- .../runner/WebApplicationContextRunner.java | 4 ++-- .../boot/test/json/JsonContent.java | 6 ++--- .../boot/test/json/JsonContentAssert.java | 10 ++++---- .../boot/test/json/JsonLoader.java | 4 ++-- .../boot/test/json/ObjectContent.java | 6 ++--- .../boot/test/mock/mockito/Definition.java | 4 ++-- .../test/mock/mockito/MockDefinition.java | 2 +- .../boot/test/util/EnvironmentTestUtils.java | 4 ++-- .../boot/test/util/TestPropertyValues.java | 6 ++--- .../test/web/client/TestRestTemplate.java | 2 +- .../AutoConfigureAnnotationProcessor.java | 2 +- .../AbstractConfigurationMetadataTests.java | 4 ++-- ...figurationMetadataAnnotationProcessor.java | 9 ++++---- .../TypeElementMembers.java | 4 ++-- .../configurationprocessor/TypeUtils.java | 6 ++--- .../javac/JavaCompilerFieldValuesParser.java | 2 +- .../fieldvalues/javac/Trees.java | 4 ++-- .../fieldvalues/javac/VariableTree.java | 4 ++-- .../metadata/ConfigurationMetadata.java | 4 ++-- .../metadata/ItemDeprecation.java | 4 ++-- .../metadata/ItemHint.java | 8 +++---- .../metadata/ItemMetadata.java | 8 +++---- .../boot/gradle/dsl/SpringBootExtension.java | 2 +- .../boot/gradle/plugin/JavaPluginAction.java | 4 ++-- .../gradle/tasks/buildinfo/BuildInfo.java | 23 ++++++++----------- .../boot/gradle/tasks/bundling/BootJar.java | 6 ++--- .../boot/gradle/tasks/bundling/BootWar.java | 6 ++--- .../tasks/bundling/BootZipCopyAction.java | 4 ++-- .../loader/tools/DefaultLaunchScript.java | 6 ++--- .../boot/loader/tools/JarWriter.java | 6 ++--- .../boot/loader/tools/Library.java | 4 ++-- .../boot/loader/tools/MainClassFinder.java | 4 ++-- .../springframework/boot/loader/Launcher.java | 4 ++-- .../boot/loader/MainMethodRunner.java | 4 ++-- .../boot/loader/PropertiesLauncher.java | 4 ++-- .../loader/data/RandomAccessDataFile.java | 4 ++-- .../boot/loader/jar/AsciiBytes.java | 4 ++-- .../boot/loader/jar/Handler.java | 6 ++--- .../boot/loader/jar/JarEntry.java | 2 +- .../boot/loader/jar/JarFile.java | 14 +++++------ .../boot/loader/jar/JarFileEntries.java | 6 ++--- .../boot/loader/jar/JarURLConnection.java | 10 ++++---- .../boot/loader/jar/StringSequence.java | 2 +- .../loader/jar/ZipInflaterInputStream.java | 6 ++--- .../boot/loader/util/SystemPropertyUtils.java | 2 +- .../boot/maven/AbstractRunMojo.java | 6 ++--- .../PropertiesMergingResourceTransformer.java | 2 +- .../boot/maven/RepackageMojo.java | 4 ++-- .../boot/BeanDefinitionLoader.java | 4 ++-- .../boot/DefaultApplicationArguments.java | 4 ++-- .../boot/ExitCodeGenerators.java | 4 ++-- .../org/springframework/boot/ImageBanner.java | 6 ++--- .../springframework/boot/ResourceBanner.java | 12 +++++----- .../boot/SpringApplication.java | 6 ++--- .../boot/SpringApplicationBannerPrinter.java | 4 ++-- .../boot/SpringApplicationRunListeners.java | 2 +- .../boot/SpringBootBanner.java | 2 +- .../boot/SpringBootVersion.java | 4 ++-- .../boot/StartupInfoLogger.java | 8 +++---- .../springframework/boot/ansi/AnsiColors.java | 6 ++--- .../builder/SpringApplicationBuilder.java | 6 ++--- ...udFoundryVcapEnvironmentPostProcessor.java | 2 +- .../context/ApplicationPidFileWriter.java | 2 +- .../config/ConfigFileApplicationListener.java | 10 ++++---- .../ConfigurationBeanFactoryMetadata.java | 2 +- ...urationPropertiesBindingPostProcessor.java | 4 ++-- ...ConfigurationPropertiesImportSelector.java | 4 ++-- .../properties/bind/BindConverter.java | 2 +- .../properties/bind/BindException.java | 2 +- .../context/properties/bind/BindResult.java | 8 +++---- .../context/properties/bind/Bindable.java | 6 ++--- .../boot/context/properties/bind/Binder.java | 10 ++++---- .../properties/bind/CollectionBinder.java | 4 ++-- .../bind/IndexedElementsBinder.java | 2 +- .../properties/bind/JavaBeanBinder.java | 4 ++-- .../context/properties/bind/MapBinder.java | 6 ++--- .../PropertySourcesPlaceholdersResolver.java | 4 ++-- .../bind/handler/IgnoreErrorsBindHandler.java | 2 +- .../source/ConfigurationPropertyName.java | 14 +++++------ ...gurationPropertySourcesPropertySource.java | 2 +- .../MapConfigurationPropertySource.java | 2 +- .../SpringConfigurationPropertySource.java | 8 +++---- ...ngIterableConfigurationPropertySource.java | 4 ++-- .../CollectionToDelimitedStringConverter.java | 8 +++++-- .../DelimitedStringToArrayConverter.java | 2 +- .../DelimitedStringToCollectionConverter.java | 4 ++-- .../convert/DurationToNumberConverter.java | 8 +++++-- .../convert/DurationToStringConverter.java | 18 +++++++++++---- .../convert/NumberToDurationConverter.java | 2 +- .../convert/StringToDurationConverter.java | 18 +++++++++++---- .../boot/diagnostics/FailureAnalyzers.java | 2 +- ...eanCurrentlyInCreationFailureAnalyzer.java | 8 +++---- ...igurationPropertyValueFailureAnalyzer.java | 6 ++--- .../boot/env/OriginTrackedYamlLoader.java | 2 +- ...plicationJsonEnvironmentPostProcessor.java | 2 +- .../boot/env/YamlPropertySourceLoader.java | 4 ++-- .../boot/info/GitProperties.java | 2 +- .../boot/jackson/JsonComponentModule.java | 6 ++--- .../boot/jdbc/DataSourceBuilder.java | 4 ++-- .../boot/jdbc/DatabaseDriver.java | 2 +- .../boot/jdbc/EmbeddedDatabaseConnection.java | 2 +- ...mpositeDataSourcePoolMetadataProvider.java | 6 ++--- .../TomcatDataSourcePoolMetadata.java | 4 ++-- .../boot/json/AbstractJsonParser.java | 2 +- ...ikosDependsOnBeanFactoryPostProcessor.java | 2 +- .../boot/logging/java/SimpleFormatter.java | 4 ++-- .../boot/logging/log4j2/ColorConverter.java | 6 ++--- .../boot/logging/logback/ColorConverter.java | 4 ++-- .../logging/logback/LogbackLoggingSystem.java | 2 +- .../boot/origin/OriginTrackedValue.java | 2 +- .../boot/origin/PropertySourceOrigin.java | 2 +- .../boot/origin/TextResourceOrigin.java | 2 +- .../boot/system/ApplicationHome.java | 14 +++++------ .../boot/system/ApplicationPid.java | 2 +- .../boot/system/SystemProperties.java | 2 +- .../springframework/boot/util/LambdaSafe.java | 14 +++++------ .../boot/web/client/RestTemplateBuilder.java | 4 ++-- .../jetty/JettyReactiveWebServerFactory.java | 2 +- .../jetty/JettyServletWebServerFactory.java | 10 ++++---- .../web/embedded/jetty/JettyWebServer.java | 2 +- .../embedded/netty/SslServerCustomizer.java | 8 +++---- .../TomcatEmbeddedWebappClassLoader.java | 10 ++++---- .../TomcatReactiveWebServerFactory.java | 6 ++--- .../tomcat/TomcatServletWebServerFactory.java | 12 +++++----- .../web/embedded/tomcat/TomcatWebServer.java | 2 +- .../undertow/SslBuilderCustomizer.java | 8 +++---- .../UndertowReactiveWebServerFactory.java | 4 ++-- .../undertow/UndertowServletWebServer.java | 2 +- .../UndertowServletWebServerFactory.java | 6 ++--- .../embedded/undertow/UndertowWebServer.java | 2 +- .../error/DefaultErrorAttributes.java | 2 +- .../reactive/result/view/MustacheView.java | 4 ++-- .../boot/web/server/ErrorPage.java | 6 ++--- .../boot/web/server/MimeMappings.java | 6 ++--- .../web/servlet/DynamicRegistrationBean.java | 2 +- .../ServletContextInitializerBeans.java | 2 +- ...onContextServletContextAwareProcessor.java | 6 ++--- .../boot/web/servlet/server/DocumentRoot.java | 8 +++---- .../web/servlet/support/ErrorPageFilter.java | 4 ++-- .../boot/SpringApplicationTests.java | 2 +- .../ConfigFileApplicationListenerTests.java | 2 +- ...iasedConfigurationPropertySourceTests.java | 2 +- .../MapConfigurationPropertySourceTests.java | 2 +- .../analyzer/BindFailureAnalyzerTests.java | 4 ++-- .../BindValidationFailureAnalyzerTests.java | 4 ++-- ...igurationPropertyFailureAnalyzerTests.java | 6 ++--- .../OriginTrackedPropertiesLoaderTests.java | 2 +- .../boot/origin/MockOrigin.java | 2 +- .../JettyServletWebServerFactoryTests.java | 2 +- .../TomcatServletWebServerFactoryTests.java | 2 +- .../UndertowServletWebServerFactoryTests.java | 2 +- .../server/MockServletWebServerFactory.java | 10 ++++---- .../embedded/AbstractApplicationLauncher.java | 4 ++-- 293 files changed, 714 insertions(+), 685 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscoverer.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscoverer.java index 38566757bf1..c1216fb362d 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscoverer.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/CloudFoundryWebEndpointDiscoverer.java @@ -72,7 +72,7 @@ public class CloudFoundryWebEndpointDiscoverer extends WebEndpointDiscoverer { AnnotationAttributes attributes = AnnotatedElementUtils .getMergedAnnotationAttributes(extensionBean.getClass(), EndpointWebExtension.class); - Class endpoint = (attributes != null ? attributes.getClass("endpoint") : null); + Class endpoint = (attributes != null) ? attributes.getClass("endpoint") : null; return (endpoint != null && HealthEndpoint.class.isAssignableFrom(endpoint)); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfiguration.java index 2638905105a..efd7ee2ebd3 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfiguration.java @@ -126,8 +126,8 @@ public class ReactiveCloudFoundryActuatorAutoConfiguration { String cloudControllerUrl = environment.getProperty("vcap.application.cf_api"); boolean skipSslValidation = environment.getProperty( "management.cloudfoundry.skip-ssl-validation", Boolean.class, false); - return (cloudControllerUrl != null ? new ReactiveCloudFoundrySecurityService( - webClientBuilder, cloudControllerUrl, skipSslValidation) : null); + return (cloudControllerUrl != null) ? new ReactiveCloudFoundrySecurityService( + webClientBuilder, cloudControllerUrl, skipSslValidation) : null; } private CorsConfiguration getCorsConfiguration() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java index 9f7d5f5b466..343af361cc6 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryActuatorAutoConfiguration.java @@ -130,8 +130,8 @@ public class CloudFoundryActuatorAutoConfiguration { String cloudControllerUrl = environment.getProperty("vcap.application.cf_api"); boolean skipSslValidation = environment.getProperty( "management.cloudfoundry.skip-ssl-validation", Boolean.class, false); - return (cloudControllerUrl != null ? new CloudFoundrySecurityService( - restTemplateBuilder, cloudControllerUrl, skipSslValidation) : null); + return (cloudControllerUrl != null) ? new CloudFoundrySecurityService( + restTemplateBuilder, cloudControllerUrl, skipSslValidation) : null; } private CorsConfiguration getCorsConfiguration() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpoint.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpoint.java index ba471945a93..35818c14e91 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpoint.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpoint.java @@ -125,8 +125,8 @@ public class ConditionsReportEndpoint { this.unconditionalClasses = report.getUnconditionalClasses(); report.getConditionAndOutcomesBySource().forEach( (source, conditionAndOutcomes) -> add(source, conditionAndOutcomes)); - this.parentId = (context.getParent() != null ? context.getParent().getId() - : null); + this.parentId = (context.getParent() != null) ? context.getParent().getId() + : null; } private void add(String source, ConditionAndOutcomes conditionAndOutcomes) { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfiguration.java index ecb984b9d57..47ea3b0c549 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/elasticsearch/ElasticsearchHealthIndicatorAutoConfiguration.java @@ -82,7 +82,7 @@ public class ElasticsearchHealthIndicatorAutoConfiguration { protected ElasticsearchHealthIndicator createHealthIndicator(Client client) { Duration responseTimeout = this.properties.getResponseTimeout(); return new ElasticsearchHealthIndicator(client, - responseTimeout != null ? responseTimeout.toMillis() : 100, + (responseTimeout != null) ? responseTimeout.toMillis() : 100, this.properties.getIndices()); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorAutoConfiguration.java index 4f1f155ee64..9484ac44fed 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthIndicatorAutoConfiguration.java @@ -112,7 +112,7 @@ public class DataSourceHealthIndicatorAutoConfiguration extends private String getValidationQuery(DataSource source) { DataSourcePoolMetadata poolMetadata = this.poolMetadataProvider .getDataSourcePoolMetadata(source); - return (poolMetadata != null ? poolMetadata.getValidationQuery() : null); + return (poolMetadata != null) ? poolMetadata.getValidationQuery() : null; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurer.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurer.java index b1907d7b3a9..198a3e994c1 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurer.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurer.java @@ -51,9 +51,9 @@ class MeterRegistryConfigurer { Collection filters, Collection> customizers, boolean addToGlobalRegistry) { - this.binders = (binders != null ? binders : Collections.emptyList()); - this.filters = (filters != null ? filters : Collections.emptyList()); - this.customizers = (customizers != null ? customizers : Collections.emptyList()); + this.binders = (binders != null) ? binders : Collections.emptyList(); + this.filters = (filters != null) ? filters : Collections.emptyList(); + this.customizers = (customizers != null) ? customizers : Collections.emptyList(); this.addToGlobalRegistry = addToGlobalRegistry; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java index 7edd6caa973..757fd2b7e9b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java @@ -67,10 +67,10 @@ public class PropertiesMeterFilter implements MeterFilter { } private long[] convertSla(Meter.Type meterType, ServiceLevelAgreementBoundary[] sla) { - long[] converted = Arrays.stream(sla != null ? sla : EMPTY_SLA) + long[] converted = Arrays.stream((sla != null) ? sla : EMPTY_SLA) .map((candidate) -> candidate.getValue(meterType)) .filter(Objects::nonNull).mapToLong(Long::longValue).toArray(); - return (converted.length != 0 ? converted : null); + return (converted.length != 0) ? converted : null; } private T lookup(Map values, Id id, T defaultValue) { @@ -84,7 +84,7 @@ public class PropertiesMeterFilter implements MeterFilter { return result; } int lastDot = name.lastIndexOf('.'); - name = (lastDot != -1 ? name.substring(0, lastDot) : ""); + name = (lastDot != -1) ? name.substring(0, lastDot) : ""; } return values.getOrDefault("all", defaultValue); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/PropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/PropertiesConfigAdapter.java index 90eead2575d..7e6a0c4a1b8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/PropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/PropertiesConfigAdapter.java @@ -51,7 +51,7 @@ public class PropertiesConfigAdapter { */ protected final V get(Function getter, Supplier fallback) { V value = getter.apply(this.properties); - return (value != null ? value : fallback.get()); + return (value != null) ? value : fallback.get(); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java index 5d873338bad..3151cddca25 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java @@ -60,7 +60,7 @@ public class WavefrontPropertiesConfigAdapter } private String getUriAsString(WavefrontProperties properties) { - return (properties.getUri() != null ? properties.getUri().toString() : null); + return (properties.getUri() != null) ? properties.getUri().toString() : null; } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.java index ba2ff2570c4..6d37da4f4d5 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.java @@ -47,7 +47,8 @@ public class TomcatMetricsAutoConfiguration { @Bean @ConditionalOnMissingBean public TomcatMetrics tomcatMetrics() { - return new TomcatMetrics(this.context != null ? this.context.getManager() : null, + return new TomcatMetrics( + (this.context != null) ? this.context.getManager() : null, Collections.emptyList()); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java index ad9c37f9a53..0c4b8a88961 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java @@ -125,17 +125,17 @@ class ManagementContextConfigurationImportSelector Map annotationAttributes = annotationMetadata .getAnnotationAttributes( ManagementContextConfiguration.class.getName()); - return (annotationAttributes != null + return (annotationAttributes != null) ? (ManagementContextType) annotationAttributes.get("value") - : ManagementContextType.ANY); + : ManagementContextType.ANY; } private int readOrder(AnnotationMetadata annotationMetadata) { Map attributes = annotationMetadata .getAnnotationAttributes(Order.class.getName()); - Integer order = (attributes != null ? (Integer) attributes.get("value") - : null); - return (order != null ? order : Ordered.LOWEST_PRECEDENCE); + Integer order = (attributes != null) ? (Integer) attributes.get("value") + : null; + return (order != null) ? order : Ordered.LOWEST_PRECEDENCE; } public String getClassName() { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementPortType.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementPortType.java index cbea9964458..eccc7b59e1e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementPortType.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementPortType.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,9 +47,9 @@ public enum ManagementPortType { if (managementPort != null && managementPort < 0) { return DISABLED; } - return ((managementPort == null) + return ((managementPort == null || (serverPort == null && managementPort.equals(8080)) - || (managementPort != 0 && managementPort.equals(serverPort)) ? SAME + || (managementPort != 0 && managementPort.equals(serverPort))) ? SAME : DIFFERENT); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/MockServletWebServerFactory.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/MockServletWebServerFactory.java index 6d4dcc8037b..c364634cc58 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/MockServletWebServerFactory.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/MockServletWebServerFactory.java @@ -52,17 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory } public ServletContext getServletContext() { - return (getWebServer() != null ? getWebServer().getServletContext() : null); + return (getWebServer() != null) ? getWebServer().getServletContext() : null; } public RegisteredServlet getRegisteredServlet(int index) { - return (getWebServer() != null ? getWebServer().getRegisteredServlet(index) - : null); + return (getWebServer() != null) ? getWebServer().getRegisteredServlet(index) + : null; } public RegisteredFilter getRegisteredFilter(int index) { - return (getWebServer() != null ? getWebServer().getRegisteredFilters(index) - : null); + return (getWebServer() != null) ? getWebServer().getRegisteredFilters(index) + : null; } public static class MockServletWebServer diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java index e8cdb500a77..c8edb8eca20 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java @@ -86,7 +86,7 @@ public class AuditEvent implements Serializable { Assert.notNull(timestamp, "Timestamp must not be null"); Assert.notNull(type, "Type must not be null"); this.timestamp = timestamp; - this.principal = (principal != null ? principal : ""); + this.principal = (principal != null) ? principal : ""; this.type = type; this.data = Collections.unmodifiableMap(data); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventsEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventsEndpoint.java index f5936ef18ce..913bf8fc4d4 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventsEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventsEndpoint.java @@ -50,7 +50,7 @@ public class AuditEventsEndpoint { } private Instant getInstant(OffsetDateTime offsetDateTime) { - return (offsetDateTime != null ? offsetDateTime.toInstant() : null); + return (offsetDateTime != null) ? offsetDateTime.toInstant() : null; } /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/beans/BeansEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/beans/BeansEndpoint.java index aefaf59ed44..4f1446297d8 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/beans/BeansEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/beans/BeansEndpoint.java @@ -118,7 +118,7 @@ public class BeansEndpoint { } ConfigurableApplicationContext parent = getConfigurableParent(context); return new ContextBeans(describeBeans(context.getBeanFactory()), - parent != null ? parent.getId() : null); + (parent != null) ? parent.getId() : null); } private static Map describeBeans( diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java index 4dd46dc1666..d7275ba376b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java @@ -118,7 +118,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext prefix, sanitize(prefix, safeSerialize(mapper, bean, prefix)))); }); return new ContextConfigurationProperties(beanDescriptors, - context.getParent() != null ? context.getParent().getId() : null); + (context.getParent() != null) ? context.getParent().getId() : null); } private ConfigurationBeanFactoryMetadata getBeanFactoryMetadata( diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicator.java index 5fdd8d3ad8f..3b2cd6d7970 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchHealthIndicator.java @@ -55,7 +55,7 @@ public class ElasticsearchHealthIndicator extends AbstractHealthIndicator { public ElasticsearchHealthIndicator(Client client, long responseTimeout, List indices) { this(client, responseTimeout, - (indices != null ? StringUtils.toStringArray(indices) : null)); + (indices != null) ? StringUtils.toStringArray(indices) : null); } /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapper.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapper.java index 13653db37f4..2989b7fbe78 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapper.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/jmx/JacksonJmxOperationResponseMapper.java @@ -39,7 +39,7 @@ public class JacksonJmxOperationResponseMapper implements JmxOperationResponseMa private final JavaType mapType; public JacksonJmxOperationResponseMapper(ObjectMapper objectMapper) { - this.objectMapper = (objectMapper != null ? objectMapper : new ObjectMapper()); + this.objectMapper = (objectMapper != null) ? objectMapper : new ObjectMapper(); this.listType = this.objectMapper.getTypeFactory() .constructParametricType(List.class, Object.class); this.mapType = this.objectMapper.getTypeFactory() diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoints.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoints.java index b3d3b97eabd..b2d270fb208 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoints.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/PathMappedEndpoints.java @@ -46,7 +46,7 @@ public class PathMappedEndpoints implements Iterable { */ public PathMappedEndpoints(String basePath, EndpointsSupplier supplier) { Assert.notNull(supplier, "Supplier must not be null"); - this.basePath = (basePath != null ? basePath : ""); + this.basePath = (basePath != null) ? basePath : ""; this.endpoints = getEndpoints(Collections.singleton(supplier)); } @@ -58,7 +58,7 @@ public class PathMappedEndpoints implements Iterable { public PathMappedEndpoints(String basePath, Collection> suppliers) { Assert.notNull(suppliers, "Suppliers must not be null"); - this.basePath = (basePath != null ? basePath : ""); + this.basePath = (basePath != null) ? basePath : ""; this.endpoints = getEndpoints(suppliers); } @@ -91,7 +91,7 @@ public class PathMappedEndpoints implements Iterable { */ public String getRootPath(String endpointId) { PathMappedEndpoint endpoint = getEndpoint(endpointId); - return (endpoint != null ? endpoint.getRootPath() : null); + return (endpoint != null) ? endpoint.getRootPath() : null; } /** @@ -144,7 +144,7 @@ public class PathMappedEndpoints implements Iterable { } private String getPath(PathMappedEndpoint endpoint) { - return (endpoint != null ? this.basePath + "/" + endpoint.getRootPath() : null); + return (endpoint != null) ? this.basePath + "/" + endpoint.getRootPath() : null; } private List asList(Stream stream) { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java index 26f761962bd..bc4daca0a35 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java @@ -47,7 +47,7 @@ public class ServletEndpointRegistrar implements ServletContextInitializer { public ServletEndpointRegistrar(String basePath, Collection servletEndpoints) { Assert.notNull(servletEndpoints, "ServletEndpoints must not be null"); - this.basePath = (basePath != null ? basePath : ""); + this.basePath = (basePath != null) ? basePath : ""; this.servletEndpoints = servletEndpoints; } 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 4a9bbe5f926..b007915524a 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 @@ -179,7 +179,7 @@ public class JerseyEndpointResourceFactory { Map result = new HashMap<>(); multivaluedMap.forEach((name, values) -> { if (!CollectionUtils.isEmpty(values)) { - result.put(name, values.size() != 1 ? values : values.get(0)); + result.put(name, (values.size() != 1) ? values : values.get(0)); } }); return result; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java index d666810e24d..060ae160b8b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/reactive/AbstractWebFluxEndpointHandlerMapping.java @@ -310,7 +310,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping arguments.putAll(body); } exchange.getRequest().getQueryParams().forEach((name, values) -> arguments - .put(name, values.size() != 1 ? values : values.get(0))); + .put(name, (values.size() != 1) ? values : values.get(0))); return arguments; } @@ -324,7 +324,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping .onErrorMap(InvalidEndpointRequestException.class, (ex) -> new ResponseStatusException(HttpStatus.BAD_REQUEST, ex.getReason())) - .defaultIfEmpty(new ResponseEntity<>(httpMethod != HttpMethod.GET + .defaultIfEmpty(new ResponseEntity<>((httpMethod != HttpMethod.GET) ? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND)); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java index 20dc83ea4e3..a689ec4d0db 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/servlet/AbstractWebMvcEndpointHandlerMapping.java @@ -257,7 +257,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping arguments.putAll(body); } request.getParameterMap().forEach((name, values) -> arguments.put(name, - values.length != 1 ? Arrays.asList(values) : values[0])); + (values.length != 1) ? Arrays.asList(values) : values[0])); return arguments; } @@ -269,7 +269,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping private Object handleResult(Object result, HttpMethod httpMethod) { if (result == null) { - return new ResponseEntity<>(httpMethod != HttpMethod.GET + return new ResponseEntity<>((httpMethod != HttpMethod.GET) ? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND); } if (!(result instanceof WebEndpointResponse)) { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java index 71d644d641c..8280882cc2f 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java @@ -160,7 +160,7 @@ public class EnvironmentEndpoint { private String getOrigin(OriginLookup lookup, String name) { Origin origin = lookup.getOrigin(name); - return (origin != null ? origin.toString() : null); + return (origin != null) ? origin.toString() : null; } private PlaceholdersResolver getResolver() { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/flyway/FlywayEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/flyway/FlywayEndpoint.java index 6f578acfc64..f8a1c4f4977 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/flyway/FlywayEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/flyway/FlywayEndpoint.java @@ -59,7 +59,7 @@ public class FlywayEndpoint { .put(name, new FlywayDescriptor(flyway.info().all()))); ApplicationContext parent = target.getParent(); contextFlywayBeans.put(target.getId(), new ContextFlywayBeans(flywayBeans, - parent != null ? parent.getId() : null)); + (parent != null) ? parent.getId() : null)); target = parent; } return new ApplicationFlywayBeans(contextFlywayBeans); @@ -170,7 +170,7 @@ public class FlywayEndpoint { } private String nullSafeToString(Object obj) { - return (obj != null ? obj.toString() : null); + return (obj != null) ? obj.toString() : null; } public MigrationType getType() { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicator.java index 36879f06926..9648e7d8087 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/CompositeReactiveHealthIndicator.java @@ -57,8 +57,8 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator Assert.notNull(indicators, "Indicators must not be null"); this.indicators = new LinkedHashMap<>(indicators); this.healthAggregator = healthAggregator; - this.timeoutCompose = (mono) -> (this.timeout != null ? mono.timeout( - Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono); + this.timeoutCompose = (mono) -> (this.timeout != null) ? mono.timeout( + Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono; } /** @@ -85,8 +85,8 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator public CompositeReactiveHealthIndicator timeoutStrategy(long timeout, Health timeoutHealth) { this.timeout = timeout; - this.timeoutHealth = (timeoutHealth != null ? timeoutHealth - : Health.unknown().build()); + this.timeoutHealth = (timeoutHealth != null) ? timeoutHealth + : Health.unknown().build(); return this; } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java index a459b0d21fb..39042a1133b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -98,7 +98,7 @@ public class OrderedHealthAggregator extends AbstractHealthAggregator { public int compare(Status s1, Status s2) { int i1 = this.statusOrder.indexOf(s1.getCode()); int i2 = this.statusOrder.indexOf(s2.getCode()); - return (i1 < i2 ? -1 : (i1 != i2 ? 1 : s1.getCode().compareTo(s2.getCode()))); + return (i1 < i2) ? -1 : (i1 != i2) ? 1 : s1.getCode().compareTo(s2.getCode()); } } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java index faf1d7a3c3f..38373dfce84 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java @@ -86,7 +86,7 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator super("DataSource health check failed"); this.dataSource = dataSource; this.query = query; - this.jdbcTemplate = (dataSource != null ? new JdbcTemplate(dataSource) : null); + this.jdbcTemplate = (dataSource != null) ? new JdbcTemplate(dataSource) : null; } @Override diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpoint.java index f3283c7341d..1dd4b551b35 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpoint.java @@ -69,7 +69,7 @@ public class LiquibaseEndpoint { createReport(liquibase, service, factory))); ApplicationContext parent = target.getParent(); contextBeans.put(target.getId(), new ContextLiquibaseBeans(liquibaseBeans, - parent != null ? parent.getId() : null)); + (parent != null) ? parent.getId() : null)); target = parent; } return new ApplicationLiquibaseBeans(contextBeans); @@ -210,7 +210,7 @@ public class LiquibaseEndpoint { this.execType = ranChangeSet.getExecType(); this.id = ranChangeSet.getId(); this.labels = ranChangeSet.getLabels().getLabels(); - this.checksum = (ranChangeSet.getLastCheckSum() != null + this.checksum = ((ranChangeSet.getLastCheckSum() != null) ? ranChangeSet.getLastCheckSum().toString() : null); this.orderExecuted = ranChangeSet.getOrderExecuted(); this.tag = ranChangeSet.getTag(); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java index 6454b3526f9..b5fae560a15 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/logging/LoggersEndpoint.java @@ -73,7 +73,7 @@ public class LoggersEndpoint { Assert.notNull(name, "Name must not be null"); LoggerConfiguration configuration = this.loggingSystem .getLoggerConfiguration(name); - return (configuration != null ? new LoggerLevels(configuration) : null); + return (configuration != null) ? new LoggerLevels(configuration) : null; } @WriteOperation @@ -112,7 +112,7 @@ public class LoggersEndpoint { } private String getName(LogLevel level) { - return (level != null ? level.name() : null); + return (level != null) ? level.name() : null; } public String getConfiguredLevel() { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java index 9138ef1dd7b..c82731c955f 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java @@ -78,7 +78,7 @@ public class HeapDumpWebEndpoint { if (this.lock.tryLock(this.timeout, TimeUnit.MILLISECONDS)) { try { return new WebEndpointResponse<>( - dumpHeap(live != null ? live : true)); + dumpHeap((live != null) ? live : true)); } finally { this.lock.unlock(); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/amqp/RabbitMetrics.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/amqp/RabbitMetrics.java index 05be8e9eb28..c248c6115a4 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/amqp/RabbitMetrics.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/amqp/RabbitMetrics.java @@ -47,7 +47,7 @@ public class RabbitMetrics implements MeterBinder { public RabbitMetrics(ConnectionFactory connectionFactory, Iterable tags) { Assert.notNull(connectionFactory, "ConnectionFactory must not be null"); this.connectionFactory = connectionFactory; - this.tags = (tags != null ? tags : Collections.emptyList()); + this.tags = (tags != null) ? tags : Collections.emptyList(); } @Override diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java index 60139b4324d..9725c60c4f1 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java @@ -73,7 +73,7 @@ public final class RestTemplateExchangeTags { } private static String ensureLeadingSlash(String url) { - return (url == null || url.startsWith("/") ? url : "/" + url); + return (url == null || url.startsWith("/")) ? url : "/" + url; } /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java index c24fe630978..c64c644cbd4 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java @@ -60,7 +60,7 @@ public final class WebMvcTags { * @return the method tag whose value is a capitalized method (e.g. GET). */ public static Tag method(HttpServletRequest request) { - return (request != null ? Tag.of("method", request.getMethod()) : METHOD_UNKNOWN); + return (request != null) ? Tag.of("method", request.getMethod()) : METHOD_UNKNOWN; } /** @@ -69,9 +69,9 @@ public final class WebMvcTags { * @return the status tag derived from the status of the response */ public static Tag status(HttpServletResponse response) { - return (response != null + return (response != null) ? Tag.of("status", Integer.toString(response.getStatus())) - : STATUS_UNKNOWN); + : STATUS_UNKNOWN; } /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/solr/SolrHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/solr/SolrHealthIndicator.java index e88969ccc6a..27d18b16250 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/solr/SolrHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/solr/SolrHealthIndicator.java @@ -48,7 +48,7 @@ public class SolrHealthIndicator extends AbstractHealthIndicator { request.setAction(CoreAdminParams.CoreAdminAction.STATUS); CoreAdminResponse response = request.process(this.solrClient); int statusCode = response.getStatus(); - Status status = (statusCode != 0 ? Status.DOWN : Status.UP); + Status status = (statusCode != 0) ? Status.DOWN : Status.UP; builder.status(status).withDetail("status", statusCode); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/MappingsEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/MappingsEndpoint.java index 6c647e6271f..3014e590586 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/MappingsEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/MappingsEndpoint.java @@ -59,7 +59,7 @@ public class MappingsEndpoint { this.descriptionProviders .forEach((provider) -> mappings.put(provider.getMappingName(), provider.describeMappings(applicationContext))); - return new ContextMappings(mappings, applicationContext.getParent() != null + return new ContextMappings(mappings, (applicationContext.getParent() != null) ? applicationContext.getId() : null); } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletHandlerMappings.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletHandlerMappings.java index 4ab0d3b8994..d2afc78f345 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletHandlerMappings.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/servlet/DispatcherServletHandlerMappings.java @@ -64,7 +64,7 @@ final class DispatcherServletHandlerMappings { initializeDispatcherServletIfPossible(); handlerMappings = this.dispatcherServlet.getHandlerMappings(); } - return (handlerMappings != null ? handlerMappings : Collections.emptyList()); + return (handlerMappings != null) ? handlerMappings : Collections.emptyList(); } private void initializeDispatcherServletIfPossible() { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/HttpTraceWebFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/HttpTraceWebFilter.java index 837adc2cfe7..6809c23d693 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/HttpTraceWebFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/HttpTraceWebFilter.java @@ -98,8 +98,8 @@ public class HttpTraceWebFilter implements WebFilter, Ordered { HttpTrace trace = this.tracer.receivedRequest(request); return chain.filter(exchange).doAfterSuccessOrError((aVoid, ex) -> { TraceableServerHttpResponse response = new TraceableServerHttpResponse( - (ex != null ? new CustomStatusResponseDecorator(ex, - exchange.getResponse()) : exchange.getResponse())); + (ex != null) ? new CustomStatusResponseDecorator(ex, + exchange.getResponse()) : exchange.getResponse()); this.tracer.sendingResponse(trace, response, () -> principal, () -> getStartedSessionId(session)); this.repository.add(trace); @@ -107,7 +107,7 @@ public class HttpTraceWebFilter implements WebFilter, Ordered { } private String getStartedSessionId(WebSession session) { - return (session != null && session.isStarted() ? session.getId() : null); + return (session != null && session.isStarted()) ? session.getId() : null; } private static final class CustomStatusResponseDecorator @@ -117,9 +117,9 @@ public class HttpTraceWebFilter implements WebFilter, Ordered { private CustomStatusResponseDecorator(Throwable ex, ServerHttpResponse delegate) { super(delegate); - this.status = (ex instanceof ResponseStatusException + this.status = (ex instanceof ResponseStatusException) ? ((ResponseStatusException) ex).getStatus() - : HttpStatus.INTERNAL_SERVER_ERROR); + : HttpStatus.INTERNAL_SERVER_ERROR; } @Override diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/ServerWebExchangeTraceableRequest.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/ServerWebExchangeTraceableRequest.java index 9daace7a711..a70a9ce2f1e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/ServerWebExchangeTraceableRequest.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/ServerWebExchangeTraceableRequest.java @@ -45,8 +45,8 @@ class ServerWebExchangeTraceableRequest implements TraceableRequest { this.method = request.getMethodValue(); this.headers = request.getHeaders(); this.uri = request.getURI(); - this.remoteAddress = (request.getRemoteAddress() != null - ? request.getRemoteAddress().getAddress().toString() : null); + this.remoteAddress = (request.getRemoteAddress() != null) + ? request.getRemoteAddress().getAddress().toString() : null; } @Override diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/TraceableServerHttpResponse.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/TraceableServerHttpResponse.java index 9721d0fb3f4..db1f44c71c6 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/TraceableServerHttpResponse.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/reactive/TraceableServerHttpResponse.java @@ -38,8 +38,8 @@ class TraceableServerHttpResponse implements TraceableResponse { @Override public int getStatus() { - return (this.response.getStatusCode() != null - ? this.response.getStatusCode().value() : 200); + return (this.response.getStatusCode() != null) + ? this.response.getStatusCode().value() : 200; } @Override diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/servlet/HttpTraceFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/servlet/HttpTraceFilter.java index 30ad132bea3..9ced019ee2f 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/servlet/HttpTraceFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/trace/servlet/HttpTraceFilter.java @@ -92,7 +92,7 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered { } finally { TraceableHttpServletResponse traceableResponse = new TraceableHttpServletResponse( - status != response.getStatus() + (status != response.getStatus()) ? new CustomStatusResponseWrapper(response, status) : response); this.tracer.sendingResponse(trace, traceableResponse, @@ -113,7 +113,7 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered { private String getSessionId(HttpServletRequest request) { HttpSession session = request.getSession(false); - return (session != null ? session.getId() : null); + return (session != null) ? session.getId() : null; } private static final class CustomStatusResponseWrapper diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java index 8de2b2426f0..2c131961a1f 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpointTests.java @@ -255,7 +255,7 @@ public class ConfigurationPropertiesReportEndpointTests { } public boolean isMixedBoolean() { - return (this.mixedBoolean != null ? this.mixedBoolean : false); + return (this.mixedBoolean != null) ? this.mixedBoolean : false; } public void setMixedBoolean(Boolean mixedBoolean) { diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/ReflectiveOperationInvokerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/ReflectiveOperationInvokerTests.java index 66f848b947f..4c6aa132a28 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/ReflectiveOperationInvokerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoke/reflect/ReflectiveOperationInvokerTests.java @@ -56,8 +56,8 @@ public class ReflectiveOperationInvokerTests { this.operationMethod = new OperationMethod( ReflectionUtils.findMethod(Example.class, "reverse", String.class), OperationType.READ); - this.parameterValueMapper = (parameter, - value) -> (value != null ? value.toString() : null); + this.parameterValueMapper = (parameter, value) -> (value != null) + ? value.toString() : null; } @Test diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporterTests.java index 01759b1098c..b196e963639 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/JmxEndpointExporterTests.java @@ -190,9 +190,9 @@ public class JmxEndpointExporterTests { @Override public ObjectName getObjectName(ExposableJmxEndpoint endpoint) throws MalformedObjectNameException { - return (endpoint != null + return (endpoint != null) ? new ObjectName("boot:type=Endpoint,name=" + endpoint.getId()) - : null); + : null; } } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/TestJmxOperation.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/TestJmxOperation.java index 1da6edd7940..86c740028c9 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/TestJmxOperation.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/jmx/TestJmxOperation.java @@ -68,8 +68,8 @@ public class TestJmxOperation implements JmxOperation { @Override public Object invoke(InvocationContext context) { - return (this.invoke != null ? this.invoke.apply(context.getArguments()) - : "result"); + return (this.invoke != null) ? this.invoke.apply(context.getArguments()) + : "result"; } @Override diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java index 2786f2694dd..6b7dbd0e7d9 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/annotation/AbstractWebEndpointIntegrationTests.java @@ -835,7 +835,7 @@ public abstract class AbstractWebEndpointIntegrationTests filter(List configurations, @@ -273,7 +273,7 @@ public class AutoConfigurationImportSelector protected final List asList(AnnotationAttributes attributes, String name) { String[] value = attributes.getStringArray(name); - return Arrays.asList(value != null ? value : new String[0]); + return Arrays.asList((value != null) ? value : new String[0]); } private void fireAutoConfigurationImportEvents(List configurations, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationMetadataLoader.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationMetadataLoader.java index c99e2172091..a3ffda00940 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationMetadataLoader.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationMetadataLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -45,8 +45,8 @@ final class AutoConfigurationMetadataLoader { static AutoConfigurationMetadata loadMetadata(ClassLoader classLoader, String path) { try { - Enumeration urls = (classLoader != null ? classLoader.getResources(path) - : ClassLoader.getSystemResources(path)); + Enumeration urls = (classLoader != null) ? classLoader.getResources(path) + : ClassLoader.getSystemResources(path); Properties properties = new Properties(); while (urls.hasMoreElements()) { properties.putAll(PropertiesLoaderUtils @@ -89,7 +89,7 @@ final class AutoConfigurationMetadataLoader { @Override public Integer getInteger(String className, String key, Integer defaultValue) { String value = get(className, key); - return (value != null ? Integer.valueOf(value) : defaultValue); + return (value != null) ? Integer.valueOf(value) : defaultValue; } @Override @@ -101,8 +101,8 @@ final class AutoConfigurationMetadataLoader { public Set getSet(String className, String key, Set defaultValue) { String value = get(className, key); - return (value != null ? StringUtils.commaDelimitedListToSet(value) - : defaultValue); + return (value != null) ? StringUtils.commaDelimitedListToSet(value) + : defaultValue; } @Override @@ -113,7 +113,7 @@ final class AutoConfigurationMetadataLoader { @Override public String get(String className, String key, String defaultValue) { String value = this.properties.getProperty(className + "." + key); - return (value != null ? value : defaultValue); + return (value != null) ? value : defaultValue; } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java index 833f5298e91..1e3bc0bed79 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationSorter.java @@ -213,8 +213,8 @@ class AutoConfigurationSorter { } Map attributes = getAnnotationMetadata() .getAnnotationAttributes(AutoConfigureOrder.class.getName()); - return (attributes != null ? (Integer) attributes.get("value") - : AutoConfigureOrder.DEFAULT_ORDER); + return (attributes != null) ? (Integer) attributes.get("value") + : AutoConfigureOrder.DEFAULT_ORDER; } private boolean wasProcessed() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java index ce0f019c794..a34c829fa8e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ImportAutoConfigurationImportSelector.java @@ -109,8 +109,8 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec for (String annotationName : ANNOTATION_NAMES) { AnnotationAttributes merged = AnnotatedElementUtils .getMergedAnnotationAttributes(source, annotationName); - Class[] exclude = (merged != null ? merged.getClassArray("exclude") - : null); + Class[] exclude = (merged != null) ? merged.getClassArray("exclude") + : null; if (exclude != null) { for (Class excludeClass : exclude) { exclusions.add(excludeClass.getName()); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/AbstractRabbitListenerContainerFactoryConfigurer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/AbstractRabbitListenerContainerFactoryConfigurer.java index 8475293207f..1afd2ee46c1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/AbstractRabbitListenerContainerFactoryConfigurer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/AbstractRabbitListenerContainerFactoryConfigurer.java @@ -110,8 +110,8 @@ public abstract class AbstractRabbitListenerContainerFactoryConfigurer> customizers) { - this.customizers = (customizers != null ? new ArrayList<>(customizers) - : Collections.emptyList()); + this.customizers = (customizers != null) ? new ArrayList<>(customizers) + : Collections.emptyList(); } /** diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java index 98ebcdb266f..a5c4c19b1e4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/AbstractNestedCondition.java @@ -147,8 +147,8 @@ public abstract class AbstractNestedCondition extends SpringBootCondition private List getConditionClasses(AnnotatedTypeMetadata metadata) { MultiValueMap attributes = metadata .getAllAnnotationAttributes(Conditional.class.getName(), true); - Object values = (attributes != null ? attributes.get("value") : null); - return (List) (values != null ? values : Collections.emptyList()); + Object values = (attributes != null) ? attributes.get("value") : null; + return (List) ((values != null) ? values : Collections.emptyList()); } private Condition getCondition(String conditionClassName) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportAutoConfigurationImportListener.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportAutoConfigurationImportListener.java index 208c7e25d02..20e29dbf52a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportAutoConfigurationImportListener.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReportAutoConfigurationImportListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,8 +46,8 @@ class ConditionEvaluationReportAutoConfigurationImportListener @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory - ? (ConfigurableListableBeanFactory) beanFactory : null); + this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory) + ? (ConfigurableListableBeanFactory) beanFactory : null; } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java index 07283b11c5c..736b6fac37d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java @@ -61,7 +61,7 @@ public final class ConditionMessage { @Override public String toString() { - return (this.message != null ? this.message : ""); + return (this.message != null) ? this.message : ""; } @Override @@ -358,7 +358,7 @@ public final class ConditionMessage { * @return a built {@link ConditionMessage} */ public ConditionMessage items(Style style, Object... items) { - return items(style, items != null ? Arrays.asList(items) : null); + return items(style, (items != null) ? Arrays.asList(items) : null); } /** @@ -415,7 +415,7 @@ public final class ConditionMessage { QUOTE { @Override protected String applyToItem(Object item) { - return (item != null ? "'" + item + "'" : null); + return (item != null) ? "'" + item + "'" : null; } }; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java index e83ae08c04e..03b0834b690 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -146,7 +146,7 @@ public class ConditionOutcome { @Override public String toString() { - return (this.message != null ? this.message.toString() : ""); + return (this.message != null) ? this.message.toString() : ""; } /** diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java index d6460a03f85..30ff152a4b2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java @@ -444,7 +444,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit } public SearchStrategy getStrategy() { - return (this.strategy != null ? this.strategy : SearchStrategy.ALL); + return (this.strategy != null) ? this.strategy : SearchStrategy.ALL; } public List getNames() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java index 1f0036eec61..d0abfc1bd45 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,7 +53,7 @@ class OnJavaCondition extends SpringBootCondition { JavaVersion version) { boolean match = isWithin(runningVersion, range, version); String expected = String.format( - range != Range.EQUAL_OR_NEWER ? "(older than %s)" : "(%s or newer)", + (range != Range.EQUAL_OR_NEWER) ? "(older than %s)" : "(%s or newer)", version); ConditionMessage message = ConditionMessage .forCondition(ConditionalOnJava.class, expected) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java index 2f696a53086..eb93acbca97 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java @@ -139,7 +139,7 @@ class OnPropertyCondition extends SpringBootCondition { "The name or value attribute of @ConditionalOnProperty must be specified"); Assert.state(value.length == 0 || name.length == 0, "The name and value attributes of @ConditionalOnProperty are exclusive"); - return (value.length > 0 ? value : name); + return (value.length > 0) ? value : name; } private void collectProperties(PropertyResolver resolver, List missing, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java index 25782601101..3097c7a9ad7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnResourceCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,8 +46,8 @@ class OnResourceCondition extends SpringBootCondition { AnnotatedTypeMetadata metadata) { MultiValueMap attributes = metadata .getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true); - ResourceLoader loader = (context.getResourceLoader() != null - ? context.getResourceLoader() : this.defaultResourceLoader); + ResourceLoader loader = (context.getResourceLoader() != null) + ? context.getResourceLoader() : this.defaultResourceLoader; List locations = new ArrayList<>(); collectValues(locations, attributes.get("resources")); Assert.isTrue(!locations.isEmpty(), diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfiguration.java index 45107c1ac71..545039a669b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseAutoConfiguration.java @@ -158,7 +158,7 @@ public class CouchbaseAutoConfiguration { return factory.apply(service.getMinEndpoints(), service.getMaxEndpoints()); } - int endpoints = (fallback != null ? fallback : 1); + int endpoints = (fallback != null) ? fallback : 1; return factory.apply(endpoints, endpoints); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java index 62c0b5c6055..456f0e2f6e7 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseProperties.java @@ -227,8 +227,8 @@ public class CouchbaseProperties { private String keyStorePassword; public Boolean getEnabled() { - return (this.enabled != null ? this.enabled - : StringUtils.hasText(this.keyStore)); + return (this.enabled != null) ? this.enabled + : StringUtils.hasText(this.keyStore); } public void setEnabled(Boolean enabled) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzer.java index 83aa6e98665..0d08f1ee1af 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzer.java @@ -87,7 +87,7 @@ class NoSuchBeanDefinitionFailureAnalyzer cause); StringBuilder message = new StringBuilder(); message.append(String.format("%s required %s that could not be found.%n", - (description != null ? description : "A component"), + (description != null) ? description : "A component", getBeanDescription(cause))); for (AutoConfigurationResult result : autoConfigurationResults) { message.append(String.format("\t- %s%n", result)); @@ -97,9 +97,8 @@ class NoSuchBeanDefinitionFailureAnalyzer } String action = String.format("Consider %s %s in your configuration.", (!autoConfigurationResults.isEmpty() - || !userConfigurationResults.isEmpty() - ? "revisiting the entries above or defining" - : "defining"), + || !userConfigurationResults.isEmpty()) + ? "revisiting the entries above or defining" : "defining", getBeanDescription(cause)); return new FailureAnalysis(message.toString(), action, cause); } @@ -201,8 +200,8 @@ class NoSuchBeanDefinitionFailureAnalyzer Source(String source) { String[] tokens = source.split("#"); - this.className = (tokens.length > 1 ? tokens[0] : source); - this.methodName = (tokens.length != 2 ? null : tokens[1]); + this.className = (tokens.length > 1) ? tokens[0] : source; + this.methodName = (tokens.length != 2) ? null : tokens[1]; } public String getClassName() { @@ -262,8 +261,8 @@ class NoSuchBeanDefinitionFailureAnalyzer private boolean hasName(MethodMetadata methodMetadata, String name) { Map attributes = methodMetadata .getAnnotationAttributes(Bean.class.getName()); - String[] candidates = (attributes != null ? (String[]) attributes.get("name") - : null); + String[] candidates = (attributes != null) ? (String[]) attributes.get("name") + : null; if (candidates != null) { for (String candidate : candidates) { if (candidate.equals(name)) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index 6d1bea6aa8e..2c4b05a0473 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -160,7 +160,7 @@ public class FlywayAutoConfiguration { private String getProperty(Supplier property, Supplier defaultValue) { String value = property.get(); - return (value != null ? value : defaultValue.get()); + return (value != null) ? value : defaultValue.get(); } private void checkLocationExists(String... locations) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java index 5ca3a78cc1f..fce63d348ae 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java @@ -109,7 +109,7 @@ public class FlywayProperties { } public String getPassword() { - return (this.password != null ? this.password : ""); + return (this.password != null) ? this.password : ""; } public void setPassword(String password) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpEncodingProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpEncodingProperties.java index 790deec4d47..9706a1ddf61 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpEncodingProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpEncodingProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -104,7 +104,7 @@ public class HttpEncodingProperties { } public boolean shouldForce(Type type) { - Boolean force = (type != Type.REQUEST ? this.forceResponse : this.forceRequest); + Boolean force = (type != Type.REQUEST) ? this.forceResponse : this.forceRequest; if (force == null) { force = this.force; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.java index b0d90a5f6da..97aa3e34628 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -69,7 +69,7 @@ public class HttpMessageConvertersAutoConfiguration { @ConditionalOnMissingBean public HttpMessageConverters messageConverters() { return new HttpMessageConverters( - this.converters != null ? this.converters : Collections.emptyList()); + (this.converters != null) ? this.converters : Collections.emptyList()); } @Configuration diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java index 11ed13c74e1..7d88679549a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/info/ProjectInfoAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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 class ProjectInfoAutoConfiguration { public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { ResourceLoader loader = context.getResourceLoader(); - loader = (loader != null ? loader : this.defaultResourceLoader); + loader = (loader != null) ? loader : this.defaultResourceLoader; Environment environment = context.getEnvironment(); String location = environment.getProperty("spring.info.git.location"); if (location == null) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java index ccf9e557af5..4c4e8d2c940 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -121,7 +121,7 @@ public class DataSourceAutoConfiguration { private ClassLoader getDataSourceClassLoader(ConditionContext context) { Class dataSourceClass = DataSourceBuilder .findType(context.getClassLoader()); - return (dataSourceClass != null ? dataSourceClass.getClassLoader() : null); + return (dataSourceClass != null) ? dataSourceClass.getClassLoader() : null; } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java index 72a26206f2c..f700d990e4a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java @@ -68,8 +68,8 @@ class DataSourceInitializer { ResourceLoader resourceLoader) { this.dataSource = dataSource; this.properties = properties; - this.resourceLoader = (resourceLoader != null ? resourceLoader - : new DefaultResourceLoader()); + this.resourceLoader = (resourceLoader != null) ? resourceLoader + : new DefaultResourceLoader(); } /** diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java index 839bfacdb38..aa9878a2e7d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java @@ -277,8 +277,8 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB return this.url; } String databaseName = determineDatabaseName(); - String url = (databaseName != null - ? this.embeddedDatabaseConnection.getUrl(databaseName) : null); + String url = (databaseName != null) + ? this.embeddedDatabaseConnection.getUrl(databaseName) : null; if (!StringUtils.hasText(url)) { throw new DataSourceBeanCreationException( "Failed to determine suitable jdbc url", this, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java index be584dc5750..e3a0ecb9d50 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -126,9 +126,9 @@ public class JmsProperties { public String formatConcurrency() { if (this.concurrency == null) { - return (this.maxConcurrency != null ? "1-" + this.maxConcurrency : null); + return (this.maxConcurrency != null) ? "1-" + this.maxConcurrency : null; } - return (this.maxConcurrency != null + return ((this.maxConcurrency != null) ? this.concurrency + "-" + this.maxConcurrency : String.valueOf(this.concurrency)); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java index 65e8134cd0d..b974955aa11 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQConnectionFactoryFactory.java @@ -48,8 +48,8 @@ class ActiveMQConnectionFactoryFactory { List factoryCustomizers) { Assert.notNull(properties, "Properties must not be null"); this.properties = properties; - this.factoryCustomizers = (factoryCustomizers != null ? factoryCustomizers - : Collections.emptyList()); + this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers + : Collections.emptyList(); } public T createConnectionFactory( diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java index 554010b7a5d..f80689244f1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java @@ -170,7 +170,7 @@ public class LiquibaseAutoConfiguration { private String getProperty(Supplier property, Supplier defaultValue) { String value = property.get(); - return (value != null ? value : defaultValue.get()); + return (value != null) ? value : defaultValue.get(); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java index 5aee8539036..ddd542605b3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java @@ -81,8 +81,8 @@ public class MongoClientFactory { if (options == null) { options = MongoClientOptions.builder().build(); } - String host = (this.properties.getHost() != null ? this.properties.getHost() - : "localhost"); + String host = (this.properties.getHost() != null) ? this.properties.getHost() + : "localhost"; return new MongoClient(Collections.singletonList(new ServerAddress(host, port)), options); } @@ -101,8 +101,8 @@ public class MongoClientFactory { int port = getValue(properties.getPort(), MongoProperties.DEFAULT_PORT); List seeds = Collections .singletonList(new ServerAddress(host, port)); - return (credentials != null ? new MongoClient(seeds, credentials, options) - : new MongoClient(seeds, options)); + return (credentials != null) ? new MongoClient(seeds, credentials, options) + : new MongoClient(seeds, options); } return createMongoClient(MongoProperties.DEFAULT_URI, options); } @@ -112,7 +112,7 @@ public class MongoClientFactory { } private T getValue(T value, T fallback) { - return (value != null ? value : fallback); + return (value != null) ? value : fallback; } private boolean hasCustomAddress() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java index 584601f41b7..c26607957dd 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -143,7 +143,7 @@ public class MongoProperties { } public String determineUri() { - return (this.uri != null ? this.uri : DEFAULT_URI); + return (this.uri != null) ? this.uri : DEFAULT_URI; } public void setUri(String uri) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java index 0664cd14fd7..f18cf8df1a8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/ReactiveMongoClientFactory.java @@ -54,8 +54,8 @@ public class ReactiveMongoClientFactory { List builderCustomizers) { this.properties = properties; this.environment = environment; - this.builderCustomizers = (builderCustomizers != null ? builderCustomizers - : Collections.emptyList()); + this.builderCustomizers = (builderCustomizers != null) ? builderCustomizers + : Collections.emptyList(); } /** @@ -86,8 +86,8 @@ public class ReactiveMongoClientFactory { private MongoClient createEmbeddedMongoClient(MongoClientSettings settings, int port) { Builder builder = builder(settings); - String host = (this.properties.getHost() != null ? this.properties.getHost() - : "localhost"); + String host = (this.properties.getHost() != null) ? this.properties.getHost() + : "localhost"; ClusterSettings clusterSettings = ClusterSettings.builder() .hosts(Collections.singletonList(new ServerAddress(host, port))).build(); builder.clusterSettings(clusterSettings); @@ -119,16 +119,16 @@ public class ReactiveMongoClientFactory { } private void applyCredentials(Builder builder) { - String database = (this.properties.getAuthenticationDatabase() != null + String database = (this.properties.getAuthenticationDatabase() != null) ? this.properties.getAuthenticationDatabase() - : this.properties.getMongoClientDatabase()); + : this.properties.getMongoClientDatabase(); builder.credential((MongoCredential.createCredential( this.properties.getUsername(), database, this.properties.getPassword()))); } private T getOrDefault(T value, T defaultValue) { - return (value != null ? value : defaultValue); + return (value != null) ? value : defaultValue; } private MongoClient createMongoClient(Builder builder) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index 27020816112..d39c0238074 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -131,13 +131,12 @@ public class EmbeddedMongoAutoConfiguration { this.embeddedProperties.getFeatures()); MongodConfigBuilder builder = new MongodConfigBuilder() .version(featureAwareVersion); - if (this.embeddedProperties.getStorage() != null) { - builder.replication( - new Storage(this.embeddedProperties.getStorage().getDatabaseDir(), - this.embeddedProperties.getStorage().getReplSetName(), - this.embeddedProperties.getStorage().getOplogSize() != null - ? this.embeddedProperties.getStorage().getOplogSize() - : 0)); + EmbeddedMongoProperties.Storage storage = this.embeddedProperties.getStorage(); + if (storage != null) { + String databaseDir = storage.getDatabaseDir(); + String replSetName = storage.getReplSetName(); + int oplogSize = (storage.getOplogSize() != null) ? storage.getOplogSize() : 0; + builder.replication(new Storage(databaseDir, replSetName, oplogSize)); } Integer configuredPort = this.properties.getPort(); if (configuredPort != null && configuredPort > 0) { @@ -257,7 +256,7 @@ public class EmbeddedMongoAutoConfiguration { Set features) { Assert.notNull(version, "version must not be null"); this.version = version; - this.features = (features != null ? features : Collections.emptySet()); + this.features = (features != null) ? features : Collections.emptySet(); } @Override diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java index b880a816a2e..6fe81d50606 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java @@ -83,8 +83,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor { private DataSource findDataSource(EntityManagerFactory entityManagerFactory) { Object dataSource = entityManagerFactory.getProperties() .get("javax.persistence.nonJtaDataSource"); - return (dataSource != null && dataSource instanceof DataSource - ? (DataSource) dataSource : this.dataSource); + return (dataSource != null && dataSource instanceof DataSource) + ? (DataSource) dataSource : this.dataSource; } private boolean isInitializingDatabase(DataSource dataSource) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateSettings.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateSettings.java index 8b21be88dbe..ff710111eaf 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateSettings.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateSettings.java @@ -50,7 +50,7 @@ public class HibernateSettings { } public String getDdlAuto() { - return (this.ddlAuto != null ? this.ddlAuto.get() : null); + return (this.ddlAuto != null) ? this.ddlAuto.get() : null; } public HibernateSettings hibernatePropertiesCustomizers( diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java index 3587f9b0557..d93a1eca4ec 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java @@ -244,7 +244,7 @@ public class JpaProperties { if (ddlAuto != null) { return ddlAuto; } - return (this.ddlAuto != null ? this.ddlAuto : defaultDdlAuto.get()); + return (this.ddlAuto != null) ? this.ddlAuto : defaultDdlAuto.get(); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration.java index 3e9d06f1806..59de80ab1d8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/quartz/QuartzAutoConfiguration.java @@ -147,7 +147,7 @@ public class QuartzAutoConfiguration { private DataSource getDataSource(DataSource dataSource, ObjectProvider quartzDataSource) { DataSource dataSourceIfAvailable = quartzDataSource.getIfAvailable(); - return (dataSourceIfAvailable != null ? dataSourceIfAvailable : dataSource); + return (dataSourceIfAvailable != null) ? dataSourceIfAvailable : dataSource; } @Bean diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapter.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapter.java index fea068fcf9f..056c1a0336f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapter.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesRegistrationAdapter.java @@ -71,15 +71,15 @@ final class OAuth2ClientPropertiesRegistrationAdapter { private static Builder getBuilder(String registrationId, String configuredProviderId, Map providers) { - String providerId = (configuredProviderId != null ? configuredProviderId - : registrationId); + String providerId = (configuredProviderId != null) ? configuredProviderId + : registrationId; CommonOAuth2Provider provider = getCommonProvider(providerId); if (provider == null && !providers.containsKey(providerId)) { throw new IllegalStateException( getErrorMessage(configuredProviderId, registrationId)); } - Builder builder = (provider != null ? provider.getBuilder(registrationId) - : ClientRegistration.withRegistrationId(registrationId)); + Builder builder = (provider != null) ? provider.getBuilder(registrationId) + : ClientRegistration.withRegistrationId(registrationId); if (providers.containsKey(providerId)) { return getBuilder(builder, providers.get(providerId)); } @@ -88,7 +88,7 @@ final class OAuth2ClientPropertiesRegistrationAdapter { private static String getErrorMessage(String configuredProviderId, String registrationId) { - return (configuredProviderId != null + return ((configuredProviderId != null) ? "Unknown provider ID '" + configuredProviderId + "'" : "Provider ID must be specified for client registration '" + registrationId + "'"); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java index a659958ae08..c468c35d1b5 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java @@ -93,7 +93,7 @@ final class SessionStoreMappings { } private String getName(Class configuration) { - return (configuration != null ? configuration.getName() : null); + return (configuration != null) ? configuration.getName() : null; } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java index 6cb46236dec..03be72cf7e3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -120,7 +120,7 @@ public abstract class AbstractViewResolverProperties { } public String getCharsetName() { - return (this.charset != null ? this.charset.name() : null); + return (this.charset != null) ? this.charset.name() : null; } public void setCharset(Charset charset) { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java index 506d185dfa0..92b8bd1d19f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -76,7 +76,7 @@ public class TemplateAvailabilityProviders { * @param applicationContext the source application context */ public TemplateAvailabilityProviders(ApplicationContext applicationContext) { - this(applicationContext != null ? applicationContext.getClassLoader() : null); + this((applicationContext != null) ? applicationContext.getClassLoader() : null); } /** @@ -143,12 +143,12 @@ public class TemplateAvailabilityProviders { if (provider == null) { synchronized (this.cache) { provider = findProvider(view, environment, classLoader, resourceLoader); - provider = (provider != null ? provider : NONE); + provider = (provider != null) ? provider : NONE; this.resolved.put(view, provider); this.cache.put(view, provider); } } - return (provider != NONE ? provider : null); + return (provider != NONE) ? provider : null; } private TemplateAvailabilityProvider findProvider(String view, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java index c965588d855..7eebe2fd4f8 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/TransactionManagerCustomizers.java @@ -36,8 +36,8 @@ public class TransactionManagerCustomizers { public TransactionManagerCustomizers( Collection> customizers) { - this.customizers = (customizers != null ? new ArrayList<>(customizers) - : Collections.emptyList()); + this.customizers = (customizers != null) ? new ArrayList<>(customizers) + : Collections.emptyList(); } @SuppressWarnings("unchecked") diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java index 30f0aff9198..a6546d8ed23 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java @@ -164,7 +164,7 @@ public class ResourceProperties { static Boolean getEnabled(boolean fixedEnabled, boolean contentEnabled, Boolean chainEnabled) { - return (fixedEnabled || contentEnabled ? Boolean.TRUE : chainEnabled); + return (fixedEnabled || contentEnabled) ? Boolean.TRUE : chainEnabled; } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java index b1e2c0272b1..c9765c47472 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java @@ -110,9 +110,9 @@ public class TomcatWebServerFactoryCustomizer implements } private int determineMaxHttpHeaderSize() { - return (this.serverProperties.getMaxHttpHeaderSize() > 0 + return (this.serverProperties.getMaxHttpHeaderSize() > 0) ? this.serverProperties.getMaxHttpHeaderSize() - : this.serverProperties.getTomcat().getMaxHttpHeaderSize()); + : this.serverProperties.getTomcat().getMaxHttpHeaderSize(); } private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory, diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java index 4fa410548a4..2ad1eb96b18 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java @@ -205,7 +205,7 @@ public abstract class AbstractErrorWebExceptionHandler } private String htmlEscape(Object input) { - return (input != null ? HtmlUtils.htmlEscape(input.toString()) : null); + return (input != null) ? HtmlUtils.htmlEscape(input.toString()) : null; } @Override diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java index b9707161639..2b64db4cffa 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.java @@ -338,7 +338,7 @@ public class WebMvcAutoConfiguration { } private Integer getSeconds(Duration cachePeriod) { - return (cachePeriod != null ? (int) cachePeriod.getSeconds() : null); + return (cachePeriod != null) ? (int) cachePeriod.getSeconds() : null; } @Bean diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java index 7f282437a6e..e4612f72aba 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorController.java @@ -91,7 +91,7 @@ public class BasicErrorController extends AbstractErrorController { request, isIncludeStackTrace(request, MediaType.TEXT_HTML))); response.setStatus(status.value()); ModelAndView modelAndView = resolveErrorView(request, response, status, model); - return (modelAndView != null ? modelAndView : new ModelAndView("error", model)); + return (modelAndView != null) ? modelAndView : new ModelAndView("error", model); } @RequestMapping diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.java index 25431fd514e..ee7e7a2cd90 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.java @@ -316,11 +316,13 @@ public class ErrorMvcAutoConfiguration { @Override public String resolvePlaceholder(String placeholderName) { Expression expression = this.expressions.get(placeholderName); - return escape(expression != null ? expression.getValue(this.context) : null); + Object expressionValue = (expression != null) + ? expression.getValue(this.context) : null; + return escape(expressionValue); } private String escape(Object value) { - return HtmlUtils.htmlEscape(value != null ? value.toString() : null); + return HtmlUtils.htmlEscape((value != null) ? value.toString() : null); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastJpaDependencyAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastJpaDependencyAutoConfigurationTests.java index 71eafedf2dd..7cc6b73b787 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastJpaDependencyAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastJpaDependencyAutoConfigurationTests.java @@ -102,7 +102,7 @@ public class HazelcastJpaDependencyAutoConfigurationTests { String[] dependsOn = ((BeanDefinitionRegistry) context .getSourceApplicationContext()).getBeanDefinition("entityManagerFactory") .getDependsOn(); - return (dependsOn != null ? Arrays.asList(dependsOn) : Collections.emptyList()); + return (dependsOn != null) ? Arrays.asList(dependsOn) : Collections.emptyList(); } @Configuration diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MockServletWebServerFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MockServletWebServerFactory.java index 7807b0a5862..038bea94223 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MockServletWebServerFactory.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MockServletWebServerFactory.java @@ -52,17 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory } public ServletContext getServletContext() { - return (getWebServer() != null ? getWebServer().getServletContext() : null); + return (getWebServer() != null) ? getWebServer().getServletContext() : null; } public RegisteredServlet getRegisteredServlet(int index) { - return (getWebServer() != null ? getWebServer().getRegisteredServlet(index) - : null); + return (getWebServer() != null) ? getWebServer().getRegisteredServlet(index) + : null; } public RegisteredFilter getRegisteredFilter(int index) { - return (getWebServer() != null ? getWebServer().getRegisteredFilters(index) - : null); + return (getWebServer() != null) ? getWebServer().getRegisteredFilters(index) + : null; } public static class MockServletWebServer diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationWebApplicationInitializer.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationWebApplicationInitializer.java index a466688de82..0f9c76b6a85 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationWebApplicationInitializer.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationWebApplicationInitializer.java @@ -64,7 +64,7 @@ public class SpringApplicationWebApplicationInitializer private Manifest getManifest(ServletContext servletContext) throws IOException { InputStream stream = servletContext.getResourceAsStream("/META-INF/MANIFEST.MF"); - return (stream != null ? new Manifest(stream) : null); + return (stream != null) ? new Manifest(stream) : null; } @Override diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java index 1a0e202e3d7..b3693f42bf2 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandRunner.java @@ -171,7 +171,7 @@ public class CommandRunner implements Iterable { ExitStatus result = run(argsWithoutDebugFlags); // The caller will hang up if it gets a non-zero status if (result != null && result.isHangup()) { - return (result.getCode() > 0 ? result.getCode() : 0); + return (result.getCode() > 0) ? result.getCode() : 0; } return 0; } @@ -260,7 +260,7 @@ public class CommandRunner implements Iterable { } protected boolean errorMessage(String message) { - Log.error(message != null ? message : "Unexpected error"); + Log.error((message != null) ? message : "Unexpected error"); return message != null; } @@ -280,8 +280,8 @@ public class CommandRunner implements Iterable { String usageHelp = command.getUsageHelp(); String description = command.getDescription(); Log.info(String.format("%n %1$s %2$-15s%n %3$s", command.getName(), - (usageHelp != null ? usageHelp : ""), - (description != null ? description : ""))); + (usageHelp != null) ? usageHelp : "", + (description != null) ? description : "")); } } Log.info(""); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java index 84fb7a60957..7f72e75db2a 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java @@ -230,7 +230,7 @@ abstract class ArchiveCommand extends OptionParsingCommand { private String commaDelimitedClassNames(Class[] classes) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < classes.length; i++) { - builder.append(i != 0 ? "," : ""); + builder.append((i != 0) ? "," : ""); builder.append(classes[i].getName()); } return builder.toString(); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java index c101cf71250..6f1c29a06bb 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HelpCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -107,7 +107,7 @@ public class HelpCommand extends AbstractCommand { } Collection examples = command.getExamples(); if (examples != null) { - Log.info(examples.size() != 1 ? "examples:" : "example:"); + Log.info((examples.size() != 1) ? "examples:" : "example:"); Log.info(""); for (HelpExample example : examples) { Log.info(" " + example.getDescription() + ":"); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java index 5eef4fd9484..8abbe89e33f 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/core/HintCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -45,7 +45,7 @@ public class HintCommand extends AbstractCommand { @Override public ExitStatus run(String... args) throws Exception { try { - int index = (args.length != 0 ? Integer.valueOf(args[0]) - 1 : 0); + int index = (args.length != 0) ? Integer.valueOf(args[0]) - 1 : 0; List arguments = new ArrayList<>(args.length); for (int i = 2; i < args.length; i++) { arguments.add(args[i]); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java index 0f0849ca9ef..a9b05bc4d4f 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java @@ -240,7 +240,7 @@ class InitializrService { private String getContent(HttpEntity entity) throws IOException { ContentType contentType = ContentType.getOrDefault(entity); Charset charset = contentType.getCharset(); - charset = (charset != null ? charset : StandardCharsets.UTF_8); + charset = (charset != null) ? charset : StandardCharsets.UTF_8; byte[] content = FileCopyUtils.copyToByteArray(entity.getContent()); return new String(content, charset); } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java index c01ad6d6e97..dbf0a126225 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerationRequest.java @@ -416,7 +416,7 @@ class ProjectGenerationRequest { } if (this.output != null) { int i = this.output.lastIndexOf('.'); - return (i != -1 ? this.output.substring(0, i) : this.output); + return (i != -1) ? this.output.substring(0, i) : this.output; } return null; } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java index 0c9725182a0..bf9faf2a3c4 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -45,8 +45,8 @@ class ProjectGenerator { public void generateProject(ProjectGenerationRequest request, boolean force) throws IOException { ProjectGenerationResponse response = this.initializrService.generate(request); - String fileName = (request.getOutput() != null ? request.getOutput() - : response.getFileName()); + String fileName = (request.getOutput() != null) ? request.getOutput() + : response.getFileName(); if (shouldExtract(request, response)) { if (isZipArchive(response)) { extractProject(response, request.getOutput(), force); @@ -100,8 +100,8 @@ class ProjectGenerator { private void extractProject(ProjectGenerationResponse entity, String output, boolean overwrite) throws IOException { - File outputFolder = (output != null ? new File(output) - : new File(System.getProperty("user.dir"))); + File outputFolder = (output != null) ? new File(output) + : new File(System.getProperty("user.dir")); if (!outputFolder.exists()) { outputFolder.mkdirs(); } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/InstallCommand.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/InstallCommand.java index a8856a4da12..dd96bf0a8ba 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/InstallCommand.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/InstallCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -59,7 +59,7 @@ public class InstallCommand extends OptionParsingCommand { } catch (Exception ex) { String message = ex.getMessage(); - Log.error(message != null ? message : ex.getClass().toString()); + Log.error((message != null) ? message : ex.getClass().toString()); } return ExitStatus.OK; } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/UninstallCommand.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/UninstallCommand.java index 1e07bc48a0a..2c547bef1e2 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/UninstallCommand.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/UninstallCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -75,7 +75,7 @@ public class UninstallCommand extends OptionParsingCommand { } catch (Exception ex) { String message = ex.getMessage(); - Log.error(message != null ? message : ex.getClass().toString()); + Log.error((message != null) ? message : ex.getClass().toString()); } return ExitStatus.OK; } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java index db0a2236ee3..871be69a999 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/OptionHandler.java @@ -157,7 +157,8 @@ public class OptionHandler { OptionHelpAdapter(OptionDescriptor descriptor) { this.options = new LinkedHashSet<>(); for (String option : descriptor.options()) { - this.options.add((option.length() != 1 ? "--" : "-") + option); + String prefix = (option.length() != 1) ? "--" : "-"; + this.options.add(prefix + option); } if (this.options.contains("--cp")) { this.options.remove("--cp"); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java index 78695d83ad3..0ccecf0632c 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/options/SourceOptions.java @@ -130,7 +130,7 @@ public class SourceOptions { } private String asString(Object arg) { - return (arg != null ? String.valueOf(arg) : null); + return (arg != null) ? String.valueOf(arg) : null; } public List getSources() { diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java index 13e1d7e8d9f..4fbfec961ff 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/CommandCompleter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -129,7 +129,7 @@ public class CommandCompleter extends StringsCompleter { OptionHelpLine(OptionHelp optionHelp) { StringBuilder options = new StringBuilder(); for (String option : optionHelp.getOptions()) { - options.append(options.length() != 0 ? ", " : ""); + options.append((options.length() != 0) ? ", " : ""); options.append(option); } this.options = options.toString(); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java index 3edd30777e6..ef6ff2f8ce2 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -140,7 +140,7 @@ public class Shell { private void printBanner() { String version = getClass().getPackage().getImplementationVersion(); - version = (version != null ? " (v" + version + ")" : ""); + version = (version != null) ? " (v" + version + ")" : ""; System.out.println(ansi("Spring Boot", Code.BOLD).append(version, Code.FAINT)); System.out.println(ansi("Hit TAB to complete. Type 'help' and hit " + "RETURN for help, and 'exit' to quit.")); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java index 22bc88a63e8..3538dba54ba 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java @@ -115,7 +115,7 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader { InputStream resourceStream = super.getResourceAsStream(name); if (resourceStream == null) { byte[] bytes = this.classResources.get(name); - resourceStream = (bytes != null ? new ByteArrayInputStream(bytes) : null); + resourceStream = (bytes != null) ? new ByteArrayInputStream(bytes) : null; } return resourceStream; } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java index 4db54953069..5b284f766a4 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ResolveDependencyCoordinatesTransformation.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,7 +77,7 @@ public class ResolveDependencyCoordinatesTransformation Expression expression = annotation.getMember("value"); if (expression instanceof ConstantExpression) { Object value = ((ConstantExpression) expression).getValue(); - return (value instanceof String ? (String) value : null); + return (value instanceof String) ? (String) value : null; } return null; } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolver.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolver.java index 2bb1a7517c1..59cc21a8815 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolver.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagementArtifactCoordinatesResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -42,13 +42,13 @@ public class DependencyManagementArtifactCoordinatesResolver @Override public String getGroupId(String artifactId) { Dependency dependency = find(artifactId); - return (dependency != null ? dependency.getGroupId() : null); + return (dependency != null) ? dependency.getGroupId() : null; } @Override public String getArtifactId(String id) { Dependency dependency = find(id); - return (dependency != null ? dependency.getArtifactId() : null); + return (dependency != null) ? dependency.getArtifactId() : null; } private Dependency find(String id) { @@ -69,7 +69,7 @@ public class DependencyManagementArtifactCoordinatesResolver @Override public String getVersion(String module) { Dependency dependency = find(module); - return (dependency != null ? dependency.getVersion() : null); + return (dependency != null) ? dependency.getVersion() : null; } } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java index eec15605b86..6673ba406de 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java @@ -197,7 +197,7 @@ public class AetherGrapeEngine implements GrapeEngine { private boolean isTransitive(Map dependencyMap) { Boolean transitive = (Boolean) dependencyMap.get("transitive"); - return (transitive != null ? transitive : true); + return (transitive != null) ? transitive : true; } private List getDependencies(DependencyResult dependencyResult) { @@ -219,7 +219,7 @@ public class AetherGrapeEngine implements GrapeEngine { private GroovyClassLoader getClassLoader(Map args) { GroovyClassLoader classLoader = (GroovyClassLoader) args.get("classLoader"); - return (classLoader != null ? classLoader : this.classLoader); + return (classLoader != null) ? classLoader : this.classLoader; } @Override diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java index 75ba927636c..76b8acec240 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DefaultRepositorySystemSessionAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -51,9 +51,9 @@ public class DefaultRepositorySystemSessionAutoConfiguration ProxySelector existing = session.getProxySelector(); if (existing == null || !(existing instanceof CompositeProxySelector)) { JreProxySelector fallback = new JreProxySelector(); - ProxySelector selector = (existing != null + ProxySelector selector = (existing != null) ? new CompositeProxySelector(Arrays.asList(existing, fallback)) - : fallback); + : fallback; session.setProxySelector(selector); } } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java index f7d0773a281..ef345b7e239 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionContext.java @@ -67,7 +67,7 @@ public class DependencyResolutionContext { dependency = this.managedDependencyByGroupAndArtifact .get(getIdentifier(groupId, artifactId)); } - return (dependency != null ? dependency.getArtifact().getVersion() : null); + return (dependency != null) ? dependency.getArtifact().getVersion() : null; } public List getManagedDependencies() { @@ -104,10 +104,10 @@ public class DependencyResolutionContext { this.managedDependencyByGroupAndArtifact.put(getIdentifier(aetherDependency), aetherDependency); } - this.dependencyManagement = (this.dependencyManagement != null + this.dependencyManagement = (this.dependencyManagement != null) ? new CompositeDependencyManagement(dependencyManagement, this.dependencyManagement) - : dependencyManagement); + : dependencyManagement; this.artifactCoordinatesResolver = new DependencyManagementArtifactCoordinatesResolver( this.dependencyManagement); } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/maven/MavenSettings.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/maven/MavenSettings.java index 76f6a16245c..c102665d92f 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/maven/MavenSettings.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/maven/MavenSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -150,8 +150,9 @@ public class MavenSettings { PrintWriter printer = new PrintWriter(message); printer.println("Failed to determine active profiles:"); for (ModelProblemCollectorRequest problem : problemCollector.getProblems()) { - printer.println(" " + problem.getMessage() + (problem.getLocation() != null - ? " at " + problem.getLocation() : "")); + String location = (problem.getLocation() != null) + ? " at " + problem.getLocation() : ""; + printer.println(" " + problem.getMessage() + location); if (problem.getException() != null) { printer.println(indentStackTrace(problem.getException(), " ")); } diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java index f4c1e574041..538363188b8 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -88,8 +88,8 @@ public abstract class AbstractHttpClientMockTests { CloseableHttpResponse response = mock(CloseableHttpResponse.class); mockHttpEntity(response, request.content, request.contentType); mockStatus(response, 200); - String header = (request.fileName != null - ? contentDispositionValue(request.fileName) : null); + String header = (request.fileName != null) + ? contentDispositionValue(request.fileName) : null; mockHttpHeader(response, "Content-Disposition", header); given(this.http.execute(argThat(getForNonMetadata()))).willReturn(response); } @@ -119,8 +119,8 @@ public abstract class AbstractHttpClientMockTests { try { HttpEntity entity = mock(HttpEntity.class); given(entity.getContent()).willReturn(new ByteArrayInputStream(content)); - Header contentTypeHeader = (contentType != null - ? new BasicHeader("Content-Type", contentType) : null); + Header contentTypeHeader = (contentType != null) + ? new BasicHeader("Content-Type", contentType) : null; given(entity.getContentType()).willReturn(contentTypeHeader); given(response.getEntity()).willReturn(entity); return entity; @@ -138,7 +138,7 @@ public abstract class AbstractHttpClientMockTests { protected void mockHttpHeader(CloseableHttpResponse response, String headerName, String value) { - Header header = (value != null ? new BasicHeader(headerName, value) : null); + Header header = (value != null) ? new BasicHeader(headerName, value) : null; given(response.getFirstHeader(headerName)).willReturn(header); } diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java index 4ccd46a2fde..c08d9f61d80 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/ProjectGenerationRequestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -232,8 +232,8 @@ public class ProjectGenerationRequestTests { } public void setBuildAndFormat(String build, String format) { - this.request.setBuild(build != null ? build : "maven"); - this.request.setFormat(format != null ? format : "project"); + this.request.setBuild((build != null) ? build : "maven"); + this.request.setFormat((format != null) ? format : "project"); this.request.setDetectType(true); } diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java index c5bf6696170..8ddb7ae0beb 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/RemoteDevToolsAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,6 +29,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.web.ServerProperties; +import org.springframework.boot.autoconfigure.web.ServerProperties.Servlet; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.devtools.remote.server.AccessManager; import org.springframework.boot.devtools.remote.server.Dispatcher; @@ -84,10 +85,11 @@ public class RemoteDevToolsAutoConfiguration { @Bean public HandlerMapper remoteDevToolsHealthCheckHandlerMapper() { Handler handler = new HttpStatusHandler(); + Servlet servlet = this.serverProperties.getServlet(); + String servletContextPath = (servlet.getContextPath() != null) + ? servlet.getContextPath() : ""; return new UrlHandlerMapper( - (this.serverProperties.getServlet().getContextPath() != null - ? this.serverProperties.getServlet().getContextPath() : "") - + this.properties.getRemote().getContextPath(), + servletContextPath + this.properties.getRemote().getContextPath(), handler); } @@ -127,9 +129,11 @@ public class RemoteDevToolsAutoConfiguration { @Bean @ConditionalOnMissingBean(name = "remoteRestartHandlerMapper") public UrlHandlerMapper remoteRestartHandlerMapper(HttpRestartServer server) { - String url = (this.serverProperties.getServlet().getContextPath() != null - ? this.serverProperties.getServlet().getContextPath() : "") - + this.properties.getRemote().getContextPath() + "/restart"; + Servlet servlet = this.serverProperties.getServlet(); + RemoteDevToolsProperties remote = this.properties.getRemote(); + String servletContextPath = (servlet.getContextPath() != null) + ? servlet.getContextPath() : ""; + String url = servletContextPath + remote.getContextPath() + "/restart"; logger.warn("Listening for remote restart updates on " + url); Handler handler = new HttpRestartServerHandler(server); return new UrlHandlerMapper(url, handler); diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessor.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessor.java index 174f050a64e..3077664b5ae 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessor.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/env/DevToolsHomePropertiesPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -44,7 +44,7 @@ public class DevToolsHomePropertiesPostProcessor implements EnvironmentPostProce public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { File home = getHomeFolder(); - File propertyFile = (home != null ? new File(home, FILE_NAME) : null); + File propertyFile = (home != null) ? new File(home, FILE_NAME) : null; if (propertyFile != null && propertyFile.exists() && propertyFile.isFile()) { FileSystemResource resource = new FileSystemResource(propertyFile); Properties properties; diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java index 6ae40514b09..091c0e02213 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java @@ -132,8 +132,8 @@ public class ClassPathChangeUploader private void logUpload(ClassLoaderFiles classLoaderFiles) { int size = classLoaderFiles.size(); - logger.info( - "Uploaded " + size + " class " + (size != 1 ? "resources" : "resource")); + logger.info("Uploaded " + size + " class " + + ((size != 1) ? "resources" : "resource")); } private byte[] serialize(ClassLoaderFiles classLoaderFiles) throws IOException { @@ -160,10 +160,10 @@ public class ClassPathChangeUploader private ClassLoaderFile asClassLoaderFile(ChangedFile changedFile) throws IOException { ClassLoaderFile.Kind kind = TYPE_MAPPINGS.get(changedFile.getType()); - byte[] bytes = (kind != Kind.DELETED - ? FileCopyUtils.copyToByteArray(changedFile.getFile()) : null); - long lastModified = (kind != Kind.DELETED ? changedFile.getFile().lastModified() - : System.currentTimeMillis()); + byte[] bytes = (kind != Kind.DELETED) + ? FileCopyUtils.copyToByteArray(changedFile.getFile()) : null; + long lastModified = (kind != Kind.DELETED) ? changedFile.getFile().lastModified() + : System.currentTimeMillis(); return new ClassLoaderFile(kind, lastModified, bytes); } diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFile.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFile.java index 6b529213837..bcfc900e8da 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFile.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFile.java @@ -55,8 +55,8 @@ public class ClassLoaderFile implements Serializable { */ public ClassLoaderFile(Kind kind, long lastModified, byte[] contents) { Assert.notNull(kind, "Kind must not be null"); - Assert.isTrue(kind != Kind.DELETED ? contents != null : contents == null, - () -> "Contents must " + (kind != Kind.DELETED ? "not " : "") + Assert.isTrue((kind != Kind.DELETED) ? contents != null : contents == null, + () -> "Contents must " + ((kind != Kind.DELETED) ? "not " : "") + "be null"); this.kind = kind; this.lastModified = lastModified; diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java index 121adb0c438..8d56dfa1cdc 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -88,8 +88,8 @@ public class HttpTunnelConnection implements TunnelConnection { throw new IllegalArgumentException("Malformed URL '" + url + "'"); } this.requestFactory = requestFactory; - this.executor = (executor != null ? executor - : Executors.newCachedThreadPool(new TunnelThreadFactory())); + this.executor = (executor != null) ? executor + : Executors.newCachedThreadPool(new TunnelThreadFactory()); } @Override diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java index ee3b92b7778..de9de9d1edd 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -139,7 +139,7 @@ public class ClassPathChangeUploaderTests { private void assertClassFile(ClassLoaderFile file, String content, Kind kind) { assertThat(file.getContents()) - .isEqualTo(content != null ? content.getBytes() : null); + .isEqualTo((content != null) ? content.getBytes() : null); assertThat(file.getKind()).isEqualTo(kind); } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java index 42ab33fb599..053d4048178 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/test/MockClientHttpRequestFactory.java @@ -119,7 +119,7 @@ public class MockClientHttpRequestFactory implements ClientHttpRequestFactory { public ClientHttpResponse asHttpResponse(AtomicLong seq) { MockClientHttpResponse httpResponse = new MockClientHttpResponse( - this.payload != null ? this.payload : NO_DATA, this.status); + (this.payload != null) ? this.payload : NO_DATA, this.status); waitForDelay(); if (this.payload != null) { httpResponse.getHeaders().setContentLength(this.payload.length); diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/spock/SpockTestRestTemplateExample.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/spock/SpockTestRestTemplateExample.java index ce0e2900fd8..7a8b1f0ea66 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/spock/SpockTestRestTemplateExample.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/test/spock/SpockTestRestTemplateExample.java @@ -45,8 +45,8 @@ public class SpockTestRestTemplateExample { ObjectProvider builderProvider, Environment environment) { RestTemplateBuilder builder = builderProvider.getIfAvailable(); - TestRestTemplate template = (builder != null ? new TestRestTemplate(builder) - : new TestRestTemplate()); + TestRestTemplate template = (builder != null) ? new TestRestTemplate(builder) + : new TestRestTemplate(); template.setUriTemplateHandler(new LocalHostUriTemplateHandler(environment)); return template; } diff --git a/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java b/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java index a193c3bca37..41c92459051 100644 --- a/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java +++ b/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java @@ -148,7 +148,7 @@ class PropertiesMigrationReport { } private List asNewList(List source) { - return (source != null ? new ArrayList<>(source) : Collections.emptyList()); + return (source != null) ? new ArrayList<>(source) : Collections.emptyList(); } public List getRenamed() { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java index 81f45d838b2..3ea3c774ec9 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java @@ -105,8 +105,8 @@ public class AnnotationsPropertySource extends EnumerablePropertySource } Annotation mergedAnnotation = AnnotatedElementUtils.getMergedAnnotation(source, annotationType); - return (mergedAnnotation != null ? mergedAnnotation - : findMergedAnnotation(source.getSuperclass(), annotationType)); + return (mergedAnnotation != null) ? mergedAnnotation + : findMergedAnnotation(source.getSuperclass(), annotationType); } private void collectProperties(Annotation annotation, Method attribute, @@ -143,8 +143,8 @@ public class AnnotationsPropertySource extends EnumerablePropertySource private String getName(PropertyMapping typeMapping, PropertyMapping attributeMapping, Method attribute) { - String prefix = (typeMapping != null ? typeMapping.value() : ""); - String name = (attributeMapping != null ? attributeMapping.value() : ""); + String prefix = (typeMapping != null) ? typeMapping.value() : ""; + String name = (attributeMapping != null) ? attributeMapping.value() : ""; if (!StringUtils.hasText(name)) { name = toKebabCase(attribute.getName()); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java index e5c48656d4b..36d2db09782 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java @@ -115,10 +115,10 @@ class PropertyMappingContextCustomizer implements ContextCustomizer { private String getAnnotationsDescription(Set> annotations) { StringBuilder result = new StringBuilder(); for (Class annotation : annotations) { - result.append(result.length() != 0 ? ", " : ""); + result.append((result.length() != 0) ? ", " : ""); result.append("@" + ClassUtils.getShortName(annotation)); } - result.insert(0, annotations.size() != 1 ? "annotations " : "annotation "); + result.insert(0, (annotations.size() != 1) ? "annotations " : "annotation "); return result.toString(); } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverScope.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverScope.java index f8aec348ec5..5cee44093fb 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverScope.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -139,7 +139,7 @@ class WebDriverScope implements Scope { if (context instanceof ConfigurableApplicationContext) { Scope scope = ((ConfigurableApplicationContext) context).getBeanFactory() .getRegisteredScope(NAME); - return (scope instanceof WebDriverScope ? (WebDriverScope) scope : null); + return (scope instanceof WebDriverScope) ? (WebDriverScope) scope : null; } return null; } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java index fcee0a2d28e..fa78ed9108f 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java @@ -168,10 +168,10 @@ class ImportsContextCustomizer implements ContextCustomizer { public String[] selectImports(AnnotationMetadata importingClassMetadata) { BeanDefinition definition = this.beanFactory .getBeanDefinition(ImportsConfiguration.BEAN_NAME); - Object testClass = (definition != null - ? definition.getAttribute(TEST_CLASS_ATTRIBUTE) : null); - return (testClass != null ? new String[] { ((Class) testClass).getName() } - : NO_IMPORTS); + Object testClass = (definition != null) + ? definition.getAttribute(TEST_CLASS_ATTRIBUTE) : null; + return (testClass != null) ? new String[] { ((Class) testClass).getName() } + : NO_IMPORTS; } } @@ -245,7 +245,7 @@ class ImportsContextCustomizer implements ContextCustomizer { collectClassAnnotations(testClass, annotations, seen); Set determinedImports = determineImports(annotations, testClass); this.key = Collections.unmodifiableSet( - determinedImports != null ? determinedImports : annotations); + (determinedImports != null) ? determinedImports : annotations); } private void collectClassAnnotations(Class classType, diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootConfigurationFinder.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootConfigurationFinder.java index 54f07aaa493..954a626b074 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootConfigurationFinder.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootConfigurationFinder.java @@ -79,7 +79,7 @@ final class SpringBootConfigurationFinder { private String getParentPackage(String sourcePackage) { int lastDot = sourcePackage.lastIndexOf('.'); - return (lastDot != -1 ? sourcePackage.substring(0, lastDot) : ""); + return (lastDot != -1) ? sourcePackage.substring(0, lastDot) : ""; } /** diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java index d320b31b1ac..1250f39fdb7 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java @@ -110,9 +110,9 @@ public class SpringBootContextLoader extends AbstractContextLoader { if (!ObjectUtils.isEmpty(config.getActiveProfiles())) { setActiveProfiles(environment, config.getActiveProfiles()); } - ResourceLoader resourceLoader = (application.getResourceLoader() != null + ResourceLoader resourceLoader = (application.getResourceLoader() != null) ? application.getResourceLoader() - : new DefaultResourceLoader(getClass().getClassLoader())); + : new DefaultResourceLoader(getClass().getClassLoader()); TestPropertySourceUtils.addPropertiesFilesToEnvironment(environment, resourceLoader, config.getPropertySourceLocations()); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java index 3ee521bed71..a80d5337896 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootTestContextBootstrapper.java @@ -166,8 +166,8 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr WebAppConfiguration webAppConfiguration = AnnotatedElementUtils .findMergedAnnotation(mergedConfig.getTestClass(), WebAppConfiguration.class); - String resourceBasePath = (webAppConfiguration != null - ? webAppConfiguration.value() : "src/main/webapp"); + String resourceBasePath = (webAppConfiguration != null) + ? webAppConfiguration.value() : "src/main/webapp"; mergedConfig = new WebMergedContextConfiguration(mergedConfig, resourceBasePath); } @@ -316,17 +316,17 @@ public class SpringBootTestContextBootstrapper extends DefaultTestContextBootstr */ protected WebEnvironment getWebEnvironment(Class testClass) { SpringBootTest annotation = getAnnotation(testClass); - return (annotation != null ? annotation.webEnvironment() : null); + return (annotation != null) ? annotation.webEnvironment() : null; } protected Class[] getClasses(Class testClass) { SpringBootTest annotation = getAnnotation(testClass); - return (annotation != null ? annotation.classes() : null); + return (annotation != null) ? annotation.classes() : null; } protected String[] getProperties(Class testClass) { SpringBootTest annotation = getAnnotation(testClass); - return (annotation != null ? annotation.properties() : null); + return (annotation != null) ? annotation.properties() : null; } protected SpringBootTest getAnnotation(Class testClass) { diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java index 4e2d1aaa8c8..f1fc7902052 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java @@ -278,8 +278,8 @@ public class ApplicationContextAssert "%nExpecting:%n <%s>%nsingle bean of type:%n <%s>%nbut found:%n <%s>", getApplicationContext(), type, names)); } - T bean = (names.length != 0 ? getApplicationContext().getBean(names[0], type) - : null); + T bean = (names.length != 0) ? getApplicationContext().getBean(names[0], type) + : null; return Assertions.assertThat(bean).as("Bean of type <%s> from <%s>", type, getApplicationContext()); } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/WebApplicationContextRunner.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/WebApplicationContextRunner.java index ff5fe56abb9..8a5924c9c28 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/WebApplicationContextRunner.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/WebApplicationContextRunner.java @@ -93,11 +93,11 @@ public final class WebApplicationContextRunner extends */ public static Supplier withMockServletContext( Supplier contextFactory) { - return (contextFactory != null ? () -> { + return (contextFactory != null) ? () -> { ConfigurableWebApplicationContext context = contextFactory.get(); context.setServletContext(new MockServletContext()); return context; - } : null); + } : null; } } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContent.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContent.java index 798fffc80aa..3ba1e62f844 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContent.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -74,8 +74,8 @@ public final class JsonContent implements AssertProvider { @Override public String toString() { - return "JsonContent " + this.json - + (this.type != null ? " created from " + this.type : ""); + String createdFrom = (this.type != null) ? " created from " + this.type : ""; + return "JsonContent " + this.json + createdFrom; } } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java index 8e25f6ffca2..cee123ebb59 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -991,7 +991,7 @@ public class JsonContentAssert extends AbstractAssert resourceLoadClass, Charset charset) { this.resourceLoadClass = resourceLoadClass; - this.charset = (charset != null ? charset : StandardCharsets.UTF_8); + this.charset = (charset != null) ? charset : StandardCharsets.UTF_8; } Class getResourceLoadClass() { diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContent.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContent.java index 1dc778fff63..1bb06e959f4 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContent.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -62,8 +62,8 @@ public final class ObjectContent implements AssertProvider map = getOrAdd(sources, name); for (String pair : pairs) { int index = getSeparatorIndex(pair); - String key = (index > 0 ? pair.substring(0, index) : pair); - String value = (index > 0 ? pair.substring(index + 1) : ""); + String key = (index > 0) ? pair.substring(0, index) : pair; + String value = (index > 0) ? pair.substring(index + 1) : ""; map.put(key.trim(), value.trim()); } } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/util/TestPropertyValues.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/util/TestPropertyValues.java index 83f2fb8f5c8..6b051f5ea7b 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/util/TestPropertyValues.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/util/TestPropertyValues.java @@ -235,7 +235,7 @@ public final class TestPropertyValues { } protected String applySuffix(String name) { - return (this.suffix != null ? name + "-" + this.suffix : name); + return (this.suffix != null) ? name + "-" + this.suffix : name; } } @@ -261,8 +261,8 @@ public final class TestPropertyValues { public static Pair parse(String pair) { int index = getSeparatorIndex(pair); - String name = (index > 0 ? pair.substring(0, index) : pair); - String value = (index > 0 ? pair.substring(index + 1) : ""); + String name = (index > 0) ? pair.substring(0, index) : pair; + String value = (index > 0) ? pair.substring(index + 1) : ""; return of(name.trim(), value.trim()); } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java index e4061073ebb..fae15fd2751 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java @@ -130,7 +130,7 @@ public class TestRestTemplate { */ public TestRestTemplate(RestTemplateBuilder restTemplateBuilder, String username, String password, HttpClientOption... httpClientOptions) { - this(restTemplateBuilder != null ? restTemplateBuilder.build() : null, username, + this((restTemplateBuilder != null) ? restTemplateBuilder.build() : null, username, password, httpClientOptions); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java b/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java index d3d06890f86..6c6a8937258 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java @@ -152,7 +152,7 @@ public class AutoConfigureAnnotationProcessor extends AbstractProcessor { private String toCommaDelimitedString(List list) { StringBuilder result = new StringBuilder(); for (Object item : list) { - result.append(result.length() != 0 ? "," : ""); + result.append((result.length() != 0) ? "," : ""); result.append(item); } return result.toString(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/AbstractConfigurationMetadataTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/AbstractConfigurationMetadataTests.java index 86e407ee8e7..a3cd8bb1f31 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/AbstractConfigurationMetadataTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/test/java/org/springframework/boot/configurationmetadata/AbstractConfigurationMetadataTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -50,7 +50,7 @@ public abstract class AbstractConfigurationMetadataTests { assertThat(actual).isNotNull(); assertThat(actual.getId()).isEqualTo(id); assertThat(actual.getName()).isEqualTo(name); - String typeName = (type != null ? type.getName() : null); + String typeName = (type != null) ? type.getName() : null; assertThat(actual.getType()).isEqualTo(typeName); assertThat(actual.getDefaultValue()).isEqualTo(defaultValue); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java index 175d4d2b467..08e8423f558 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java @@ -317,8 +317,9 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor reason = (String) elementValues.get("reason"); replacement = (String) elementValues.get("replacement"); } - return new ItemDeprecation(("".equals(reason) ? null : reason), - ("".equals(replacement) ? null : replacement)); + reason = "".equals(reason) ? null : reason; + replacement = "".equals(replacement) ? null : replacement; + return new ItemDeprecation(reason, replacement); } private void processSimpleLombokTypes(String prefix, TypeElement element, @@ -420,7 +421,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor this.metadataCollector.add(ItemMetadata.newGroup(nestedPrefix, this.typeUtils.getQualifiedName(returnElement), this.typeUtils.getQualifiedName(element), - (getter != null ? getter.toString() : null))); + (getter != null) ? getter.toString() : null)); processTypeElement(nestedPrefix, (TypeElement) returnElement, source); } } @@ -453,7 +454,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor this.metadataCollector.add(ItemMetadata.newProperty(endpointKey, "enabled", Boolean.class.getName(), type, null, String.format("Whether to enable the %s endpoint.", endpointId), - (enabledByDefault != null ? enabledByDefault : true), null)); + (enabledByDefault != null) ? enabledByDefault : true, null)); if (hasMainReadOperation(element)) { this.metadataCollector.add(ItemMetadata.newProperty(endpointKey, "cache.time-to-live", Duration.class.getName(), type, null, diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java index 019206fa7f4..b78fbc10745 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java @@ -156,8 +156,8 @@ class TypeElementMembers { } private String getAccessorName(String methodName) { - String name = (methodName.startsWith("is") ? methodName.substring(2) - : methodName.substring(3)); + String name = methodName.startsWith("is") ? methodName.substring(2) + : methodName.substring(3); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); return name; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java index 0ceb7951572..ce3e6d32751 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java @@ -139,12 +139,12 @@ class TypeUtils { } public String getJavaDoc(Element element) { - String javadoc = (element != null - ? this.env.getElementUtils().getDocComment(element) : null); + String javadoc = (element != null) + ? this.env.getElementUtils().getDocComment(element) : null; if (javadoc != null) { javadoc = javadoc.replaceAll("[\r\n]+", "").trim(); } - return ("".equals(javadoc) ? null : javadoc); + return "".equals(javadoc) ? null : javadoc; } public TypeMirror getWrapperOrPrimitiveFor(TypeMirror typeMirror) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java index 0e0aa7f346e..a56ce83b5c5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java @@ -178,7 +178,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser { String type = instance.toString(); type = type.substring(DURATION_OF.length(), type.indexOf('(')); String suffix = DURATION_SUFFIX.get(type); - return (suffix != null ? factoryValue + suffix : null); + return (suffix != null) ? factoryValue + suffix : null; } return factoryValue; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Trees.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Trees.java index 2a577114726..e1516d3962e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Trees.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Trees.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -35,7 +35,7 @@ final class Trees extends ReflectionWrapper { public Tree getTree(Element element) throws Exception { Object tree = findMethod("getTree", Element.class).invoke(getInstance(), element); - return (tree != null ? new Tree(tree) : null); + return (tree != null) ? new Tree(tree) : null; } public static Trees instance(ProcessingEnvironment env) throws Exception { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/VariableTree.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/VariableTree.java index a2beaa3a0f4..255ab0e7e27 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/VariableTree.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/VariableTree.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -43,7 +43,7 @@ class VariableTree extends ReflectionWrapper { public ExpressionTree getInitializer() throws Exception { Object instance = findMethod("getInitializer").invoke(getInstance()); - return (instance != null ? new ExpressionTree(instance) : null); + return (instance != null) ? new ExpressionTree(instance) : null; } @SuppressWarnings("unchecked") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java index 6c377ef71d5..8689ba10592 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java @@ -174,9 +174,9 @@ public class ConfigurationMetadata { } public static String nestedPrefix(String prefix, String name) { - String nestedPrefix = (prefix != null ? prefix : ""); + String nestedPrefix = (prefix != null) ? prefix : ""; String dashedName = toDashedCase(name); - nestedPrefix += ("".equals(nestedPrefix) ? dashedName : "." + dashedName); + nestedPrefix += "".equals(nestedPrefix) ? dashedName : "." + dashedName; return nestedPrefix; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java index b3a24d613a8..64d509e22bd 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -108,7 +108,7 @@ public class ItemDeprecation { } private int nullSafeHashCode(Object o) { - return (o != null ? o.hashCode() : 0); + return (o != null) ? o.hashCode() : 0; } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java index 94adc8f1577..81ce69ed806 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemHint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -44,9 +44,9 @@ public class ItemHint implements Comparable { public ItemHint(String name, List values, List providers) { this.name = toCanonicalName(name); - this.values = (values != null ? new ArrayList<>(values) : new ArrayList<>()); - this.providers = (providers != null ? new ArrayList<>(providers) - : new ArrayList<>()); + this.values = (values != null) ? new ArrayList<>(values) : new ArrayList<>(); + this.providers = (providers != null) ? new ArrayList<>(providers) + : new ArrayList<>(); } private String toCanonicalName(String name) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java index fc3012e6b32..b1da40a98c6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,11 +61,11 @@ public final class ItemMetadata implements Comparable { while (prefix != null && prefix.endsWith(".")) { prefix = prefix.substring(0, prefix.length() - 1); } - StringBuilder fullName = new StringBuilder(prefix != null ? prefix : ""); + StringBuilder fullName = new StringBuilder((prefix != null) ? prefix : ""); if (fullName.length() > 0 && name != null) { fullName.append("."); } - fullName.append(name != null ? ConfigurationMetadata.toDashedCase(name) : ""); + fullName.append((name != null) ? ConfigurationMetadata.toDashedCase(name) : ""); return fullName.toString(); } @@ -196,7 +196,7 @@ public final class ItemMetadata implements Comparable { } private int nullSafeHashCode(Object o) { - return (o != null ? o.hashCode() : 0); + return (o != null) ? o.hashCode() : 0; } @Override diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java index 884908f3b73..b39252029f0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java @@ -119,7 +119,7 @@ public class SpringBootExtension { private String determineArtifactBaseName() { Jar artifactTask = findArtifactTask(); - return (artifactTask != null ? artifactTask.getBaseName() : null); + return (artifactTask != null) ? artifactTask.getBaseName() : null; } private Jar findArtifactTask() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java index c6ed35affad..fae59a4136b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java @@ -162,9 +162,9 @@ final class JavaPluginAction implements PluginApplicationAction { } private boolean hasConfigurationProcessorOnClasspath(JavaCompile compile) { - Set files = (compile.getOptions().getAnnotationProcessorPath() != null + Set files = (compile.getOptions().getAnnotationProcessorPath() != null) ? compile.getOptions().getAnnotationProcessorPath().getFiles() - : compile.getClasspath().getFiles()); + : compile.getClasspath().getFiles(); return files.stream().map(File::getName).anyMatch( (name) -> name.startsWith("spring-boot-configuration-processor")); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java index 310bffb99d6..fe8423336ea 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java @@ -53,17 +53,14 @@ public class BuildInfo extends ConventionTask { @TaskAction public void generateBuildProperties() { try { - new BuildPropertiesWriter( - new File(getDestinationDir(), "build-info.properties")) - .writeBuildProperties(new ProjectDetails( - this.properties.getGroup(), - this.properties.getArtifact() != null - ? this.properties.getArtifact() - : "unspecified", - this.properties.getVersion(), - this.properties.getName(), this.properties.getTime(), - coerceToStringValues( - this.properties.getAdditional()))); + new BuildPropertiesWriter(new File(getDestinationDir(), + "build-info.properties")).writeBuildProperties(new ProjectDetails( + this.properties.getGroup(), + (this.properties.getArtifact() != null) + ? this.properties.getArtifact() : "unspecified", + this.properties.getVersion(), this.properties.getName(), + this.properties.getTime(), + coerceToStringValues(this.properties.getAdditional()))); } catch (IOException ex) { throw new TaskExecutionException(this, ex); @@ -77,8 +74,8 @@ public class BuildInfo extends ConventionTask { */ @OutputDirectory public File getDestinationDir() { - return (this.destinationDir != null ? this.destinationDir - : getProject().getBuildDir()); + return (this.destinationDir != null) ? this.destinationDir + : getProject().getBuildDir(); } /** diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java index e63e83dd25b..46d68c8a6cd 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java @@ -58,8 +58,8 @@ public class BootJar extends Jar implements BootArchive { private Action classpathFiles(Spec filter) { return (copySpec) -> copySpec - .from((Callable>) () -> (this.classpath != null - ? this.classpath.filter(filter) : Collections.emptyList())); + .from((Callable>) () -> (this.classpath != null) + ? this.classpath.filter(filter) : Collections.emptyList()); } @@ -125,7 +125,7 @@ public class BootJar extends Jar implements BootArchive { public void classpath(Object... classpath) { FileCollection existingClasspath = this.classpath; this.classpath = getProject().files( - existingClasspath != null ? existingClasspath : Collections.emptyList(), + (existingClasspath != null) ? existingClasspath : Collections.emptyList(), classpath); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java index e6be12492f4..f884e41e6ad 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java @@ -51,8 +51,8 @@ public class BootWar extends War implements BootArchive { public BootWar() { getWebInf().into("lib-provided", (copySpec) -> copySpec.from( - (Callable>) () -> (this.providedClasspath != null - ? this.providedClasspath : Collections.emptyList()))); + (Callable>) () -> (this.providedClasspath != null) + ? this.providedClasspath : Collections.emptyList())); } @Override @@ -127,7 +127,7 @@ public class BootWar extends War implements BootArchive { public void providedClasspath(Object... classpath) { FileCollection existingClasspath = this.providedClasspath; this.providedClasspath = getProject().files( - existingClasspath != null ? existingClasspath : Collections.emptyList(), + (existingClasspath != null) ? existingClasspath : Collections.emptyList(), classpath); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java index ea4b10259e6..47dd1b3eac0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java @@ -283,8 +283,8 @@ class BootZipCopyAction implements CopyAction { } private long getTime(FileCopyDetails details) { - return (this.preserveFileTimestamps ? details.getLastModified() - : CONSTANT_TIME_FOR_ZIP_ENTRIES); + return this.preserveFileTimestamps ? details.getLastModified() + : CONSTANT_TIME_FOR_ZIP_ENTRIES; } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java index d4242f3694f..f16d6ec5148 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -109,8 +109,8 @@ public class DefaultLaunchScript implements LaunchScript { } } else { - value = (defaultValue != null ? defaultValue.substring(1) - : matcher.group(0)); + value = (defaultValue != null) ? defaultValue.substring(1) + : matcher.group(0); } matcher.appendReplacement(expanded, value.replace("$", "\\$")); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java index 2316552991d..767bdc06077 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java @@ -363,7 +363,7 @@ public class JarWriter implements LoaderClassesWriter, AutoCloseable { @Override public int read() throws IOException { - int read = (this.headerStream != null ? this.headerStream.read() : -1); + int read = (this.headerStream != null) ? this.headerStream.read() : -1; if (read != -1) { this.position++; if (this.position >= this.headerLength) { @@ -381,8 +381,8 @@ public class JarWriter implements LoaderClassesWriter, AutoCloseable { @Override public int read(byte[] b, int off, int len) throws IOException { - int read = (this.headerStream != null ? this.headerStream.read(b, off, len) - : -1); + int read = (this.headerStream != null) ? this.headerStream.read(b, off, len) + : -1; if (read <= 0) { return readRemainder(b, off, len); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Library.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Library.java index e9fbd2a6328..14df64f39e6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Library.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Library.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -63,7 +63,7 @@ public class Library { * @param unpackRequired if the library needs to be unpacked before it can be used */ public Library(String name, File file, LibraryScope scope, boolean unpackRequired) { - this.name = (name != null ? name : file.getName()); + this.name = (name != null) ? name : file.getName(); this.file = file; this.scope = scope; this.unpackRequired = unpackRequired; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java index 42849146491..85d9f122f38 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -248,7 +248,7 @@ public abstract class MainClassFinder { private static List getClassEntries(JarFile source, String classesLocation) { - classesLocation = (classesLocation != null ? classesLocation : ""); + classesLocation = (classesLocation != null) ? classesLocation : ""; Enumeration sourceEntries = source.entries(); List classEntries = new ArrayList<>(); while (sourceEntries.hasMoreElements()) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java index 6b265e4aaa9..dd434c70f62 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java @@ -116,8 +116,8 @@ public abstract class Launcher { protected final Archive createArchive() throws Exception { ProtectionDomain protectionDomain = getClass().getProtectionDomain(); CodeSource codeSource = protectionDomain.getCodeSource(); - URI location = (codeSource != null ? codeSource.getLocation().toURI() : null); - String path = (location != null ? location.getSchemeSpecificPart() : null); + URI location = (codeSource != null) ? codeSource.getLocation().toURI() : null; + String path = (location != null) ? location.getSchemeSpecificPart() : null; if (path == null) { throw new IllegalStateException("Unable to determine code source archive"); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java index 9ef7a245e06..b90a3d45d30 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/MainMethodRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -38,7 +38,7 @@ public class MainMethodRunner { */ public MainMethodRunner(String mainClass, String[] args) { this.mainClassName = mainClass; - this.args = (args != null ? args.clone() : null); + this.args = (args != null) ? args.clone() : null; } public void run() throws Exception { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java index 2b89514879c..66bde9b39f8 100755 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java @@ -434,9 +434,9 @@ public class PropertiesLauncher extends Launcher { return SystemPropertyUtils.resolvePlaceholders(this.properties, value); } } - return (defaultValue != null + return (defaultValue != null) ? SystemPropertyUtils.resolvePlaceholders(this.properties, defaultValue) - : defaultValue); + : defaultValue; } @Override diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java index 76dac5420de..00cfc094f2a 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java @@ -144,7 +144,7 @@ public class RandomAccessDataFile implements RandomAccessData { @Override public int read(byte[] b) throws IOException { - return read(b, 0, b != null ? b.length : 0); + return read(b, 0, (b != null) ? b.length : 0); } @Override @@ -178,7 +178,7 @@ public class RandomAccessDataFile implements RandomAccessData { @Override public long skip(long n) throws IOException { - return (n <= 0 ? 0 : moveOn(cap(n))); + return (n <= 0) ? 0 : moveOn(cap(n)); } /** diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java index e4f7bc06693..9b3fd7aeca2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java @@ -141,7 +141,7 @@ final class AsciiBytes { public boolean matches(CharSequence name, char suffix) { int charIndex = 0; int nameLen = name.length(); - int totalLen = (nameLen + (suffix != 0 ? 1 : 0)); + int totalLen = nameLen + ((suffix != 0) ? 1 : 0); for (int i = this.offset; i < this.offset + this.length; i++) { int b = this.bytes[i]; int remainingUtfBytes = getNumberOfUtfBytes(b) - 1; @@ -250,7 +250,7 @@ final class AsciiBytes { } public static int hashCode(int hash, char suffix) { - return (suffix != 0 ? (31 * hash + suffix) : hash); + return (suffix != 0) ? (31 * hash + suffix) : hash; } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java index 22576ad9d0b..39cf82d6e63 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -250,7 +250,7 @@ public class Handler extends URLStreamHandler { } private int hashCode(String protocol, String file) { - int result = (protocol != null ? protocol.hashCode() : 0); + int result = (protocol != null) ? protocol.hashCode() : 0; int separatorIndex = file.indexOf(SEPARATOR); if (separatorIndex == -1) { return result + file.hashCode(); @@ -319,7 +319,7 @@ public class Handler extends URLStreamHandler { String path = name.substring(FILE_PROTOCOL.length()); File file = new File(URLDecoder.decode(path, "UTF-8")); Map cache = rootFileCache.get(); - JarFile result = (cache != null ? cache.get(file) : null); + JarFile result = (cache != null) ? cache.get(file) : null; if (result == null) { result = new JarFile(file); addToRootFileCache(file, result); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java index a6188eeed60..733d4fe8b86 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarEntry.java @@ -77,7 +77,7 @@ class JarEntry extends java.util.jar.JarEntry implements FileHeader { @Override public Attributes getAttributes() throws IOException { Manifest manifest = this.jarFile.getManifest(); - return (manifest != null ? manifest.getAttributes(getName()) : null); + return (manifest != null) ? manifest.getAttributes(getName()) : null; } @Override diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java index a66c1ac156b..9c16b0b74d0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java @@ -120,7 +120,7 @@ public class JarFile extends java.util.jar.JarFile { parser.addVisitor(centralDirectoryVisitor()); this.data = parser.parse(data, filter == null); this.type = type; - this.manifestSupplier = (manifestSupplier != null ? manifestSupplier : () -> { + this.manifestSupplier = (manifestSupplier != null) ? manifestSupplier : () -> { try (InputStream inputStream = getInputStream(MANIFEST_NAME)) { if (inputStream == null) { return null; @@ -130,7 +130,7 @@ public class JarFile extends java.util.jar.JarFile { catch (IOException ex) { throw new RuntimeException(ex); } - }); + }; } private CentralDirectoryVisitor centralDirectoryVisitor() { @@ -168,7 +168,7 @@ public class JarFile extends java.util.jar.JarFile { @Override public Manifest getManifest() throws IOException { - Manifest manifest = (this.manifest != null ? this.manifest.get() : null); + Manifest manifest = (this.manifest != null) ? this.manifest.get() : null; if (manifest == null) { try { manifest = this.manifestSupplier.get(); @@ -218,11 +218,11 @@ public class JarFile extends java.util.jar.JarFile { } @Override - public synchronized InputStream getInputStream(ZipEntry ze) throws IOException { - if (ze instanceof JarEntry) { - return this.entries.getInputStream((JarEntry) ze); + public synchronized InputStream getInputStream(ZipEntry entry) throws IOException { + if (entry instanceof JarEntry) { + return this.entries.getInputStream((JarEntry) entry); } - return getInputStream(ze != null ? ze.getName() : null); + return getInputStream((entry != null) ? entry.getName() : null); } InputStream getInputStream(String name) throws IOException { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFileEntries.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFileEntries.java index 67a4fa3cf09..48196a81960 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFileEntries.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFileEntries.java @@ -243,10 +243,10 @@ class JarFileEntries implements CentralDirectoryVisitor, Iterable { boolean cacheEntry) { try { FileHeader cached = this.entriesCache.get(index); - FileHeader entry = (cached != null ? cached + FileHeader entry = (cached != null) ? cached : CentralDirectoryFileHeader.fromRandomAccessData( this.centralDirectoryData, - this.centralDirectoryOffsets[index], this.filter)); + this.centralDirectoryOffsets[index], this.filter); if (CentralDirectoryFileHeader.class.equals(entry.getClass()) && type.equals(JarEntry.class)) { entry = new JarEntry(this.jarFile, (CentralDirectoryFileHeader) entry); @@ -277,7 +277,7 @@ class JarFileEntries implements CentralDirectoryVisitor, Iterable { } private AsciiBytes applyFilter(AsciiBytes name) { - return (this.filter != null ? this.filter.apply(name) : name); + return (this.filter != null) ? this.filter.apply(name) : name; } /** diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java index 2130ba1395b..343a90523c9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java @@ -204,7 +204,7 @@ final class JarURLConnection extends java.net.JarURLConnection { return this.jarFile.size(); } JarEntry entry = getJarEntry(); - return (entry != null ? (int) entry.getSize() : -1); + return (entry != null) ? (int) entry.getSize() : -1; } catch (IOException ex) { return -1; @@ -219,7 +219,7 @@ final class JarURLConnection extends java.net.JarURLConnection { @Override public String getContentType() { - return (this.jarEntryName != null ? this.jarEntryName.getContentType() : null); + return (this.jarEntryName != null) ? this.jarEntryName.getContentType() : null; } @Override @@ -241,7 +241,7 @@ final class JarURLConnection extends java.net.JarURLConnection { } try { JarEntry entry = getJarEntry(); - return (entry != null ? entry.getTime() : 0); + return (entry != null) ? entry.getTime() : 0; } catch (IOException ex) { return 0; @@ -387,8 +387,8 @@ final class JarURLConnection extends java.net.JarURLConnection { private String deduceContentType() { // Guess the content type, don't bother with streams as mark is not supported String type = (isEmpty() ? "x-java/jar" : null); - type = (type != null ? type : guessContentTypeFromName(toString())); - type = (type != null ? type : "content/unknown"); + type = (type != null) ? type : guessContentTypeFromName(toString()); + type = (type != null) ? type : "content/unknown"; return type; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java index 85cf87bbe16..67beac47b88 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java @@ -36,7 +36,7 @@ final class StringSequence implements CharSequence { private int hash; StringSequence(String source) { - this(source, 0, source != null ? source.length() : -1); + this(source, 0, (source != null) ? source.length() : -1); } StringSequence(String source, int start, int end) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/ZipInflaterInputStream.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/ZipInflaterInputStream.java index c545e71f9fd..696a4b7a875 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/ZipInflaterInputStream.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/ZipInflaterInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -74,8 +74,8 @@ class ZipInflaterInputStream extends InflaterInputStream { private static int getInflaterBufferSize(long size) { size += 2; // inflater likes some space - size = (size > 65536 ? 8192 : size); - size = (size <= 0 ? 4096 : size); + size = (size > 65536) ? 8192 : size; + size = (size <= 0) ? 4096 : size; return (int) size; } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java index 0b9d0bfdb9f..6885845b1c6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java @@ -155,7 +155,7 @@ public abstract class SystemPropertyUtils { if (propVal != null) { return propVal; } - return (properties != null ? properties.getProperty(placeholderName) : null); + return (properties != null) ? properties.getProperty(placeholderName) : null; } public static String getProperty(String key) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index b46b0ef3441..feae5487c00 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -332,7 +332,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { StringBuilder classpath = new StringBuilder(); for (URL ele : getClassPathUrls()) { classpath = classpath - .append((classpath.length() > 0 ? File.pathSeparator : "") + .append(((classpath.length() > 0) ? File.pathSeparator : "") + new File(ele.toURI())); } getLog().debug("Classpath for forked process: " + classpath); @@ -450,7 +450,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { public void uncaughtException(Thread thread, Throwable ex) { if (!(ex instanceof ThreadDeath)) { synchronized (this.monitor) { - this.exception = (this.exception != null ? this.exception : ex); + this.exception = (this.exception != null) ? this.exception : ex; } getLog().warn(ex); } @@ -480,7 +480,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo { LaunchRunner(String startClassName, String... args) { this.startClassName = startClassName; - this.args = (args != null ? args : new String[] {}); + this.args = (args != null) ? args : new String[] {}; } @Override diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java index ce4a0b4320a..6cb2af240ba 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/PropertiesMergingResourceTransformer.java @@ -68,7 +68,7 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer private void process(String name, String value) { String existing = this.data.getProperty(name); - this.data.setProperty(name, (existing != null ? existing + "," + value : value)); + this.data.setProperty(name, (existing != null) ? existing + "," + value : value); } @Override diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java index f0cb6c65b3c..997236b53de 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java @@ -226,7 +226,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { } private File getTargetFile() { - String classifier = (this.classifier != null ? this.classifier.trim() : ""); + String classifier = (this.classifier != null) ? this.classifier.trim() : ""; if (!classifier.isEmpty() && !classifier.startsWith("-")) { classifier = "-" + classifier; } @@ -287,7 +287,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { } private String removeLineBreaks(String description) { - return (description != null ? description.replaceAll("\\s+", " ") : null); + return (description != null) ? description.replaceAll("\\s+", " ") : null; } private void putIfMissing(Properties properties, String key, diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java index 7089669307f..ce38cf8e576 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -219,8 +219,8 @@ class BeanDefinitionLoader { } private Resource[] findResources(String source) { - ResourceLoader loader = (this.resourceLoader != null ? this.resourceLoader - : new PathMatchingResourcePatternResolver()); + ResourceLoader loader = (this.resourceLoader != null) ? this.resourceLoader + : new PathMatchingResourcePatternResolver(); try { if (loader instanceof ResourcePatternResolver) { return ((ResourcePatternResolver) loader).getResources(source); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/DefaultApplicationArguments.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/DefaultApplicationArguments.java index 8ea84f92f68..555a96d5a95 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/DefaultApplicationArguments.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/DefaultApplicationArguments.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -62,7 +62,7 @@ public class DefaultApplicationArguments implements ApplicationArguments { @Override public List getOptionValues(String name) { List values = this.source.getOptionValues(name); - return (values != null ? Collections.unmodifiableList(values) : null); + return (values != null) ? Collections.unmodifiableList(values) : null; } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java index 4f317e4ab3f..d491b73fa6d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -93,7 +93,7 @@ class ExitCodeGenerators implements Iterable { } } catch (Exception ex) { - exitCode = (exitCode != 0 ? exitCode : 1); + exitCode = (exitCode != 0) ? exitCode : 1; ex.printStackTrace(); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ImageBanner.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ImageBanner.java index 247249f572d..76f64f532e2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ImageBanner.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ImageBanner.java @@ -161,9 +161,9 @@ public class ImageBanner implements Banner { IIOMetadataNode root = (IIOMetadataNode) metadata .getAsTree(metadata.getNativeMetadataFormatName()); IIOMetadataNode extension = findNode(root, "GraphicControlExtension"); - String attribute = (extension != null ? extension.getAttribute("delayTime") - : null); - return (attribute != null ? Integer.parseInt(attribute) * 10 : 0); + String attribute = (extension != null) ? extension.getAttribute("delayTime") + : null; + return (attribute != null) ? Integer.parseInt(attribute) * 10 : 0; } private static IIOMetadataNode findNode(IIOMetadataNode rootNode, String nodeName) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java index a22ee6b6e38..77b0b64dab7 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ResourceBanner.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -107,8 +107,8 @@ public class ResourceBanner implements Banner { } protected String getApplicationVersion(Class sourceClass) { - Package sourcePackage = (sourceClass != null ? sourceClass.getPackage() : null); - return (sourcePackage != null ? sourcePackage.getImplementationVersion() : null); + Package sourcePackage = (sourceClass != null) ? sourceClass.getPackage() : null; + return (sourcePackage != null) ? sourcePackage.getImplementationVersion() : null; } protected String getBootVersion() { @@ -132,14 +132,14 @@ public class ResourceBanner implements Banner { MutablePropertySources sources = new MutablePropertySources(); String applicationTitle = getApplicationTitle(sourceClass); Map titleMap = Collections.singletonMap("application.title", - (applicationTitle != null ? applicationTitle : "")); + (applicationTitle != null) ? applicationTitle : ""); sources.addFirst(new MapPropertySource("title", titleMap)); return new PropertySourcesPropertyResolver(sources); } protected String getApplicationTitle(Class sourceClass) { - Package sourcePackage = (sourceClass != null ? sourceClass.getPackage() : null); - return (sourcePackage != null ? sourcePackage.getImplementationTitle() : null); + Package sourcePackage = (sourceClass != null) ? sourceClass.getPackage() : null; + return (sourcePackage != null) ? sourcePackage.getImplementationTitle() : null; } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index b6cfabb6ac4..add3f250645 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -556,8 +556,8 @@ public class SpringApplication { if (this.bannerMode == Banner.Mode.OFF) { return null; } - ResourceLoader resourceLoader = (this.resourceLoader != null ? this.resourceLoader - : new DefaultResourceLoader(getClassLoader())); + ResourceLoader resourceLoader = (this.resourceLoader != null) + ? this.resourceLoader : new DefaultResourceLoader(getClassLoader()); SpringApplicationBannerPrinter bannerPrinter = new SpringApplicationBannerPrinter( resourceLoader, this.banner); if (this.bannerMode == Mode.LOG) { @@ -1307,7 +1307,7 @@ public class SpringApplication { } catch (Exception ex) { ex.printStackTrace(); - exitCode = (exitCode != 0 ? exitCode : 1); + exitCode = (exitCode != 0) ? exitCode : 1; } return exitCode; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java index 947fc2f28bc..46c0af194fc 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationBannerPrinter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -163,7 +163,7 @@ class SpringApplicationBannerPrinter { @Override public void printBanner(Environment environment, Class sourceClass, PrintStream out) { - sourceClass = (sourceClass != null ? sourceClass : this.sourceClass); + sourceClass = (sourceClass != null) ? sourceClass : this.sourceClass; this.banner.printBanner(environment, sourceClass, out); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationRunListeners.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationRunListeners.java index 16c94e87fe8..27e1c71fea4 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationRunListeners.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationRunListeners.java @@ -99,7 +99,7 @@ class SpringApplicationRunListeners { } else { String message = ex.getMessage(); - message = (message != null ? message : "no error message"); + message = (message != null) ? message : "no error message"; this.log.warn("Error handling failed (" + message + ")"); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootBanner.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootBanner.java index 99e60aceed4..ae491ffa59d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootBanner.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootBanner.java @@ -49,7 +49,7 @@ class SpringBootBanner implements Banner { printStream.println(line); } String version = SpringBootVersion.getVersion(); - version = (version != null ? " (v" + version + ")" : ""); + version = (version != null) ? " (v" + version + ")" : ""; StringBuilder padding = new StringBuilder(); while (padding.length() < STRAP_LINE_SIZE - (version.length() + SPRING_BOOT.length())) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootVersion.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootVersion.java index 971b98753df..d80f1790d8d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootVersion.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringBootVersion.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,7 +41,7 @@ public final class SpringBootVersion { */ public static String getVersion() { Package pkg = SpringBootVersion.class.getPackage(); - return (pkg != null ? pkg.getImplementationVersion() : null); + return (pkg != null) ? pkg.getImplementationVersion() : null; } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java index f3164e2ea7e..a8b69cb0915 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/StartupInfoLogger.java @@ -97,8 +97,8 @@ class StartupInfoLogger { } private String getApplicationName() { - return (this.sourceClass != null ? ClassUtils.getShortName(this.sourceClass) - : "application"); + return (this.sourceClass != null) ? ClassUtils.getShortName(this.sourceClass) + : "application"; } private String getVersion(Class source) { @@ -117,8 +117,8 @@ class StartupInfoLogger { String startedBy = getValue("started by ", () -> System.getProperty("user.name")); String in = getValue("in ", () -> System.getProperty("user.dir")); ApplicationHome home = new ApplicationHome(this.sourceClass); - String path = (home.getSource() != null ? home.getSource().getAbsolutePath() - : ""); + String path = (home.getSource() != null) ? home.getSource().getAbsolutePath() + : ""; if (startedBy == null && path == null) { return ""; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java index 9f5868fc978..e01a398ba38 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ansi/AnsiColors.java @@ -94,7 +94,7 @@ public final class AnsiColors { private final double b; LabColor(Integer rgb) { - this(rgb != null ? new Color(rgb) : null); + this((rgb != null) ? new Color(rgb) : null); } LabColor(Color color) { @@ -117,8 +117,8 @@ public final class AnsiColors { } private double f(double t) { - return (t > (216.0 / 24389.0) ? Math.cbrt(t) - : (1.0 / 3.0) * Math.pow(29.0 / 6.0, 2) * t + (4.0 / 29.0)); + return (t > (216.0 / 24389.0)) ? Math.cbrt(t) + : (1.0 / 3.0) * Math.pow(29.0 / 6.0, 2) * t + (4.0 / 29.0); } // See http://en.wikipedia.org/wiki/Color_difference#CIE94 diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java index add5881052b..151e6e2fde6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java @@ -397,8 +397,8 @@ public class SpringApplicationBuilder { Map map = new HashMap<>(); for (String property : properties) { int index = lowestIndexOf(property, ":", "="); - String key = (index > 0 ? property.substring(0, index) : property); - String value = (index > 0 ? property.substring(index + 1) : ""); + String key = (index > 0) ? property.substring(0, index) : property; + String value = (index > 0) ? property.substring(index + 1) : ""; map.put(key, value); } return map; @@ -409,7 +409,7 @@ public class SpringApplicationBuilder { for (String candidate : candidates) { int candidateIndex = property.indexOf(candidate); if (candidateIndex > 0) { - index = (index != -1 ? Math.min(index, candidateIndex) : candidateIndex); + index = (index != -1) ? Math.min(index, candidateIndex) : candidateIndex; } } return index; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java index 5a7afea4aa6..c1ae0f2716f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/cloud/CloudFoundryVcapEnvironmentPostProcessor.java @@ -223,7 +223,7 @@ public class CloudFoundryVcapEnvironmentPostProcessor properties.put(name, value.toString()); } else { - properties.put(name, value != null ? value : ""); + properties.put(name, (value != null) ? value : ""); } }); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java index 03bff0b9de0..2673168d779 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/ApplicationPidFileWriter.java @@ -163,7 +163,7 @@ public class ApplicationPidFileWriter private boolean failOnWriteError(SpringApplicationEvent event) { String value = getProperty(event, FAIL_ON_WRITE_ERROR_PROPERTIES); - return (value != null ? Boolean.parseBoolean(value) : false); + return (value != null) ? Boolean.parseBoolean(value) : false; } private String getProperty(SpringApplicationEvent event, List candidates) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index a290eb874ca..15af937b0b5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -316,8 +316,8 @@ public class ConfigFileApplicationListener Loader(ConfigurableEnvironment environment, ResourceLoader resourceLoader) { this.environment = environment; - this.resourceLoader = (resourceLoader != null ? resourceLoader - : new DefaultResourceLoader()); + this.resourceLoader = (resourceLoader != null) ? resourceLoader + : new DefaultResourceLoader(); this.propertySourceLoaders = SpringFactoriesLoader.loadFactories( PropertySourceLoader.class, getClass().getClassLoader()); } @@ -590,8 +590,8 @@ public class ConfigFileApplicationListener private String getDescription(String location, Resource resource, Profile profile) { String description = getDescription(location, resource); - return (profile != null ? description + " for profile " + profile - : description); + return (profile != null) ? description + " for profile " + profile + : description; } private String getDescription(String location, Resource resource) { @@ -667,7 +667,7 @@ public class ConfigFileApplicationListener private Set asResolvedSet(String value, String fallback) { List list = Arrays.asList(StringUtils.trimArrayElements( - StringUtils.commaDelimitedListToStringArray(value != null + StringUtils.commaDelimitedListToStringArray((value != null) ? this.environment.resolvePlaceholders(value) : fallback))); Collections.reverse(list); return new LinkedHashSet<>(list); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java index 4987b4bccd9..687dfbab628 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata.java @@ -77,7 +77,7 @@ public class ConfigurationBeanFactoryMetadata implements BeanFactoryPostProcesso public A findFactoryAnnotation(String beanName, Class type) { Method method = findFactoryMethod(beanName); - return (method != null ? AnnotationUtils.findAnnotation(method, type) : null); + return (method != null) ? AnnotationUtils.findAnnotation(method, type) : null; } public Method findFactoryMethod(String beanName) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java index 743b72a3cba..ff0a5a5fb9a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -98,9 +98,9 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc private void bind(Object bean, String beanName, ConfigurationProperties annotation) { ResolvableType type = getBeanType(bean, beanName); Validated validated = getAnnotation(bean, beanName, Validated.class); - Annotation[] annotations = (validated != null + Annotation[] annotations = (validated != null) ? new Annotation[] { annotation, validated } - : new Annotation[] { annotation }); + : new Annotation[] { annotation }; Bindable target = Bindable.of(type).withExistingValue(bean) .withAnnotations(annotations); try { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java index d5dee53d7ae..2e42438f97a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java @@ -75,7 +75,7 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { MultiValueMap attributes = metadata .getAllAnnotationAttributes( EnableConfigurationProperties.class.getName(), false); - return collectClasses(attributes != null ? attributes.get("value") + return collectClasses((attributes != null) ? attributes.get("value") : Collections.emptyList()); } @@ -96,7 +96,7 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector { private String getName(Class type) { ConfigurationProperties annotation = AnnotationUtils.findAnnotation(type, ConfigurationProperties.class); - String prefix = (annotation != null ? annotation.prefix() : ""); + String prefix = (annotation != null) ? annotation.prefix() : ""; return (StringUtils.hasText(prefix) ? prefix + "-" + type.getName() : type.getName()); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindConverter.java index c8de87f60fd..daf60ba5238 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindConverter.java @@ -124,7 +124,7 @@ class BindConverter { public boolean canConvert(Class sourceType, Class targetType) { Assert.notNull(targetType, "Target type to convert to cannot be null"); return canConvert( - (sourceType != null ? TypeDescriptor.valueOf(sourceType) : null), + (sourceType != null) ? TypeDescriptor.valueOf(sourceType) : null, TypeDescriptor.valueOf(targetType)); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindException.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindException.java index 640c8b2134b..2a1b82a59e9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindException.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindException.java @@ -77,7 +77,7 @@ public class BindException extends RuntimeException implements OriginProvider { Bindable target) { StringBuilder message = new StringBuilder(); message.append("Failed to bind properties"); - message.append(name != null ? " under '" + name + "'" : ""); + message.append((name != null) ? " under '" + name + "'" : ""); message.append(" to ").append(target.getType()); return message.toString(); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java index 3d369c2a736..0bb018fcba6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java @@ -89,7 +89,7 @@ public final class BindResult { */ public BindResult map(Function mapper) { Assert.notNull(mapper, "Mapper must not be null"); - return of(this.value != null ? mapper.apply(this.value) : null); + return of((this.value != null) ? mapper.apply(this.value) : null); } /** @@ -99,7 +99,7 @@ public final class BindResult { * @return the value, if bound, otherwise {@code other} */ public T orElse(T other) { - return (this.value != null ? this.value : other); + return (this.value != null) ? this.value : other; } /** @@ -110,7 +110,7 @@ public final class BindResult { * @return the value, if bound, otherwise the supplied {@code other} */ public T orElseGet(Supplier other) { - return (this.value != null ? this.value : other.get()); + return (this.value != null) ? this.value : other.get(); } /** @@ -121,7 +121,7 @@ public final class BindResult { */ public T orElseCreate(Class type) { Assert.notNull(type, "Type must not be null"); - return (this.value != null ? this.value : BeanUtils.instantiateClass(type)); + return (this.value != null) ? this.value : BeanUtils.instantiateClass(type); } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java index f66c3d05b8f..667d2fdd461 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java @@ -110,7 +110,7 @@ public final class Bindable { public String toString() { ToStringCreator creator = new ToStringCreator(this); creator.append("type", this.type); - creator.append("value", (this.value != null ? "provided" : "none")); + creator.append("value", (this.value != null) ? "provided" : "none"); creator.append("annotations", this.annotations); return creator.toString(); } @@ -150,7 +150,7 @@ public final class Bindable { */ public Bindable withAnnotations(Annotation... annotations) { return new Bindable<>(this.type, this.boxedType, this.value, - (annotations != null ? annotations : NO_ANNOTATIONS)); + (annotations != null) ? annotations : NO_ANNOTATIONS); } /** @@ -163,7 +163,7 @@ public final class Bindable { existingValue == null || this.type.isArray() || this.boxedType.resolve().isInstance(existingValue), () -> "ExistingValue must be an instance of " + this.type); - Supplier value = (existingValue != null ? () -> existingValue : null); + Supplier value = (existingValue != null) ? () -> existingValue : null; return new Bindable<>(this.type, this.boxedType, value, NO_ANNOTATIONS); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java index f0d34b345e7..b458beef5b7 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java @@ -133,10 +133,10 @@ public class Binder { Consumer propertyEditorInitializer) { Assert.notNull(sources, "Sources must not be null"); this.sources = sources; - this.placeholdersResolver = (placeholdersResolver != null ? placeholdersResolver - : PlaceholdersResolver.NONE); - this.conversionService = (conversionService != null ? conversionService - : ApplicationConversionService.getSharedInstance()); + this.placeholdersResolver = (placeholdersResolver != null) ? placeholdersResolver + : PlaceholdersResolver.NONE; + this.conversionService = (conversionService != null) ? conversionService + : ApplicationConversionService.getSharedInstance(); this.propertyEditorInitializer = propertyEditorInitializer; } @@ -205,7 +205,7 @@ public class Binder { BindHandler handler) { Assert.notNull(name, "Name must not be null"); Assert.notNull(target, "Target must not be null"); - handler = (handler != null ? handler : BindHandler.DEFAULT); + handler = (handler != null) ? handler : BindHandler.DEFAULT; Context context = new Context(); T bound = bind(name, target, handler, context, false); return BindResult.of(bound); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java index 8c2d283e601..641574493e6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java @@ -40,8 +40,8 @@ class CollectionBinder extends IndexedElementsBinder> { @Override protected Object bindAggregate(ConfigurationPropertyName name, Bindable target, AggregateElementBinder elementBinder) { - Class collectionType = (target.getValue() != null ? List.class - : target.getType().resolve(Object.class)); + Class collectionType = (target.getValue() != null) ? List.class + : target.getType().resolve(Object.class); ResolvableType aggregateType = ResolvableType.forClassWithGenerics(List.class, target.getType().asCollection().getGenerics()); ResolvableType elementType = target.getType().asCollection().getGeneric(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java index 2ed0022c182..b37fadb050f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java @@ -109,7 +109,7 @@ abstract class IndexedElementsBinder extends AggregateBinder { source, root); for (int i = 0; i < Integer.MAX_VALUE; i++) { ConfigurationPropertyName name = root - .append(i != 0 ? "[" + i + "]" : INDEX_ZERO); + .append((i != 0) ? "[" + i + "]" : INDEX_ZERO); Object value = elementBinder.bind(name, Bindable.of(elementType), source); if (value == null) { break; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java index 6f99796f2de..89e54038e96 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java @@ -184,7 +184,7 @@ class JavaBeanBinder implements BeanBinder { T instance = null; if (canCallGetValue && value != null) { instance = value.get(); - type = (instance != null ? instance.getClass() : type); + type = (instance != null) ? instance.getClass() : type; } if (instance == null && !isInstantiable(type)) { return null; @@ -287,7 +287,7 @@ class JavaBeanBinder implements BeanBinder { public Annotation[] getAnnotations() { try { - return (this.field != null ? this.field.getDeclaredAnnotations() : null); + return (this.field != null) ? this.field.getDeclaredAnnotations() : null; } catch (Exception ex) { return null; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java index 724ad529fea..807a9b4b142 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java @@ -55,8 +55,8 @@ class MapBinder extends AggregateBinder> { @Override protected Object bindAggregate(ConfigurationPropertyName name, Bindable target, AggregateElementBinder elementBinder) { - Map map = CollectionFactory.createMap((target.getValue() != null - ? Map.class : target.getType().resolve(Object.class)), 0); + Map map = CollectionFactory.createMap((target.getValue() != null) + ? Map.class : target.getType().resolve(Object.class), 0); Bindable resolvedTarget = resolveTarget(target); boolean hasDescendants = getContext().streamSources().anyMatch((source) -> source .containsDescendantOf(name) == ConfigurationPropertyState.PRESENT); @@ -216,7 +216,7 @@ class MapBinder extends AggregateBinder> { StringBuilder result = new StringBuilder(); for (int i = this.root.getNumberOfElements(); i < name .getNumberOfElements(); i++) { - result.append(result.length() != 0 ? "." : ""); + result.append((result.length() != 0) ? "." : ""); result.append(name.getElement(i, Form.ORIGINAL)); } return result.toString(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/PropertySourcesPlaceholdersResolver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/PropertySourcesPlaceholdersResolver.java index 6c2794b49f0..41d044a476a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/PropertySourcesPlaceholdersResolver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/PropertySourcesPlaceholdersResolver.java @@ -48,10 +48,10 @@ public class PropertySourcesPlaceholdersResolver implements PlaceholdersResolver public PropertySourcesPlaceholdersResolver(Iterable> sources, PropertyPlaceholderHelper helper) { this.sources = sources; - this.helper = (helper != null ? helper + this.helper = (helper != null) ? helper : new PropertyPlaceholderHelper(SystemPropertyUtils.PLACEHOLDER_PREFIX, SystemPropertyUtils.PLACEHOLDER_SUFFIX, - SystemPropertyUtils.VALUE_SEPARATOR, true)); + SystemPropertyUtils.VALUE_SEPARATOR, true); } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandler.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandler.java index d9a3f7fdbb2..c0fa273a356 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandler.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandler.java @@ -41,7 +41,7 @@ public class IgnoreErrorsBindHandler extends AbstractBindHandler { @Override public Object onFailure(ConfigurationPropertyName name, Bindable target, BindContext context, Exception error) throws Exception { - return (target.getValue() != null ? target.getValue().get() : null); + return (target.getValue() != null) ? target.getValue().get() : null; } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index c5cb44b45f3..0be25c053df 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -131,7 +131,7 @@ public final class ConfigurationPropertyName */ public String getLastElement(Form form) { int size = getNumberOfElements(); - return (size != 0 ? getElement(size - 1, form) : EMPTY_STRING); + return (size != 0) ? getElement(size - 1, form) : EMPTY_STRING; } /** @@ -259,10 +259,10 @@ public final class ConfigurationPropertyName int i1 = 0; int i2 = 0; while (i1 < l1 || i2 < l2) { - boolean indexed1 = (i1 < l1 ? n1.isIndexed(i2) : false); - boolean indexed2 = (i2 < l2 ? n2.isIndexed(i2) : false); - String e1 = (i1 < l1 ? n1.getElement(i1++, Form.UNIFORM) : null); - String e2 = (i2 < l2 ? n2.getElement(i2++, Form.UNIFORM) : null); + boolean indexed1 = (i1 < l1) ? n1.isIndexed(i2) : false; + boolean indexed2 = (i2 < l2) ? n2.isIndexed(i2) : false; + String e1 = (i1 < l1) ? n1.getElement(i1++, Form.UNIFORM) : null; + String e2 = (i2 < l2) ? n2.getElement(i2++, Form.UNIFORM) : null; int result = compare(e1, indexed1, e2, indexed2); if (result != 0) { return result; @@ -316,7 +316,7 @@ public final class ConfigurationPropertyName else { for (int i = 0; i < element.length(); i++) { char ch = Character.toLowerCase(element.charAt(i)); - result.append(ch != '_' ? ch : ""); + result.append((ch != '_') ? ch : ""); } } } @@ -346,7 +346,7 @@ public final class ConfigurationPropertyName for (int i = 0 + offset; i < element.length() - offset; i++) { char ch = (indexed ? element.charAt(i) : Character.toLowerCase(element.charAt(i))); - hash = (ch == '-' || ch == '_' ? hash : 31 * hash + Character.hashCode(ch)); + hash = (ch == '-' || ch == '_') ? hash : 31 * hash + Character.hashCode(ch); } return hash; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySource.java index 772c662b554..e2212a8bddf 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySourcesPropertySource.java @@ -42,7 +42,7 @@ class ConfigurationPropertySourcesPropertySource @Override public Object getProperty(String name) { ConfigurationProperty configurationProperty = findConfigurationProperty(name); - return (configurationProperty != null ? configurationProperty.getValue() : null); + return (configurationProperty != null) ? configurationProperty.getValue() : null; } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java index 904274de257..dadefaef0fa 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java @@ -75,7 +75,7 @@ public class MapConfigurationPropertySource * @param value the value */ public void put(Object name, Object value) { - this.source.put((name != null ? name.toString() : null), value); + this.source.put((name != null) ? name.toString() : null, value); } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java index 9b1a120632a..e19a9a68c06 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringConfigurationPropertySource.java @@ -77,10 +77,10 @@ class SpringConfigurationPropertySource implements ConfigurationPropertySource { Assert.notNull(propertySource, "PropertySource must not be null"); Assert.notNull(mapper, "Mapper must not be null"); this.propertySource = propertySource; - this.mapper = (mapper instanceof DelegatingPropertyMapper ? mapper - : new DelegatingPropertyMapper(mapper)); - this.containsDescendantOf = (containsDescendantOf != null ? containsDescendantOf - : (n) -> ConfigurationPropertyState.UNKNOWN); + this.mapper = (mapper instanceof DelegatingPropertyMapper) ? mapper + : new DelegatingPropertyMapper(mapper); + this.containsDescendantOf = (containsDescendantOf != null) ? containsDescendantOf + : (n) -> ConfigurationPropertyState.UNKNOWN; } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java index 173e86c63d9..0ccbb61d61f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java @@ -95,7 +95,7 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope private List getConfigurationPropertyNames() { Cache cache = getCache(); - List names = (cache != null ? cache.getNames() : null); + List names = (cache != null) ? cache.getNames() : null; if (names != null) { return names; } @@ -112,7 +112,7 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope } private PropertyMapping[] getPropertyMappings(Cache cache) { - PropertyMapping[] result = (cache != null ? cache.getMappings() : null); + PropertyMapping[] result = (cache != null) ? cache.getMappings() : null; if (result != null) { return result; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/CollectionToDelimitedStringConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/CollectionToDelimitedStringConverter.java index 42a02bfcc15..dc016b760c8 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/CollectionToDelimitedStringConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/CollectionToDelimitedStringConverter.java @@ -71,10 +71,14 @@ final class CollectionToDelimitedStringConverter implements ConditionalGenericCo if (source.isEmpty()) { return ""; } - Delimiter delimiter = sourceType.getAnnotation(Delimiter.class); return source.stream() .map((element) -> convertElement(element, sourceType, targetType)) - .collect(Collectors.joining(delimiter != null ? delimiter.value() : ",")); + .collect(Collectors.joining(getDelimter(sourceType))); + } + + private CharSequence getDelimter(TypeDescriptor sourceType) { + Delimiter annotation = sourceType.getAnnotation(Delimiter.class); + return (annotation != null) ? annotation.value() : ","; } private String convertElement(Object element, TypeDescriptor sourceType, diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToArrayConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToArrayConverter.java index 1cf45f1d539..581946fa544 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToArrayConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToArrayConverter.java @@ -66,7 +66,7 @@ final class DelimitedStringToArrayConverter implements ConditionalGenericConvert TypeDescriptor targetType) { Delimiter delimiter = targetType.getAnnotation(Delimiter.class); String[] elements = getElements(source, - (delimiter != null ? delimiter.value() : ",")); + (delimiter != null) ? delimiter.value() : ","); TypeDescriptor elementDescriptor = targetType.getElementTypeDescriptor(); Object target = Array.newInstance(elementDescriptor.getType(), elements.length); for (int i = 0; i < elements.length; i++) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToCollectionConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToCollectionConverter.java index 45a32d9c66a..0b7670f5193 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToCollectionConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToCollectionConverter.java @@ -69,7 +69,7 @@ final class DelimitedStringToCollectionConverter implements ConditionalGenericCo TypeDescriptor targetType) { Delimiter delimiter = targetType.getAnnotation(Delimiter.class); String[] elements = getElements(source, - (delimiter != null ? delimiter.value() : ",")); + (delimiter != null) ? delimiter.value() : ","); TypeDescriptor elementDescriptor = targetType.getElementTypeDescriptor(); Collection target = createCollection(targetType, elementDescriptor, elements.length); @@ -85,7 +85,7 @@ final class DelimitedStringToCollectionConverter implements ConditionalGenericCo private Collection createCollection(TypeDescriptor targetType, TypeDescriptor elementDescriptor, int length) { return CollectionFactory.createCollection(targetType.getType(), - (elementDescriptor != null ? elementDescriptor.getType() : null), length); + (elementDescriptor != null) ? elementDescriptor.getType() : null, length); } private String[] getElements(String source, String delimiter) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationToNumberConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationToNumberConverter.java index b57057929d4..9235ab11877 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationToNumberConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationToNumberConverter.java @@ -46,11 +46,15 @@ final class DurationToNumberConverter implements GenericConverter { if (source == null) { return null; } - DurationUnit unit = sourceType.getAnnotation(DurationUnit.class); - return convert((Duration) source, (unit != null ? unit.value() : null), + return convert((Duration) source, getDurationUnit(sourceType), targetType.getObjectType()); } + private ChronoUnit getDurationUnit(TypeDescriptor sourceType) { + DurationUnit annotation = sourceType.getAnnotation(DurationUnit.class); + return (annotation != null) ? annotation.value() : null; + } + private Object convert(Duration source, ChronoUnit unit, Class type) { try { return type.getConstructor(String.class).newInstance(String diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationToStringConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationToStringConverter.java index 89878ab06cb..1cc80dc4578 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationToStringConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DurationToStringConverter.java @@ -45,14 +45,22 @@ final class DurationToStringConverter implements GenericConverter { if (source == null) { return null; } - DurationFormat format = sourceType.getAnnotation(DurationFormat.class); - DurationUnit unit = sourceType.getAnnotation(DurationUnit.class); - return convert((Duration) source, (format != null ? format.value() : null), - (unit != null ? unit.value() : null)); + return convert((Duration) source, getDurationStyle(sourceType), + getDurationUnit(sourceType)); + } + + private ChronoUnit getDurationUnit(TypeDescriptor sourceType) { + DurationUnit annotation = sourceType.getAnnotation(DurationUnit.class); + return (annotation != null) ? annotation.value() : null; + } + + private DurationStyle getDurationStyle(TypeDescriptor sourceType) { + DurationFormat annotation = sourceType.getAnnotation(DurationFormat.class); + return (annotation != null) ? annotation.value() : null; } private String convert(Duration source, DurationStyle style, ChronoUnit unit) { - style = (style != null ? style : DurationStyle.ISO8601); + style = (style != null) ? style : DurationStyle.ISO8601; return style.print(source, unit); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/NumberToDurationConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/NumberToDurationConverter.java index 9890e9d6f9f..4307c095a4e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/NumberToDurationConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/NumberToDurationConverter.java @@ -44,7 +44,7 @@ final class NumberToDurationConverter implements GenericConverter { @Override public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { - return this.delegate.convert(source != null ? source.toString() : null, + return this.delegate.convert((source != null) ? source.toString() : null, TypeDescriptor.valueOf(String.class), targetType); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToDurationConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToDurationConverter.java index 265c003e164..354d964007a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToDurationConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToDurationConverter.java @@ -47,14 +47,22 @@ final class StringToDurationConverter implements GenericConverter { if (ObjectUtils.isEmpty(source)) { return null; } - DurationFormat format = targetType.getAnnotation(DurationFormat.class); - DurationUnit unit = targetType.getAnnotation(DurationUnit.class); - return convert(source.toString(), (format != null ? format.value() : null), - (unit != null ? unit.value() : null)); + return convert(source.toString(), getStyle(targetType), + getDurationUnit(targetType)); + } + + private DurationStyle getStyle(TypeDescriptor targetType) { + DurationFormat annotation = targetType.getAnnotation(DurationFormat.class); + return (annotation != null) ? annotation.value() : null; + } + + private ChronoUnit getDurationUnit(TypeDescriptor targetType) { + DurationUnit annotation = targetType.getAnnotation(DurationUnit.class); + return (annotation != null) ? annotation.value() : null; } private Duration convert(String source, DurationStyle style, ChronoUnit unit) { - style = (style != null ? style : DurationStyle.detect(source)); + style = (style != null) ? style : DurationStyle.detect(source); return style.parse(source, unit); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java index bbdad56c6f0..f3b4bb87817 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/FailureAnalyzers.java @@ -61,7 +61,7 @@ final class FailureAnalyzers implements SpringBootExceptionReporter { FailureAnalyzers(ConfigurableApplicationContext context, ClassLoader classLoader) { Assert.notNull(context, "Context must not be null"); - this.classLoader = (classLoader != null ? classLoader : context.getClassLoader()); + this.classLoader = (classLoader != null) ? classLoader : context.getClassLoader(); this.analyzers = loadFailureAnalyzers(this.classLoader); prepareFailureAnalyzers(this.analyzers, context); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java index 424d1300f1c..3c9765d6dd0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -57,7 +57,7 @@ class BeanCurrentlyInCreationFailureAnalyzer if (index == -1) { beansInCycle.add(beanInCycle); } - cycleStart = (cycleStart != -1 ? cycleStart : index); + cycleStart = (cycleStart != -1) ? cycleStart : index; } candidate = candidate.getCause(); } @@ -79,10 +79,10 @@ class BeanCurrentlyInCreationFailureAnalyzer message.append(String.format("┌─────┐%n")); } else if (i > 0) { - String leftSide = (i < cycleStart ? " " : "↑"); + String leftSide = (i < cycleStart) ? " " : "↑"; message.append(String.format("%s ↓%n", leftSide)); } - String leftSide = (i < cycleStart ? " " : "|"); + String leftSide = (i < cycleStart) ? " " : "|"; message.append(String.format("%s %s%n", leftSide, beanInCycle)); } message.append(String.format("└─────┘%n")); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzer.java index b58b1aeee12..b1b7ecf74a0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/InvalidConfigurationPropertyValueFailureAnalyzer.java @@ -74,8 +74,8 @@ class InvalidConfigurationPropertyValueFailureAnalyzer } private Stream> getPropertySources() { - Iterable> sources = (this.environment != null - ? this.environment.getPropertySources() : Collections.emptyList()); + Iterable> sources = (this.environment != null) + ? this.environment.getPropertySources() : Collections.emptyList(); return StreamSupport.stream(sources.spliterator(), false) .filter((source) -> !ConfigurationPropertySources .isAttachedConfigurationPropertySource(source)); @@ -110,7 +110,7 @@ class InvalidConfigurationPropertyValueFailureAnalyzer message.append(String.format( "%n%nAdditionally, this property is also set in the following " + "property %s:%n%n", - others.size() > 1 ? "sources" : "source")); + (others.size() > 1) ? "sources" : "source")); for (Descriptor other : others) { message.append("\t- In '" + other.getPropertySource() + "'"); message.append(" with the value '" + other.getValue() + "'"); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedYamlLoader.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedYamlLoader.java index 7976529373a..9132e0e19da 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedYamlLoader.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedYamlLoader.java @@ -105,7 +105,7 @@ class OriginTrackedYamlLoader extends YamlProcessor { } private Object getValue(Object value) { - return (value != null ? value : ""); + return (value != null) ? value : ""; } private Origin getOrigin(Node node) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java index afff3dc634c..5c0fa9be9db 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java @@ -126,7 +126,7 @@ public class SpringApplicationJsonEnvironmentPostProcessor private void flatten(String prefix, Map result, Map map) { - String namePrefix = (prefix != null ? prefix + "." : ""); + String namePrefix = (prefix != null) ? prefix + "." : ""; map.forEach((key, value) -> extract(namePrefix + key, result, value)); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java index 336d5dbd6b3..2b5aeca24b6 100755 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/YamlPropertySourceLoader.java @@ -53,8 +53,8 @@ public class YamlPropertySourceLoader implements PropertySourceLoader { } List> propertySources = new ArrayList<>(loaded.size()); for (int i = 0; i < loaded.size(); i++) { - propertySources.add(new OriginTrackedMapPropertySource( - name + (loaded.size() != 1 ? " (document #" + i + ")" : ""), + String documentNumber = (loaded.size() != 1) ? " (document #" + i + ")" : ""; + propertySources.add(new OriginTrackedMapPropertySource(name + documentNumber, loaded.get(i))); } return propertySources; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java index ffb7eb1a581..43632501fcb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java @@ -62,7 +62,7 @@ public class GitProperties extends InfoProperties { if (id == null) { return null; } - return (id.length() > 7 ? id.substring(0, 7) : id); + return (id.length() > 7) ? id.substring(0, 7) : id; } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java index e35641de203..4022026e7f5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jackson/JsonComponentModule.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -57,9 +57,9 @@ public class JsonComponentModule extends SimpleModule implements BeanFactoryAwar if (beanFactory instanceof ListableBeanFactory) { addJsonBeans((ListableBeanFactory) beanFactory); } - beanFactory = (beanFactory instanceof HierarchicalBeanFactory + beanFactory = (beanFactory instanceof HierarchicalBeanFactory) ? ((HierarchicalBeanFactory) beanFactory).getParentBeanFactory() - : null); + : null; } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DataSourceBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DataSourceBuilder.java index 9a7d36fea43..32770c45fc5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DataSourceBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DataSourceBuilder.java @@ -138,8 +138,8 @@ public final class DataSourceBuilder { } private Class getType() { - Class type = (this.type != null ? this.type - : findType(this.classLoader)); + Class type = (this.type != null) ? this.type + : findType(this.classLoader); if (type != null) { return type; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java index 1c868f4919c..330cf29257f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java @@ -260,7 +260,7 @@ public enum DatabaseDriver { /** * Find a {@link DatabaseDriver} for the given URL. - * @param url JDBC URL + * @param url the JDBC URL * @return the database driver or {@link #UNKNOWN} if not found */ public static DatabaseDriver fromJdbcUrl(String url) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java index 15b87434805..a26f861cb35 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java @@ -97,7 +97,7 @@ public enum EmbeddedDatabaseConnection { */ public String getUrl(String databaseName) { Assert.hasText(databaseName, "DatabaseName must not be empty"); - return (this.url != null ? String.format(this.url, databaseName) : null); + return (this.url != null) ? String.format(this.url, databaseName) : null; } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/metadata/CompositeDataSourcePoolMetadataProvider.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/metadata/CompositeDataSourcePoolMetadataProvider.java index 6bd415c1941..d794886fbcb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/metadata/CompositeDataSourcePoolMetadataProvider.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/metadata/CompositeDataSourcePoolMetadataProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -42,9 +42,9 @@ public class CompositeDataSourcePoolMetadataProvider */ public CompositeDataSourcePoolMetadataProvider( Collection providers) { - this.providers = (providers != null + this.providers = (providers != null) ? Collections.unmodifiableList(new ArrayList<>(providers)) - : Collections.emptyList()); + : Collections.emptyList(); } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/metadata/TomcatDataSourcePoolMetadata.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/metadata/TomcatDataSourcePoolMetadata.java index 65257b96b9c..61a5777762b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/metadata/TomcatDataSourcePoolMetadata.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/metadata/TomcatDataSourcePoolMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -35,7 +35,7 @@ public class TomcatDataSourcePoolMetadata @Override public Integer getActive() { ConnectionPool pool = getDataSource().getPool(); - return (pool != null ? pool.getActive() : 0); + return (pool != null) ? pool.getActive() : 0; } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/AbstractJsonParser.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/AbstractJsonParser.java index c8b1dc80645..4a5cc4fb0aa 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/AbstractJsonParser.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/AbstractJsonParser.java @@ -44,7 +44,7 @@ public abstract class AbstractJsonParser implements JsonParser { protected final T trimParse(String json, String prefix, Function parser) { - String trimmed = (json != null ? json.trim() : ""); + String trimmed = (json != null) ? json.trim() : ""; if (trimmed.startsWith(prefix)) { return parser.apply(trimmed); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java index 7903d91706e..c0fa1768e0a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java @@ -99,7 +99,7 @@ public class AtomikosDependsOnBeanFactoryPostProcessor } private List asList(String[] array) { - return (array != null ? Arrays.asList(array) : Collections.emptyList()); + return (array != null) ? Arrays.asList(array) : Collections.emptyList(); } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/SimpleFormatter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/SimpleFormatter.java index 28fae9b136e..91752494feb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/SimpleFormatter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/java/SimpleFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,7 +65,7 @@ public class SimpleFormatter extends Formatter { private String getThreadName() { String name = Thread.currentThread().getName(); - return (name != null ? name : ""); + return (name != null) ? name : ""; } private static String getOrUseDefault(String key, String defaultValue) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java index 6bb5d716430..35c591cc914 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/ColorConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -101,7 +101,7 @@ public final class ColorConverter extends LogEventPatternConverter { } PatternParser parser = PatternLayout.createPatternParser(config); List formatters = parser.parse(options[0]); - AnsiElement element = (options.length != 1 ? ELEMENTS.get(options[1]) : null); + AnsiElement element = (options.length != 1) ? ELEMENTS.get(options[1]) : null; return new ColorConverter(formatters, element); } @@ -126,7 +126,7 @@ public final class ColorConverter extends LogEventPatternConverter { if (element == null) { // Assume highlighting element = LEVELS.get(event.getLevel().intLevel()); - element = (element != null ? element : AnsiColor.GREEN); + element = (element != null) ? element : AnsiColor.GREEN; } appendAnsiString(toAppendTo, buf.toString(), element); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java index 31fc33ec8a8..be7ebb2f80e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/ColorConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -67,7 +67,7 @@ public class ColorConverter extends CompositeConverter { if (element == null) { // Assume highlighting element = LEVELS.get(event.getLevel().toInteger()); - element = (element != null ? element : AnsiColor.GREEN); + element = (element != null) ? element : AnsiColor.GREEN; } return toAnsiString(in, element); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index 2c333c132a0..edb78c41422 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -160,7 +160,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { StringBuilder errors = new StringBuilder(); for (Status status : statuses) { if (status.getLevel() == Status.ERROR) { - errors.append(errors.length() > 0 ? String.format("%n") : ""); + errors.append((errors.length() > 0) ? String.format("%n") : ""); errors.append(status.toString()); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java index 60f1cc71ee1..1a9bcc6fab5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java @@ -53,7 +53,7 @@ public class OriginTrackedValue implements OriginProvider { @Override public String toString() { - return (this.value != null ? this.value.toString() : null); + return (this.value != null) ? this.value.toString() : null; } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/PropertySourceOrigin.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/PropertySourceOrigin.java index f40ced02155..d86e0dd8ce7 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/PropertySourceOrigin.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/PropertySourceOrigin.java @@ -76,7 +76,7 @@ public class PropertySourceOrigin implements Origin { */ public static Origin get(PropertySource propertySource, String name) { Origin origin = OriginLookup.getOrigin(propertySource, name); - return (origin != null ? origin : new PropertySourceOrigin(propertySource, name)); + return (origin != null) ? origin : new PropertySourceOrigin(propertySource, name); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java index 0a2e189eb81..cd7fd5eb671 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java @@ -83,7 +83,7 @@ public class TextResourceOrigin implements Origin { @Override public String toString() { StringBuilder result = new StringBuilder(); - result.append(this.resource != null ? this.resource.getDescription() + result.append((this.resource != null) ? this.resource.getDescription() : "unknown resource [?]"); if (this.location != null) { result.append(":").append(this.location); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java index 241cf6d0b0d..95848c38137 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java @@ -57,7 +57,7 @@ public class ApplicationHome { * @param sourceClass the source class or {@code null} */ public ApplicationHome(Class sourceClass) { - this.source = findSource(sourceClass != null ? sourceClass : getStartClass()); + this.source = findSource((sourceClass != null) ? sourceClass : getStartClass()); this.dir = findHomeDir(this.source); } @@ -88,11 +88,11 @@ public class ApplicationHome { private File findSource(Class sourceClass) { try { - ProtectionDomain domain = (sourceClass != null - ? sourceClass.getProtectionDomain() : null); - CodeSource codeSource = (domain != null ? domain.getCodeSource() : null); - URL location = (codeSource != null ? codeSource.getLocation() : null); - File source = (location != null ? findSource(location) : null); + ProtectionDomain domain = (sourceClass != null) + ? sourceClass.getProtectionDomain() : null; + CodeSource codeSource = (domain != null) ? domain.getCodeSource() : null; + URL location = (codeSource != null) ? codeSource.getLocation() : null; + File source = (location != null) ? findSource(location) : null; if (source != null && source.exists() && !isUnitTest()) { return source.getAbsoluteFile(); } @@ -136,7 +136,7 @@ public class ApplicationHome { private File findHomeDir(File source) { File homeDir = source; - homeDir = (homeDir != null ? homeDir : findDefaultHomeDir()); + homeDir = (homeDir != null) ? homeDir : findDefaultHomeDir(); if (homeDir.isFile()) { homeDir = homeDir.getParentFile(); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java index 048ecc1512a..fad8b0fea3d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java @@ -62,7 +62,7 @@ public class ApplicationPid { @Override public String toString() { - return (this.pid != null ? this.pid : "???"); + return (this.pid != null) ? this.pid : "???"; } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/SystemProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/SystemProperties.java index 3ae58829ccc..52c97e6b16c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/SystemProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/SystemProperties.java @@ -31,7 +31,7 @@ public final class SystemProperties { for (String property : properties) { try { String override = System.getProperty(property); - override = (override != null ? override : System.getenv(property)); + override = (override != null) ? override : System.getenv(property); if (override != null) { return override; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java index 81945422ec0..eb9357e832e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java @@ -49,9 +49,9 @@ public final class LambdaSafe { static { CLASS_GET_MODULE = ReflectionUtils.findMethod(Class.class, "getModule"); - MODULE_GET_NAME = (CLASS_GET_MODULE != null + MODULE_GET_NAME = (CLASS_GET_MODULE != null) ? ReflectionUtils.findMethod(CLASS_GET_MODULE.getReturnType(), "getName") - : null); + : null; } private LambdaSafe() { @@ -206,10 +206,10 @@ public final class LambdaSafe { if (this.logger.isDebugEnabled()) { Class expectedType = ResolvableType.forClass(this.callbackType) .resolveGeneric(); - String message = "Non-matching " + (expectedType != null - ? ClassUtils.getShortName(expectedType) + " type" : "type") - + " for callback " + ClassUtils.getShortName(this.callbackType) - + ": " + callback; + String expectedTypeName = (expectedType != null) + ? ClassUtils.getShortName(expectedType) + " type" : "type"; + String message = "Non-matching " + expectedTypeName + " for callback " + + ClassUtils.getShortName(this.callbackType) + ": " + callback; this.logger.debug(message, ex); } } @@ -404,7 +404,7 @@ public final class LambdaSafe { * @return the result of the invocation or the fallback */ public R get(R fallback) { - return (this != NONE ? this.value : fallback); + return (this != NONE) ? this.value : fallback; } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java index 58d464deb41..1626ddbcfbc 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java @@ -605,13 +605,13 @@ public class RestTemplateBuilder { } private Set append(Set set, T addition) { - Set result = new LinkedHashSet<>(set != null ? set : Collections.emptySet()); + Set result = new LinkedHashSet<>((set != null) ? set : Collections.emptySet()); result.add(addition); return Collections.unmodifiableSet(result); } private Set append(Set set, Collection additions) { - Set result = new LinkedHashSet<>(set != null ? set : Collections.emptySet()); + Set result = new LinkedHashSet<>((set != null) ? set : Collections.emptySet()); result.addAll(additions); return Collections.unmodifiableSet(result); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java index 22c6446d0cc..ea62d5cafa9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyReactiveWebServerFactory.java @@ -135,7 +135,7 @@ public class JettyReactiveWebServerFactory extends AbstractReactiveWebServerFact } protected Server createJettyServer(JettyHttpHandlerAdapter servlet) { - int port = (getPort() >= 0 ? getPort() : 0); + int port = (getPort() >= 0) ? getPort() : 0; InetSocketAddress address = new InetSocketAddress(getAddress(), port); Server server = new Server(getThreadPool()); server.addConnector(createConnector(address, server)); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java index 6e1730d1474..f75501317d0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java @@ -135,7 +135,7 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor @Override public WebServer getWebServer(ServletContextInitializer... initializers) { JettyEmbeddedWebAppContext context = new JettyEmbeddedWebAppContext(); - int port = (getPort() >= 0 ? getPort() : 0); + int port = (getPort() >= 0) ? getPort() : 0; InetSocketAddress address = new InetSocketAddress(getAddress(), port); Server server = createServer(address); configureWebAppContext(context, initializers); @@ -253,19 +253,19 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor private File getTempDirectory() { String temp = System.getProperty("java.io.tmpdir"); - return (temp != null ? new File(temp) : null); + return (temp != null) ? new File(temp) : null; } private void configureDocumentRoot(WebAppContext handler) { File root = getValidDocumentRoot(); - File docBase = (root != null ? root : createTempDir("jetty-docbase")); + File docBase = (root != null) ? root : createTempDir("jetty-docbase"); try { List resources = new ArrayList<>(); Resource rootResource = (docBase.isDirectory() ? Resource.newResource(docBase.getCanonicalFile()) : JarResource.newJarResource(Resource.newResource(docBase))); - resources.add( - root != null ? new LoaderHidingResource(rootResource) : rootResource); + resources.add((root != null) ? new LoaderHidingResource(rootResource) + : rootResource); for (URL resourceJarUrl : this.getUrlsOfJarsWithMetaInfResources()) { Resource resource = createResource(resourceJarUrl); if (resource.exists() && resource.isDirectory()) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java index e4dfe797980..a6ac57881ce 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java @@ -172,7 +172,7 @@ public class JettyWebServer implements WebServer { private String getActualPortsDescription() { StringBuilder ports = new StringBuilder(); for (Connector connector : this.server.getConnectors()) { - ports.append(ports.length() != 0 ? ", " : ""); + ports.append((ports.length() != 0) ? ", " : ""); ports.append(getLocalPort(connector) + getProtocols(connector)); } return ports.toString(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java index abe648b156a..5695c61bbff 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/SslServerCustomizer.java @@ -79,8 +79,8 @@ public class SslServerCustomizer implements NettyServerCustomizer { KeyStore keyStore = getKeyStore(ssl, sslStoreProvider); KeyManagerFactory keyManagerFactory = KeyManagerFactory .getInstance(KeyManagerFactory.getDefaultAlgorithm()); - char[] keyPassword = (ssl.getKeyPassword() != null - ? ssl.getKeyPassword().toCharArray() : null); + char[] keyPassword = (ssl.getKeyPassword() != null) + ? ssl.getKeyPassword().toCharArray() : null; if (keyPassword == null && ssl.getKeyStorePassword() != null) { keyPassword = ssl.getKeyStorePassword().toCharArray(); } @@ -126,13 +126,13 @@ public class SslServerCustomizer implements NettyServerCustomizer { private KeyStore loadKeyStore(String type, String resource, String password) throws Exception { - type = (type != null ? type : "JKS"); + type = (type != null) ? type : "JKS"; if (resource == null) { return null; } KeyStore store = KeyStore.getInstance(type); URL url = ResourceUtils.getURL(resource); - store.load(url.openStream(), password != null ? password.toCharArray() : null); + store.load(url.openStream(), (password != null) ? password.toCharArray() : null); return store; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java index 85827cad094..e9fd3f02e25 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedWebappClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,7 +65,7 @@ public class TomcatEmbeddedWebappClassLoader extends ParallelWebappClassLoader { throws ClassNotFoundException { synchronized (getClassLoadingLock(name)) { Class result = findExistingLoadedClass(name); - result = (result != null ? result : doLoadClass(name)); + result = (result != null) ? result : doLoadClass(name); if (result == null) { throw new ClassNotFoundException(name); } @@ -75,7 +75,7 @@ public class TomcatEmbeddedWebappClassLoader extends ParallelWebappClassLoader { private Class findExistingLoadedClass(String name) { Class resultClass = findLoadedClass0(name); - resultClass = (resultClass != null ? resultClass : findLoadedClass(name)); + resultClass = (resultClass != null) ? resultClass : findLoadedClass(name); return resultClass; } @@ -83,10 +83,10 @@ public class TomcatEmbeddedWebappClassLoader extends ParallelWebappClassLoader { checkPackageAccess(name); if ((this.delegate || filter(name, true))) { Class result = loadFromParent(name); - return (result != null ? result : findClassIgnoringNotFound(name)); + return (result != null) ? result : findClassIgnoringNotFound(name); } Class result = findClassIgnoringNotFound(name); - return (result != null ? result : loadFromParent(name)); + return (result != null) ? result : loadFromParent(name); } private Class resolveIfNecessary(Class resultClass, boolean resolve) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java index 51f29dc3e2f..b76f1f37bd6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java @@ -98,8 +98,8 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac @Override public WebServer getWebServer(HttpHandler httpHandler) { Tomcat tomcat = new Tomcat(); - File baseDir = (this.baseDirectory != null ? this.baseDirectory - : createTempDir("tomcat")); + File baseDir = (this.baseDirectory != null) ? this.baseDirectory + : createTempDir("tomcat"); tomcat.setBaseDir(baseDir.getAbsolutePath()); Connector connector = new Connector(this.protocol); tomcat.getService().addConnector(connector); @@ -154,7 +154,7 @@ public class TomcatReactiveWebServerFactory extends AbstractReactiveWebServerFac } protected void customizeConnector(Connector connector) { - int port = (getPort() >= 0 ? getPort() : 0); + int port = (getPort() >= 0) ? getPort() : 0; connector.setPort(port); if (StringUtils.hasText(this.getServerHeader())) { connector.setAttribute("server", this.getServerHeader()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java index d69fbab7cc9..646b756f8ac 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java @@ -158,8 +158,8 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto @Override public WebServer getWebServer(ServletContextInitializer... initializers) { Tomcat tomcat = new Tomcat(); - File baseDir = (this.baseDirectory != null ? this.baseDirectory - : createTempDir("tomcat")); + File baseDir = (this.baseDirectory != null) ? this.baseDirectory + : createTempDir("tomcat"); tomcat.setBaseDir(baseDir.getAbsolutePath()); Connector connector = new Connector(this.protocol); tomcat.getService().addConnector(connector); @@ -190,12 +190,12 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto context.setName(getContextPath()); context.setDisplayName(getDisplayName()); context.setPath(getContextPath()); - File docBase = (documentRoot != null ? documentRoot - : createTempDir("tomcat-docbase")); + File docBase = (documentRoot != null) ? documentRoot + : createTempDir("tomcat-docbase"); context.setDocBase(docBase.getAbsolutePath()); context.addLifecycleListener(new FixContextListener()); context.setParentClassLoader( - this.resourceLoader != null ? this.resourceLoader.getClassLoader() + (this.resourceLoader != null) ? this.resourceLoader.getClassLoader() : ClassUtils.getDefaultClassLoader()); resetDefaultLocaleMapping(context); addLocaleMappings(context); @@ -283,7 +283,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto // Needs to be protected so it can be used by subclasses protected void customizeConnector(Connector connector) { - int port = (getPort() >= 0 ? getPort() : 0); + int port = (getPort() >= 0) ? getPort() : 0; connector.setPort(port); if (StringUtils.hasText(this.getServerHeader())) { connector.setAttribute("server", this.getServerHeader()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java index e3e824d109a..c95ab77010c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java @@ -319,7 +319,7 @@ public class TomcatWebServer implements WebServer { private String getPortsDescription(boolean localPort) { StringBuilder ports = new StringBuilder(); for (Connector connector : this.tomcat.getService().findConnectors()) { - ports.append(ports.length() != 0 ? " " : ""); + ports.append((ports.length() != 0) ? " " : ""); int port = (localPort ? connector.getLocalPort() : connector.getPort()); ports.append(port + " (" + connector.getScheme() + ")"); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/SslBuilderCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/SslBuilderCustomizer.java index eb0cbdbdadb..64d314bf855 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/SslBuilderCustomizer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/SslBuilderCustomizer.java @@ -114,8 +114,8 @@ class SslBuilderCustomizer implements UndertowBuilderCustomizer { KeyStore keyStore = getKeyStore(ssl, sslStoreProvider); KeyManagerFactory keyManagerFactory = KeyManagerFactory .getInstance(KeyManagerFactory.getDefaultAlgorithm()); - char[] keyPassword = (ssl.getKeyPassword() != null - ? ssl.getKeyPassword().toCharArray() : null); + char[] keyPassword = (ssl.getKeyPassword() != null) + ? ssl.getKeyPassword().toCharArray() : null; if (keyPassword == null && ssl.getKeyStorePassword() != null) { keyPassword = ssl.getKeyStorePassword().toCharArray(); } @@ -175,13 +175,13 @@ class SslBuilderCustomizer implements UndertowBuilderCustomizer { private KeyStore loadKeyStore(String type, String resource, String password) throws Exception { - type = (type != null ? type : "JKS"); + type = (type != null) ? type : "JKS"; if (resource == null) { return null; } KeyStore store = KeyStore.getInstance(type); URL url = ResourceUtils.getURL(resource); - store.load(url.openStream(), password != null ? password.toCharArray() : null); + store.load(url.openStream(), (password != null) ? password.toCharArray() : null); return store; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java index 80f0763d841..8f9302561cf 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java @@ -149,8 +149,8 @@ public class UndertowReactiveWebServerFactory extends AbstractReactiveWebServerF try { createAccessLogDirectoryIfNecessary(); XnioWorker worker = createWorker(); - String prefix = (this.accessLogPrefix != null ? this.accessLogPrefix - : "access_log."); + String prefix = (this.accessLogPrefix != null) ? this.accessLogPrefix + : "access_log."; DefaultAccessLogReceiver accessLogReceiver = new DefaultAccessLogReceiver( worker, this.accessLogDirectory, prefix, this.accessLogSuffix, this.accessLogRotate); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java index 6aaffccf10e..fdc2e33ba1c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java @@ -256,7 +256,7 @@ public class UndertowServletWebServer implements WebServer { SocketAddress socketAddress = channel.getLocalAddress(); if (socketAddress instanceof InetSocketAddress) { String protocol = (ReflectionUtils.findField(channel.getClass(), - "ssl") != null ? "https" : "http"); + "ssl") != null) ? "https" : "http"; return new Port(((InetSocketAddress) socketAddress).getPort(), protocol); } return null; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java index f1664639193..1097a985842 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactory.java @@ -299,8 +299,8 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac try { createAccessLogDirectoryIfNecessary(); XnioWorker worker = createWorker(); - String prefix = (this.accessLogPrefix != null ? this.accessLogPrefix - : "access_log."); + String prefix = (this.accessLogPrefix != null) ? this.accessLogPrefix + : "access_log."; DefaultAccessLogReceiver accessLogReceiver = new DefaultAccessLogReceiver( worker, this.accessLogDirectory, prefix, this.accessLogSuffix, this.accessLogRotate); @@ -399,7 +399,7 @@ public class UndertowServletWebServerFactory extends AbstractServletWebServerFac private File getCanonicalDocumentRoot(File docBase) { try { - File root = (docBase != null ? docBase : createTempDir("undertow-docbase")); + File root = (docBase != null) ? docBase : createTempDir("undertow-docbase"); return root.getCanonicalFile(); } catch (IOException ex) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java index c5f20ed30e9..1a643dcd4c6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java @@ -185,7 +185,7 @@ public class UndertowWebServer implements WebServer { SocketAddress socketAddress = channel.getLocalAddress(); if (socketAddress instanceof InetSocketAddress) { Field sslField = ReflectionUtils.findField(channel.getClass(), "ssl"); - String protocol = (sslField != null ? "https" : "http"); + String protocol = (sslField != null) ? "https" : "http"; return new UndertowWebServer.Port( ((InetSocketAddress) socketAddress).getPort(), protocol); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java index b33934ca299..577586d06e3 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java @@ -106,7 +106,7 @@ public class DefaultErrorAttributes implements ErrorAttributes { private Throwable determineException(Throwable error) { if (error instanceof ResponseStatusException) { - return (error.getCause() != null ? error.getCause() : error); + return (error.getCause() != null) ? error.getCause() : error; } return error; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheView.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheView.java index 05e1feb35da..ac8f455f27d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheView.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/result/view/MustacheView.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -115,7 +115,7 @@ public class MustacheView extends AbstractUrlBasedView { } private Optional getCharset(MediaType mediaType) { - return Optional.ofNullable(mediaType != null ? mediaType.getCharset() : null); + return Optional.ofNullable((mediaType != null) ? mediaType.getCharset() : null); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java index 9096fd36b94..180fbcc400d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -84,7 +84,7 @@ public class ErrorPage { * @return the status value (or 0 for a page that matches any status) */ public int getStatusCode() { - return (this.status != null ? this.status.value() : 0); + return (this.status != null) ? this.status.value() : 0; } /** @@ -92,7 +92,7 @@ public class ErrorPage { * @return the exception type name (or {@code null} if there is none) */ public String getExceptionName() { - return (this.exception != null ? this.exception.getName() : null); + return (this.exception != null) ? this.exception.getName() : null; } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java index cf6a778b387..f3fa83b026e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java @@ -279,7 +279,7 @@ public final class MimeMappings implements Iterable { */ public String add(String extension, String mimeType) { Mapping previous = this.map.put(extension, new Mapping(extension, mimeType)); - return (previous != null ? previous.getMimeType() : null); + return (previous != null) ? previous.getMimeType() : null; } /** @@ -289,7 +289,7 @@ public final class MimeMappings implements Iterable { */ public String get(String extension) { Mapping mapping = this.map.get(extension); - return (mapping != null ? mapping.getMimeType() : null); + return (mapping != null) ? mapping.getMimeType() : null; } /** @@ -299,7 +299,7 @@ public final class MimeMappings implements Iterable { */ public String remove(String extension) { Mapping previous = this.map.remove(extension); - return (previous != null ? previous.getMimeType() : null); + return (previous != null) ? previous.getMimeType() : null; } @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java index af5d4e4632e..b604311b2a2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java @@ -132,7 +132,7 @@ public abstract class DynamicRegistrationBean * @return the deduced name */ protected final String getOrDeduceName(Object value) { - return (this.name != null ? this.name : Conventions.getVariableName(value)); + return (this.name != null) ? this.name : Conventions.getVariableName(value); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java index c3663de2efc..559dc9baa62 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java @@ -271,7 +271,7 @@ public class ServletContextInitializerBeans @Override public RegistrationBean createRegistrationBean(String name, Servlet source, int totalNumberOfSourceBeans) { - String url = (totalNumberOfSourceBeans != 1 ? "/" + name + "/" : "/"); + String url = (totalNumberOfSourceBeans != 1) ? "/" + name + "/" : "/"; if (name.equals(DISPATCHER_SERVLET_NAME)) { url = "/"; // always map the main dispatcherServlet to "/" } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/WebApplicationContextServletContextAwareProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/WebApplicationContextServletContextAwareProcessor.java index 2acc7be9bb3..e09411e1b68 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/WebApplicationContextServletContextAwareProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/WebApplicationContextServletContextAwareProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -45,13 +45,13 @@ public class WebApplicationContextServletContextAwareProcessor @Override protected ServletContext getServletContext() { ServletContext servletContext = this.webApplicationContext.getServletContext(); - return (servletContext != null ? servletContext : super.getServletContext()); + return (servletContext != null) ? servletContext : super.getServletContext(); } @Override protected ServletConfig getServletConfig() { ServletConfig servletConfig = this.webApplicationContext.getServletConfig(); - return (servletConfig != null ? servletConfig : super.getServletConfig()); + return (servletConfig != null) ? servletConfig : super.getServletConfig(); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java index f79dc58dee4..bb2e6c2e1a5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java @@ -60,9 +60,9 @@ class DocumentRoot { */ public final File getValidDirectory() { File file = this.directory; - file = (file != null ? file : getWarFileDocumentRoot()); - file = (file != null ? file : getExplodedWarFileDocumentRoot()); - file = (file != null ? file : getCommonDocumentRoot()); + file = (file != null) ? file : getWarFileDocumentRoot(); + file = (file != null) ? file : getExplodedWarFileDocumentRoot(); + file = (file != null) ? file : getCommonDocumentRoot(); if (file == null && this.logger.isDebugEnabled()) { logNoDocumentRoots(); } @@ -98,7 +98,7 @@ class DocumentRoot { File getCodeSourceArchive(CodeSource codeSource) { try { - URL location = (codeSource != null ? codeSource.getLocation() : null); + URL location = (codeSource != null) ? codeSource.getLocation() : null; if (location == null) { return null; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java index 4792a045f64..3dc89a63730 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java @@ -207,8 +207,8 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry { * @since 1.5.0 */ protected String getDescription(HttpServletRequest request) { - return "[" + request.getServletPath() - + (request.getPathInfo() != null ? request.getPathInfo() : "") + "]"; + String pathInfo = (request.getPathInfo() != null) ? request.getPathInfo() : ""; + return "[" + request.getServletPath() + pathInfo + "]"; } private void handleCommittedResponse(HttpServletRequest request, Throwable ex) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index 7740fb0c33c..96636bf6b2d 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -1477,7 +1477,7 @@ public class SpringApplicationTests { @Override public Resource getResource(String path) { Resource resource = this.resources.get(path); - return (resource != null ? resource : new ClassPathResource("doesnotexist")); + return (resource != null) ? resource : new ClassPathResource("doesnotexist"); } @Override diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java index 34428de8bfd..228782a427c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/config/ConfigFileApplicationListenerTests.java @@ -486,7 +486,7 @@ public class ConfigFileApplicationListenerTests { } private String createLogForProfile(String profile) { - String suffix = (profile != null ? "-" + profile : ""); + String suffix = (profile != null) ? "-" + profile : ""; String string = ".properties)"; return "Loaded config file '" + new File("target/test-classes/application" + suffix + ".properties") diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java index 2a52bfbe832..ca9e4e34e53 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/AliasedConfigurationPropertySourceTests.java @@ -114,7 +114,7 @@ public class AliasedConfigurationPropertySourceTests { private Object getValue(ConfigurationPropertySource source, String name) { ConfigurationProperty property = source .getConfigurationProperty(ConfigurationPropertyName.of(name)); - return (property != null ? property.getValue() : null); + return (property != null) ? property.getValue() : null; } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySourceTests.java index 46c0cc377a8..7f171f5f7b3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySourceTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySourceTests.java @@ -112,7 +112,7 @@ public class MapConfigurationPropertySourceTests { private Object getValue(ConfigurationPropertySource source, String name) { ConfigurationProperty property = source .getConfigurationProperty(ConfigurationPropertyName.of(name)); - return (property != null ? property.getValue() : null); + return (property != null) ? property.getValue() : null; } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java index a0229350955..d7927ffd07c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindFailureAnalyzerTests.java @@ -120,8 +120,8 @@ public class BindFailureAnalyzerTests { Map map = new HashMap<>(); for (String pair : environment) { int index = pair.indexOf("="); - String key = (index > 0 ? pair.substring(0, index) : pair); - String value = (index > 0 ? pair.substring(index + 1) : ""); + String key = (index > 0) ? pair.substring(0, index) : pair; + String value = (index > 0) ? pair.substring(index + 1) : ""; map.put(key.trim(), value.trim()); } sources.addFirst(new MapPropertySource("test", map)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java index a79f5e7b0ee..e7cf6b4f329 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/BindValidationFailureAnalyzerTests.java @@ -135,8 +135,8 @@ public class BindValidationFailureAnalyzerTests { Map map = new HashMap<>(); for (String pair : environment) { int index = pair.indexOf("="); - String key = (index > 0 ? pair.substring(0, index) : pair); - String value = (index > 0 ? pair.substring(index + 1) : ""); + String key = (index > 0) ? pair.substring(0, index) : pair; + String value = (index > 0) ? pair.substring(index + 1) : ""; map.put(key.trim(), value.trim()); } sources.addFirst(new MapPropertySource("test", map)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java index 1ad6e293437..69029d2afbd 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/diagnostics/analyzer/UnboundConfigurationPropertyFailureAnalyzerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -98,8 +98,8 @@ public class UnboundConfigurationPropertyFailureAnalyzerTests { Map map = new HashMap<>(); for (String pair : environment) { int index = pair.indexOf("="); - String key = (index > 0 ? pair.substring(0, index) : pair); - String value = (index > 0 ? pair.substring(index + 1) : ""); + String key = (index > 0) ? pair.substring(0, index) : pair; + String value = (index > 0) ? pair.substring(index + 1) : ""; map.put(key.trim(), value.trim()); } sources.addFirst(new MapPropertySource("test", map)); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java index 5e0e2e5beba..74dadf8761c 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java @@ -255,7 +255,7 @@ public class OriginTrackedPropertiesLoaderTests { } private Object getValue(OriginTrackedValue value) { - return (value != null ? value.getValue() : null); + return (value != null) ? value.getValue() : null; } private String getLocation(OriginTrackedValue value) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java index e628d60c2f0..b209eb9db0e 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java @@ -54,7 +54,7 @@ public final class MockOrigin implements Origin { } public static Origin of(String value) { - return (value != null ? new MockOrigin(value) : null); + return (value != null) ? new MockOrigin(value) : null; } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java index 69bb99fc6e4..fc8f04f60b1 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactoryTests.java @@ -362,7 +362,7 @@ public class JettyServletWebServerFactoryTests WebAppContext context = (WebAppContext) ((JettyWebServer) this.webServer) .getServer().getHandler(); String charsetName = context.getLocaleEncoding(locale); - return (charsetName != null ? Charset.forName(charsetName) : null); + return (charsetName != null) ? Charset.forName(charsetName) : null; } @Override 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 6ab1dfd7732..4f23db22641 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 @@ -458,7 +458,7 @@ public class TomcatServletWebServerFactoryTests .getHost().findChildren()[0]; CharsetMapper mapper = ((TomcatEmbeddedContext) context).getCharsetMapper(); String charsetName = mapper.getCharset(locale); - return (charsetName != null ? Charset.forName(charsetName) : null); + return (charsetName != null) ? Charset.forName(charsetName) : null; } private void assertTimeout(TomcatServletWebServerFactory factory, int expected) { diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java index 6a8fdd357f3..6f10cc9118a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java @@ -291,7 +291,7 @@ public class UndertowServletWebServerFactoryTests DeploymentInfo info = ((DeploymentManager) ReflectionTestUtils .getField(this.webServer, "manager")).getDeployment().getDeploymentInfo(); String charsetName = info.getLocaleCharsetMapping().get(locale.toString()); - return (charsetName != null ? Charset.forName(charsetName) : null); + return (charsetName != null) ? Charset.forName(charsetName) : null; } @Override diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/MockServletWebServerFactory.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/MockServletWebServerFactory.java index 0afb90d27fa..f7aff7a4d61 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/MockServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/MockServletWebServerFactory.java @@ -50,17 +50,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory } public ServletContext getServletContext() { - return (getWebServer() != null ? getWebServer().getServletContext() : null); + return (getWebServer() != null) ? getWebServer().getServletContext() : null; } public RegisteredServlet getRegisteredServlet(int index) { - return (getWebServer() != null ? getWebServer().getRegisteredServlet(index) - : null); + return (getWebServer() != null) ? getWebServer().getRegisteredServlet(index) + : null; } public RegisteredFilter getRegisteredFilter(int index) { - return (getWebServer() != null ? getWebServer().getRegisteredFilters(index) - : null); + return (getWebServer() != null) ? getWebServer().getRegisteredFilters(index) + : null; } public static class MockServletWebServer diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java index 0d7274bc24f..2fc61a0e1f1 100644 --- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java +++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/test/java/org/springframework/boot/context/embedded/AbstractApplicationLauncher.java @@ -70,9 +70,9 @@ abstract class AbstractApplicationLauncher extends ExternalResource { private Process startApplication() throws Exception { File workingDirectory = getWorkingDirectory(); - File serverPortFile = (workingDirectory != null + File serverPortFile = (workingDirectory != null) ? new File(workingDirectory, "target/server.port") - : new File("target/server.port")); + : new File("target/server.port"); serverPortFile.delete(); File archive = this.applicationBuilder.buildApplication(); List arguments = new ArrayList<>(); From e6a68b39a3c9a9d0e5f8ae3ce96de234dcfe75e5 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 26 Jul 2018 17:58:28 +0100 Subject: [PATCH 4/5] Fix checkstyle javadoc issues Fix checkstyle issues in javadoc following the spring-javaformat upgrade. See gh-13932 --- .../ExposeExcludePropertyEndpointFilter.java | 2 +- .../metrics/MeterRegistryCustomizer.java | 2 +- .../properties/PropertiesConfigAdapter.java | 2 +- .../StepRegistryPropertiesConfigAdapter.java | 2 +- .../boot/actuate/audit/AuditEvent.java | 14 +++++++------- .../endpoint/AbstractExposableEndpoint.java | 2 +- .../annotation/AbstractDiscoveredEndpoint.java | 2 +- .../endpoint/annotation/DiscoveredEndpoint.java | 2 +- .../annotation/DiscoveredOperationsFactory.java | 2 +- .../endpoint/annotation/EndpointDiscoverer.java | 4 ++-- .../metrics/cache/CacheMeterBinderProvider.java | 2 +- .../reactive/server/RouterFunctionMetrics.java | 12 ++++++------ .../PlatformTransactionManagerCustomizer.java | 4 ++-- .../boot/cli/app/SpringApplicationLauncher.java | 8 ++++---- .../boot/cli/command/CommandFactory.java | 4 ++-- .../boot/cli/command/HelpExample.java | 4 ++-- .../cli/command/install/DependencyResolver.java | 6 +++--- .../boot/cli/compiler/DependencyCustomizer.java | 16 ++++++++-------- .../ArtifactCoordinatesResolver.java | 14 +++++++------- .../dependencies/DependencyManagement.java | 4 ++-- .../DependencyResolutionFailedException.java | 4 ++-- .../devtools/tunnel/client/TunnelConnection.java | 8 ++++---- .../assertj/ApplicationContextAssert.java | 2 +- .../ApplicationContextAssertProvider.java | 4 ++-- .../runner/AbstractApplicationContextRunner.java | 6 +++--- .../test/context/runner/ContextConsumer.java | 4 ++-- .../test/json/AbstractJsonMarshalTester.java | 2 +- .../boot/test/json/BasicJsonTester.java | 2 +- .../boot/test/json/ObjectContentAssert.java | 4 ++-- .../MetadataCollector.java | 6 +++--- .../boot/loader/tools/JarWriter.java | 4 ++-- .../boot/loader/jar/CentralDirectoryParser.java | 2 +- .../boot/EnvironmentConverter.java | 6 +++--- .../springframework/boot/SpringApplication.java | 2 +- .../boot/builder/SpringApplicationBuilder.java | 6 +++--- .../context/properties/bind/AggregateBinder.java | 2 +- .../boot/context/properties/bind/BeanBinder.java | 2 +- .../boot/context/properties/bind/BindResult.java | 8 ++++---- .../boot/context/properties/bind/Bindable.java | 8 ++++---- .../properties/bind/IndexedElementsBinder.java | 2 +- ...gApplicationJsonEnvironmentPostProcessor.java | 2 +- .../boot/logging/AbstractLoggingSystem.java | 2 +- .../boot/logging/LoggingSystem.java | 2 +- .../boot/origin/OriginLookup.java | 4 ++-- .../orm/jpa/EntityManagerFactoryBuilder.java | 4 ++-- ...plicationContextServerWebExchangeMatcher.java | 2 +- .../ApplicationContextRequestMatcher.java | 2 +- .../springframework/boot/util/LambdaSafe.java | 2 +- .../AbstractConfigurableWebServerFactory.java | 4 ++-- .../web/server/WebServerFactoryCustomizer.java | 2 +- .../web/servlet/DynamicRegistrationBean.java | 2 +- 51 files changed, 110 insertions(+), 110 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java index 2c2ec8aadb4..d61b0370c9b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ExposeExcludePropertyEndpointFilter.java @@ -36,7 +36,7 @@ import org.springframework.util.Assert; * {@link EndpointFilter} that will filter endpoints based on {@code include} and * {@code exclude} properties. * - * @param The endpoint type + * @param the endpoint type * @author Phillip Webb * @since 2.0.0 */ diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryCustomizer.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryCustomizer.java index 0f1775d1179..97c86708152 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryCustomizer.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryCustomizer.java @@ -27,7 +27,7 @@ import io.micrometer.core.instrument.MeterRegistry; * the registry. * * @author Jon Schneider - * @param The registry type to customize + * @param the registry type to customize * @since 2.0.0 */ @FunctionalInterface diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/PropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/PropertiesConfigAdapter.java index 7e6a0c4a1b8..8f40ea3f7ea 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/PropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/PropertiesConfigAdapter.java @@ -24,7 +24,7 @@ import org.springframework.util.Assert; /** * Base class for properties to config adapters. * - * @param The properties type + * @param the properties type * @author Phillip Webb * @author Nikolay Rybak * @since 2.0.0 diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/StepRegistryPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/StepRegistryPropertiesConfigAdapter.java index f087c376d59..f8e758d7e74 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/StepRegistryPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/StepRegistryPropertiesConfigAdapter.java @@ -23,7 +23,7 @@ import io.micrometer.core.instrument.step.StepRegistryConfig; /** * Base class for {@link StepRegistryProperties} to {@link StepRegistryConfig} adapters. * - * @param The properties type + * @param the properties type * @author Jon Schneider * @author Phillip Webb * @since 2.0.0 diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java index c8edb8eca20..58a7a2a0fcd 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEvent.java @@ -55,9 +55,9 @@ public class AuditEvent implements Serializable { /** * Create a new audit event for the current time. - * @param principal The user principal responsible + * @param principal the user principal responsible * @param type the event type - * @param data The event data + * @param data the event data */ public AuditEvent(String principal, String type, Map data) { this(Instant.now(), principal, type, data); @@ -66,9 +66,9 @@ public class AuditEvent implements Serializable { /** * Create a new audit event for the current time from data provided as name-value * pairs. - * @param principal The user principal responsible + * @param principal the user principal responsible * @param type the event type - * @param data The event data in the form 'key=value' or simply 'key' + * @param data the event data in the form 'key=value' or simply 'key' */ public AuditEvent(String principal, String type, String... data) { this(Instant.now(), principal, type, convert(data)); @@ -76,10 +76,10 @@ public class AuditEvent implements Serializable { /** * Create a new audit event. - * @param timestamp The date/time of the event - * @param principal The user principal responsible + * @param timestamp the date/time of the event + * @param principal the user principal responsible * @param type the event type - * @param data The event data + * @param data the event data */ public AuditEvent(Instant timestamp, String principal, String type, Map data) { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractExposableEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractExposableEndpoint.java index b8e6e41e8b1..c7a87cdf2b4 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractExposableEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractExposableEndpoint.java @@ -26,7 +26,7 @@ import org.springframework.util.Assert; /** * Abstract base class for {@link ExposableEndpoint} implementations. * - * @param The operation type. + * @param the operation type. * @author Phillip Webb * @since 2.0.0 */ diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/AbstractDiscoveredEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/AbstractDiscoveredEndpoint.java index 622c80dd97e..6cd73db8e86 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/AbstractDiscoveredEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/AbstractDiscoveredEndpoint.java @@ -28,7 +28,7 @@ import org.springframework.util.Assert; * Abstract base class for {@link ExposableEndpoint endpoints} discovered by a * {@link EndpointDiscoverer}. * - * @param The operation type + * @param the operation type * @author Phillip Webb * @since 2.0.0 */ diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredEndpoint.java index 73a917b98c4..25e3543a4dc 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredEndpoint.java @@ -22,7 +22,7 @@ import org.springframework.boot.actuate.endpoint.Operation; /** * An {@link ExposableEndpoint endpoint} discovered by an {@link EndpointDiscoverer}. * - * @param The operation type + * @param the operation type * @author Phillip Webb * @since 2.0.0 */ diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredOperationsFactory.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredOperationsFactory.java index 4b9b64527cd..6a900109a02 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredOperationsFactory.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredOperationsFactory.java @@ -40,7 +40,7 @@ import org.springframework.core.annotation.AnnotationAttributes; * Factory to create an {@link Operation} for annotated methods on an * {@link Endpoint @Endpoint} or {@link EndpointExtension @EndpointExtension}. * - * @param The operation type + * @param the operation type * @author Andy Wilkinson * @author Stephane Nicoll * @author Phillip Webb diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java index 7c462310da1..1d46671ccd9 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java @@ -54,8 +54,8 @@ import org.springframework.util.StringUtils; * {@link Endpoint @Endpoint} beans and {@link EndpointExtension @EndpointExtension} beans * in an application context. * - * @param The endpoint type - * @param The operation type + * @param the endpoint type + * @param the operation type * @author Andy Wilkinson * @author Stephane Nicoll * @author Phillip Webb diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider.java index 3d44d5d64f2..f8ae3ed9a23 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CacheMeterBinderProvider.java @@ -24,7 +24,7 @@ import org.springframework.cache.Cache; /** * Provide a {@link MeterBinder} based on a {@link Cache}. * - * @param The cache type + * @param the cache type * @author Stephane Nicoll * @since 2.0.0 */ diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java index a8e7bf7c97e..9871af584c7 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/RouterFunctionMetrics.java @@ -69,8 +69,8 @@ public class RouterFunctionMetrics { /** * Returns a new {@link RouterFunctionMetrics} instance with the specified default * tags. - * @param defaultTags Generate a list of tags to apply to the timer. - * {@code ServerResponse} may be null. + * @param defaultTags function to generate a list of tags to apply to the timer + * {@code ServerResponse} may be null * @return {@code this} for further configuration */ public RouterFunctionMetrics defaultTags( @@ -94,8 +94,8 @@ public class RouterFunctionMetrics { /** * Creates a {@code method} tag from the method of the given {@code request}. - * @param request The HTTP request. - * @return A "method" tag whose value is a capitalized method (e.g. GET). + * @param request the HTTP request + * @return a "method" tag whose value is a capitalized method (e.g. GET) */ public static Tag getMethodTag(ServerRequest request) { return Tag.of("method", request.method().toString()); @@ -103,8 +103,8 @@ public class RouterFunctionMetrics { /** * Creates a {@code status} tag from the status of the given {@code response}. - * @param response The HTTP response. - * @return A "status" tag whose value is the numeric status code. + * @param response the HTTP response + * @return a "status" tag whose value is the numeric status code */ public static Tag getStatusTag(ServerResponse response) { return Tag.of("status", response.statusCode().toString()); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java index 91931cb3efc..aa6b58aa03f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/transaction/PlatformTransactionManagerCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -23,7 +23,7 @@ import org.springframework.transaction.PlatformTransactionManager; * {@link PlatformTransactionManager PlatformTransactionManagers} whilst retaining default * auto-configuration. * - * @param The transaction manager type + * @param the transaction manager type * @author Phillip Webb * @since 1.5.0 */ diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationLauncher.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationLauncher.java index 16faeba2fe6..44f64a6beea 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationLauncher.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/app/SpringApplicationLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -51,9 +51,9 @@ public class SpringApplicationLauncher { /** * Launches the application created using the given {@code sources}. The application * is launched with the given {@code args}. - * @param sources The sources for the application - * @param args The args for the application - * @return The application's {@code ApplicationContext} + * @param sources the sources for the application + * @param args the args for the application + * @return the application's {@code ApplicationContext} * @throws Exception if the launch fails */ public Object launch(Class[] sources, String[] args) throws Exception { diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandFactory.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandFactory.java index 8b6e069eec3..0ad790baaa2 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandFactory.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/CommandFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -30,7 +30,7 @@ public interface CommandFactory { /** * Returns the CLI {@link Command}s. - * @return The commands + * @return the commands */ Collection getCommands(); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/HelpExample.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/HelpExample.java index 9627ee70317..43bab3c8d19 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/HelpExample.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/HelpExample.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -30,7 +30,7 @@ public class HelpExample { /** * Create a new {@link HelpExample} instance. - * @param description The description (in the form "to ....") + * @param description the description (in the form "to ....") * @param example the example */ public HelpExample(String description, String example) { diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/DependencyResolver.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/DependencyResolver.java index 2e5b464a464..1a228744441 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/DependencyResolver.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/DependencyResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -32,8 +32,8 @@ interface DependencyResolver { /** * Resolves the given {@code artifactIdentifiers}, typically in the form * "group:artifact:version", and their dependencies. - * @param artifactIdentifiers The artifacts to resolve - * @return The {@code File}s for the resolved artifacts + * @param artifactIdentifiers the artifacts to resolve + * @return the {@code File}s for the resolved artifacts * @throws Exception if dependency resolution fails */ List resolve(List artifactIdentifiers) throws Exception; diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java index 8ba830ae803..b13f57df732 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -185,7 +185,7 @@ public class DependencyCustomizer { * Add dependencies and all of their dependencies. The group ID and version of the * dependencies are resolved from the modules using the customizer's * {@link ArtifactCoordinatesResolver}. - * @param modules The module IDs + * @param modules the module IDs * @return this {@link DependencyCustomizer} for continued use */ public DependencyCustomizer add(String... modules) { @@ -199,9 +199,9 @@ public class DependencyCustomizer { * Add a single dependency and, optionally, all of its dependencies. The group ID and * version of the dependency are resolved from the module using the customizer's * {@link ArtifactCoordinatesResolver}. - * @param module The module ID + * @param module the module ID * @param transitive {@code true} if the transitive dependencies should also be added, - * otherwise {@code false}. + * otherwise {@code false} * @return this {@link DependencyCustomizer} for continued use */ public DependencyCustomizer add(String module, boolean transitive) { @@ -212,11 +212,11 @@ public class DependencyCustomizer { * Add a single dependency with the specified classifier and type and, optionally, all * of its dependencies. The group ID and version of the dependency are resolved from * the module by using the customizer's {@link ArtifactCoordinatesResolver}. - * @param module The module ID - * @param classifier The classifier, may be {@code null} - * @param type The type, may be {@code null} + * @param module the module ID + * @param classifier the classifier, may be {@code null} + * @param type the type, may be {@code null} * @param transitive {@code true} if the transitive dependencies should also be added, - * otherwise {@code false}. + * otherwise {@code false} * @return this {@link DependencyCustomizer} for continued use */ public DependencyCustomizer add(String module, String classifier, String type, diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/ArtifactCoordinatesResolver.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/ArtifactCoordinatesResolver.java index 4a0e8f6961f..d999a1ad381 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/ArtifactCoordinatesResolver.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/ArtifactCoordinatesResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -31,24 +31,24 @@ public interface ArtifactCoordinatesResolver { /** * Gets the group id of the artifact identified by the given {@code module}. Returns * {@code null} if the artifact is unknown to the resolver. - * @param module The id of the module - * @return The group id of the module + * @param module the id of the module + * @return the group id of the module */ String getGroupId(String module); /** * Gets the artifact id of the artifact identified by the given {@code module}. * Returns {@code null} if the artifact is unknown to the resolver. - * @param module The id of the module - * @return The artifact id of the module + * @param module the id of the module + * @return the artifact id of the module */ String getArtifactId(String module); /** * Gets the version of the artifact identified by the given {@code module}. Returns * {@code null} if the artifact is unknown to the resolver. - * @param module The id of the module - * @return The version of the module + * @param module the id of the module + * @return the version of the module */ String getVersion(String module); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagement.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagement.java index 29fe8b75ef5..44fc2b55e39 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagement.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/DependencyManagement.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -40,7 +40,7 @@ public interface DependencyManagement { /** * Finds the managed dependency with the given {@code artifactId}. - * @param artifactId The artifact ID of the dependency to find + * @param artifactId the artifact ID of the dependency to find * @return the dependency, or {@code null} */ Dependency find(String artifactId); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionFailedException.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionFailedException.java index ef0eda448ae..70db6a12c0d 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionFailedException.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/DependencyResolutionFailedException.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -27,7 +27,7 @@ public class DependencyResolutionFailedException extends RuntimeException { /** * Creates a new {@code DependencyResolutionFailedException} with the given * {@code cause}. - * @param cause The cause of the resolution failure + * @param cause the cause of the resolution failure */ public DependencyResolutionFailedException(Throwable cause) { super(cause); diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelConnection.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelConnection.java index de562f9bb77..2f01b347809 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelConnection.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -30,10 +30,10 @@ public interface TunnelConnection { /** * Open the tunnel connection. - * @param incomingChannel A {@link WritableByteChannel} that should be used to write - * any incoming data received from the remote server. + * @param incomingChannel a {@link WritableByteChannel} that should be used to write + * any incoming data received from the remote server * @param closeable a closeable to call when the channel is closed - * @return A {@link WritableByteChannel} that should be used to send any outgoing data + * @return a {@link WritableByteChannel} that should be used to send any outgoing data * destined for the remote server * @throws Exception in case of errors */ diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java index f1fc7902052..4cb9615b920 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java @@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat; * AssertJ {@link org.assertj.core.api.Assert assertions} that can be applied to an * {@link ApplicationContext}. * - * @param The application context type + * @param the application context type * @author Phillip Webb * @author Andy Wilkinson * @since 2.0.0 diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java index b6f07318bf9..fd618dd385f 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssertProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,7 +41,7 @@ import org.springframework.util.Assert; * Any {@link ApplicationContext} method called on a context that has failed to start will * throw an {@link IllegalStateException}. * - * @param The application context type + * @param the application context type * @author Phillip Webb * @see AssertableApplicationContext * @see AssertableWebApplicationContext diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunner.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunner.java index e149fd66ac8..9c971ef59d6 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunner.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunner.java @@ -84,9 +84,9 @@ import org.springframework.util.Assert; * } *

* - * @param The "self" type for this runner - * @param The context type - * @param The application context assertion provider + * @param the "self" type for this runner + * @param the context type + * @param the application context assertion provider * @author Stephane Nicoll * @author Andy Wilkinson * @author Phillip Webb diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ContextConsumer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ContextConsumer.java index e6da8ca1501..6c887a489e3 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ContextConsumer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/runner/ContextConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -24,7 +24,7 @@ import org.springframework.context.ApplicationContext; * * @author Stephane Nicoll * @author Andy Wilkinson - * @param The application context type + * @param the application context type * @since 2.0.0 * @see AbstractApplicationContextRunner */ diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java index 46e3ef20fc6..8567e794788 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/AbstractJsonMarshalTester.java @@ -352,7 +352,7 @@ public abstract class AbstractJsonMarshalTester { * Utility class used to support field initialization. Used by subclasses to support * {@code initFields}. * - * @param The marshaller type + * @param the marshaller type */ protected abstract static class FieldInitializer { diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java index 187d834a075..4605b624809 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/BasicJsonTester.java @@ -101,7 +101,7 @@ public class BasicJsonTester { * Create JSON content from the specified String source. The source can contain the * JSON itself or, if it ends with {@code .json}, the name of a resource to be loaded * using {@code resourceLoadClass}. - * @param source JSON content or a {@code .json} resource name + * @param source the JSON content or a {@code .json} resource name * @return the JSON content */ public JsonContent from(CharSequence source) { diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContentAssert.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContentAssert.java index 569cf6c60a1..7790422516b 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContentAssert.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/ObjectContentAssert.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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 @@ import org.assertj.core.internal.Objects; /** * AssertJ {@link Assert} for {@link ObjectContent}. * - * @param The actual type + * @param the actual type * @author Phillip Webb * @since 1.4.0 */ diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java index a6d129acb94..58e68af44db 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -51,8 +51,8 @@ public class MetadataCollector { /** * Creates a new {@code MetadataProcessor} instance. - * @param processingEnvironment The processing environment of the build - * @param previousMetadata Any previous metadata or {@code null} + * @param processingEnvironment the processing environment of the build + * @param previousMetadata any previous metadata or {@code null} */ public MetadataCollector(ProcessingEnvironment processingEnvironment, ConfigurationMetadata previousMetadata) { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java index 767bdc06077..ba7bc8559df 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java @@ -160,8 +160,8 @@ public class JarWriter implements LoaderClassesWriter, AutoCloseable { /** * Writes an entry. The {@code inputStream} is closed once the entry has been written - * @param entryName The name of the entry - * @param inputStream The stream from which the entry's data can be read + * @param entryName the name of the entry + * @param inputStream the stream from which the entry's data can be read * @throws IOException if the write fails */ @Override diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java index a29f53b2933..e6c23e00165 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/CentralDirectoryParser.java @@ -44,7 +44,7 @@ class CentralDirectoryParser { * Parse the source data, triggering {@link CentralDirectoryVisitor visitors}. * @param data the source data * @param skipPrefixBytes if prefix bytes should be skipped - * @return The actual archive data without any prefix bytes + * @return the actual archive data without any prefix bytes * @throws IOException on error */ public RandomAccessData parse(RandomAccessData data, boolean skipPrefixBytes) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java index 8087f70fe8f..840636088e4 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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 @@ final class EnvironmentConverter { * environment is already a {@code StandardEnvironment} and is not a * {@link ConfigurableWebEnvironment} no conversion is performed and it is returned * unchanged. - * @param environment The Environment to convert - * @return The converted Environment + * @param environment the Environment to convert + * @return the converted Environment */ StandardEnvironment convertToStandardEnvironmentIfNecessary( ConfigurableEnvironment environment) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index add3f250645..f7ba6c047d6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -1001,7 +1001,7 @@ public class SpringApplication { /** * Sets the {@link Banner} instance which will be used to print the banner when no * static banner file is provided. - * @param banner The Banner instance to use + * @param banner the Banner instance to use */ public void setBanner(Banner banner) { this.banner = banner; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java index 151e6e2fde6..80a6714f6ff 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java @@ -94,8 +94,8 @@ public class SpringApplicationBuilder { * Creates a new {@link org.springframework.boot.SpringApplication} instances from the * given sources. Subclasses may override in order to provide a custom subclass of * {@link org.springframework.boot.SpringApplication} - * @param sources The sources - * @return The {@link org.springframework.boot.SpringApplication} instance + * @param sources the sources + * @return the {@link org.springframework.boot.SpringApplication} instance * @since 1.1.0 */ protected SpringApplication createSpringApplication(Class... sources) { @@ -326,7 +326,7 @@ public class SpringApplicationBuilder { /** * Sets the {@link Banner} instance which will be used to print the banner when no * static banner file is provided. - * @param banner The banner to use + * @param banner the banner to use * @return the current builder */ public SpringApplicationBuilder banner(Banner banner) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java index 8ab8970299a..2a0b45345a8 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java @@ -92,7 +92,7 @@ abstract class AggregateBinder { /** * Internal class used to supply the aggregate and cache the value. * - * @param The aggregate type + * @param the aggregate type */ protected static class AggregateSupplier { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BeanBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BeanBinder.java index ca7bb27ac95..9805018fc04 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BeanBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BeanBinder.java @@ -34,7 +34,7 @@ interface BeanBinder { * @param target the bindable to bind * @param context the bind context * @param propertyBinder property binder - * @param The source type + * @param the source type * @return a bound instance or {@code null} */ T bind(ConfigurationPropertyName name, Bindable target, Context context, diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java index 0bb018fcba6..d9a432793bf 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java @@ -29,7 +29,7 @@ import org.springframework.util.ObjectUtils; * A container object to return result of a {@link Binder} bind operation. May contain * either a successfully bound object or an empty result. * - * @param The result type + * @param the result type * @author Phillip Webb * @author Madhura Bhave * @since 2.0.0 @@ -81,7 +81,7 @@ public final class BindResult { /** * Apply the provided mapping function to the bound value, or return an updated * unbound result if no value has been bound. - * @param The type of the result of the mapping function + * @param the type of the result of the mapping function * @param mapper a mapping function to apply to the bound value. The mapper will not * be invoked if no value has been bound. * @return an {@code BindResult} describing the result of applying a mapping function @@ -127,8 +127,8 @@ public final class BindResult { /** * Return the object that was bound, or throw an exception to be created by the * provided supplier if no value has been bound. - * @param Type of the exception to be thrown - * @param exceptionSupplier The supplier which will return the exception to be thrown + * @param the type of the exception to be thrown + * @param exceptionSupplier the supplier which will return the exception to be thrown * @return the present value * @throws X if there is no value present */ diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java index 667d2fdd461..645fbf2feea 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java @@ -31,7 +31,7 @@ import org.springframework.util.ObjectUtils; /** * Source that can be bound by a {@link Binder}. * - * @param The source type + * @param the source type * @author Phillip Webb * @author Madhura Bhave * @since 2.0.0 @@ -179,7 +179,7 @@ public final class Bindable { /** * Create a new {@link Bindable} of the type of the specified instance with an * existing value equal to the instance. - * @param The source type + * @param the source type * @param instance the instance (must not be {@code null}) * @return a {@link Bindable} instance * @see #of(ResolvableType) @@ -194,7 +194,7 @@ public final class Bindable { /** * Create a new {@link Bindable} of the specified type. - * @param The source type + * @param the source type * @param type the type (must not be {@code null}) * @return a {@link Bindable} instance * @see #of(ResolvableType) @@ -238,7 +238,7 @@ public final class Bindable { /** * Create a new {@link Bindable} of the specified type. - * @param The source type + * @param the source type * @param type the type (must not be {@code null}) * @return a {@link Bindable} instance * @see #of(Class) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java index b37fadb050f..ffe5d33df8a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java @@ -57,7 +57,7 @@ abstract class IndexedElementsBinder extends AggregateBinder { /** * Bind indexed elements to the supplied collection. - * @param name The name of the property to bind + * @param name the name of the property to bind * @param target the target bindable * @param elementBinder the binder to use for elements * @param aggregateType the aggregate type, may be a collection or an array diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java index 5c0fa9be9db..53ab435e04a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/SpringApplicationJsonEnvironmentPostProcessor.java @@ -115,7 +115,7 @@ public class SpringApplicationJsonEnvironmentPostProcessor /** * Flatten the map keys using period separator. - * @param map The map that should be flattened + * @param map the map that should be flattened * @return the flattened map */ private Map flatten(Map map) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java index 422baab6ac1..decfa56b295 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java @@ -186,7 +186,7 @@ public abstract class AbstractLoggingSystem extends LoggingSystem { /** * Maintains a mapping between native levels and {@link LogLevel}. * - * @param The native level type + * @param the native level type */ protected static class LogLevels { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java index 69bedccc469..b7c5e4352fe 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystem.java @@ -146,7 +146,7 @@ public abstract class LoggingSystem { /** * Detect and return the logging system in use. Supports Logback and Java Logging. * @param classLoader the classloader - * @return The logging system + * @return the logging system */ public static LoggingSystem get(ClassLoader classLoader) { String loggingSystem = System.getProperty(SYSTEM_PROPERTY); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginLookup.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginLookup.java index 95fff46bd1d..07d4e03f10b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginLookup.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginLookup.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -20,7 +20,7 @@ package org.springframework.boot.origin; * An interface that may be implemented by an object that can lookup {@link Origin} * information from a given key. Can be used to add origin support to existing classes. * - * @param The lookup key type + * @param the lookup key type * @author Phillip Webb * @since 2.0.0 */ diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java index 09a0d589576..e4fbf821eca 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/EntityManagerFactoryBuilder.java @@ -61,7 +61,7 @@ public class EntityManagerFactoryBuilder { * Create a new instance passing in the common pieces that will be shared if multiple * EntityManagerFactory instances are created. * @param jpaVendorAdapter a vendor adapter - * @param jpaProperties JPA properties to be passed to the persistence provider. + * @param jpaProperties the JPA properties to be passed to the persistence provider * @param persistenceUnitManager optional source of persistence unit information (can * be null) */ @@ -74,7 +74,7 @@ public class EntityManagerFactoryBuilder { * Create a new instance passing in the common pieces that will be shared if multiple * EntityManagerFactory instances are created. * @param jpaVendorAdapter a vendor adapter - * @param jpaProperties JPA properties to be passed to the persistence provider. + * @param jpaProperties the JPA properties to be passed to the persistence provider * @param persistenceUnitManager optional source of persistence unit information (can * be null) * @param persistenceUnitRootLocation the persistence unit root location to use as a diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java index 6f58df03324..cdf0854aebf 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/reactive/ApplicationContextServerWebExchangeMatcher.java @@ -32,7 +32,7 @@ import org.springframework.web.server.ServerWebExchange; * {@link AutowireCapableBeanFactory#createBean(Class, int, boolean) create a new bean} * that is autowired in the usual way. * - * @param The type of the context that the match method actually needs to use. Can be + * @param the type of the context that the match method actually needs to use. Can be * an {@link ApplicationContext} or a class of an {@link ApplicationContext#getBean(Class) * existing bean}. * @author Madhura Bhave diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java index 11d29b1d25a..21fbb64e953 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/security/servlet/ApplicationContextRequestMatcher.java @@ -33,7 +33,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils; * {@link AutowireCapableBeanFactory#createBean(Class, int, boolean) create a new bean} * that is autowired in the usual way. * - * @param The type of the context that the match method actually needs to use. Can be + * @param the type of the context that the match method actually needs to use. Can be * an {@link ApplicationContext} or a class of an {@link ApplicationContext#getBean(Class) * existing bean}. * @author Phillip Webb diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java index eb9357e832e..d8476c2f9ba 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/util/LambdaSafe.java @@ -368,7 +368,7 @@ public final class LambdaSafe { * the callback wasn't suitable. Similar in design to {@link Optional} but allows for * {@code null} as a valid value. * - * @param The result type + * @param the result type */ public static final class InvocationResult { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/AbstractConfigurableWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/AbstractConfigurableWebServerFactory.java index 2b5a32a54dc..5e4392e9d3d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/AbstractConfigurableWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/AbstractConfigurableWebServerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -166,7 +166,7 @@ public abstract class AbstractConfigurableWebServerFactory /** * Return the absolute temp dir for given web server. * @param prefix server name - * @return The temp dir for given server. + * @return the temp dir for given server. */ protected final File createTempDir(String prefix) { try { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/WebServerFactoryCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/WebServerFactoryCustomizer.java index bcdc81b4468..2be966ce862 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/WebServerFactoryCustomizer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/WebServerFactoryCustomizer.java @@ -29,7 +29,7 @@ import org.springframework.beans.factory.config.BeanPostProcessor; * It might be safer to lookup dependencies lazily in the enclosing BeanFactory rather * than injecting them with {@code @Autowired}. * - * @param The configurable web server factory + * @param the configurable web server factory * @author Phillip Webb * @author Dave Syer * @author Brian Clozel diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java index b604311b2a2..7d67220035e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java @@ -33,7 +33,7 @@ import org.springframework.util.StringUtils; * Base class for Servlet 3.0+ {@link javax.servlet.Registration.Dynamic dynamic} based * registration beans. * - * @param The dynamic registration result + * @param the dynamic registration result * @author Phillip Webb * @since 2.0.0 */ From 63b609827e3efec93ccf42ac8e7ee0a232f57d71 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 27 Jul 2018 15:45:33 +0100 Subject: [PATCH 5/5] Fix checkstyle method order issues Fix checkstyle issues with method ordering following the spring-javaformat upgrade. See gh-13932 --- .../annotation/EndpointDiscoverer.java | 10 +- .../web/WebOperationRequestPredicate.java | 52 ++++---- .../boot/actuate/health/Status.java | 22 ++-- .../AutoConfigurationPackages.java | 10 +- .../condition/ConditionMessage.java | 20 ++-- .../condition/ConditionOutcome.java | 12 +- .../EmbeddedMongoAutoConfiguration.java | 28 ++--- .../cli/compiler/dependencies/Dependency.java | 54 ++++----- .../grape/RepositoryConfiguration.java | 24 ++-- .../boot/devtools/filewatch/ChangedFile.java | 12 +- .../boot/devtools/filewatch/ChangedFiles.java | 12 +- ...ConfigurationContextCustomizerFactory.java | 10 +- ...notationCustomizableTypeExcludeFilter.java | 30 ++--- .../TypeExcludeFiltersContextCustomizer.java | 10 +- .../properties/AnnotationsPropertySource.java | 10 +- .../PropertyMappingContextCustomizer.java | 10 +- .../WebDriverContextCustomizerFactory.java | 12 +- ...eFiltersContextCustomizerFactoryTests.java | 8 +- .../json/app/ExampleBasicObject.java | 10 +- .../json/app/ExampleCustomObject.java | 10 +- .../json/app/ExampleJsonObjectWithView.java | 12 +- .../context/ImportsContextCustomizer.java | 20 ++-- .../ExcludeFilterContextCustomizer.java | 12 +- ...ateJsonObjectContextCustomizerFactory.java | 10 +- .../boot/test/mock/mockito/Definition.java | 22 ++-- .../test/mock/mockito/MockDefinition.java | 20 ++-- .../mockito/MockitoContextCustomizer.java | 12 +- .../mock/mockito/QualifierDefinition.java | 12 +- .../boot/test/mock/mockito/SpyDefinition.java | 16 +-- .../TestRestTemplateContextCustomizer.java | 10 +- .../WebTestClientContextCustomizer.java | 8 +- .../boot/test/json/ExampleObject.java | 12 +- .../boot/test/json/ExampleObjectWithView.java | 12 +- .../metadata/ItemDeprecation.java | 14 +-- .../metadata/ItemMetadata.java | 36 +++--- .../tasks/buildinfo/BuildInfoProperties.java | 30 ++--- .../bundling/LaunchScriptConfiguration.java | 20 ++-- .../boot/loader/tools/MainClassFinder.java | 20 ++-- .../boot/loader/jar/AsciiBytes.java | 76 ++++++------ .../boot/loader/jar/StringSequence.java | 34 +++--- ...arentContextCloserApplicationListener.java | 10 +- .../config/ConfigFileApplicationListener.java | 30 ++--- .../context/properties/bind/BindResult.java | 10 +- .../context/properties/bind/Bindable.java | 36 +++--- .../source/ConfigurationProperty.java | 16 +-- .../source/ConfigurationPropertyName.java | 112 +++++++++--------- ...ngIterableConfigurationPropertySource.java | 10 +- ...eanCurrentlyInCreationFailureAnalyzer.java | 10 +- .../boot/logging/LoggerConfiguration.java | 34 +++--- .../boot/origin/OriginTrackedValue.java | 14 +-- .../boot/origin/SystemEnvironmentOrigin.java | 20 ++-- .../boot/origin/TextResourceOrigin.java | 26 ++-- .../boot/system/ApplicationPid.java | 20 ++-- .../undertow/UndertowServletWebServer.java | 20 ++-- .../embedded/undertow/UndertowWebServer.java | 20 ++-- .../boot/web/server/ErrorPage.java | 20 ++-- .../boot/web/server/MimeMappings.java | 20 ++-- .../boot/origin/MockOrigin.java | 10 +- 58 files changed, 606 insertions(+), 606 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java index 1d46671ccd9..e01b0a91bd1 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java @@ -382,11 +382,6 @@ public abstract class EndpointDiscoverer, O exten this.description = description; } - @Override - public int hashCode() { - return this.key.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -398,6 +393,11 @@ public abstract class EndpointDiscoverer, O exten return this.key.equals(((OperationKey) obj).key); } + @Override + public int hashCode() { + return this.key.hashCode(); + } + @Override public String toString() { return this.description.get(); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebOperationRequestPredicate.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebOperationRequestPredicate.java index cf8494b2f58..f571c08df4d 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebOperationRequestPredicate.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/WebOperationRequestPredicate.java @@ -88,32 +88,6 @@ public final class WebOperationRequestPredicate { return Collections.unmodifiableCollection(this.produces); } - @Override - public String toString() { - StringBuilder result = new StringBuilder( - this.httpMethod + " to path '" + this.path + "'"); - if (!CollectionUtils.isEmpty(this.consumes)) { - result.append(" consumes: " - + StringUtils.collectionToCommaDelimitedString(this.consumes)); - } - if (!CollectionUtils.isEmpty(this.produces)) { - result.append(" produces: " - + StringUtils.collectionToCommaDelimitedString(this.produces)); - } - return result.toString(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + this.consumes.hashCode(); - result = prime * result + this.httpMethod.hashCode(); - result = prime * result + this.canonicalPath.hashCode(); - result = prime * result + this.produces.hashCode(); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -131,4 +105,30 @@ public final class WebOperationRequestPredicate { return result; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + this.consumes.hashCode(); + result = prime * result + this.httpMethod.hashCode(); + result = prime * result + this.canonicalPath.hashCode(); + result = prime * result + this.produces.hashCode(); + return result; + } + + @Override + public String toString() { + StringBuilder result = new StringBuilder( + this.httpMethod + " to path '" + this.path + "'"); + if (!CollectionUtils.isEmpty(this.consumes)) { + result.append(" consumes: " + + StringUtils.collectionToCommaDelimitedString(this.consumes)); + } + if (!CollectionUtils.isEmpty(this.produces)) { + result.append(" produces: " + + StringUtils.collectionToCommaDelimitedString(this.produces)); + } + return result.toString(); + } + } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java index c3a5d89b700..b62ec82388a 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -102,16 +102,6 @@ public final class Status { return this.description; } - @Override - public String toString() { - return this.code; - } - - @Override - public int hashCode() { - return this.code.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -123,4 +113,14 @@ public final class Status { return false; } + @Override + public int hashCode() { + return this.code.hashCode(); + } + + @Override + public String toString() { + return this.code; + } + } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java index 2e6ae495e5a..59702c09c2e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java @@ -147,9 +147,8 @@ public abstract class AutoConfigurationPackages { this.packageName = ClassUtils.getPackageName(metadata.getClassName()); } - @Override - public int hashCode() { - return this.packageName.hashCode(); + public String getPackageName() { + return this.packageName; } @Override @@ -160,8 +159,9 @@ public abstract class AutoConfigurationPackages { return this.packageName.equals(((PackageImport) obj).packageName); } - public String getPackageName() { - return this.packageName; + @Override + public int hashCode() { + return this.packageName.hashCode(); } @Override diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java index 736b6fac37d..c2cd484287d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java @@ -59,16 +59,6 @@ public final class ConditionMessage { return !StringUtils.hasLength(this.message); } - @Override - public String toString() { - return (this.message != null) ? this.message : ""; - } - - @Override - public int hashCode() { - return ObjectUtils.nullSafeHashCode(this.message); - } - @Override public boolean equals(Object obj) { if (obj == null || !ConditionMessage.class.isInstance(obj)) { @@ -80,6 +70,16 @@ public final class ConditionMessage { return ObjectUtils.nullSafeEquals(((ConditionMessage) obj).message, this.message); } + @Override + public int hashCode() { + return ObjectUtils.nullSafeHashCode(this.message); + } + + @Override + public String toString() { + return (this.message != null) ? this.message : ""; + } + /** * Return a new {@link ConditionMessage} based on the instance and an appended * message. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java index 03b0834b690..6e9b7604af4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java @@ -122,12 +122,6 @@ public class ConditionOutcome { return this.message; } - @Override - public int hashCode() { - return Boolean.hashCode(this.match) * 31 - + ObjectUtils.nullSafeHashCode(this.message); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -144,6 +138,12 @@ public class ConditionOutcome { return super.equals(obj); } + @Override + public int hashCode() { + return Boolean.hashCode(this.match) * 31 + + ObjectUtils.nullSafeHashCode(this.message); + } + @Override public String toString() { return (this.message != null) ? this.message.toString() : ""; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java index d39c0238074..3db0bb424a3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java @@ -269,20 +269,6 @@ public class EmbeddedMongoAutoConfiguration { return this.features.contains(feature); } - @Override - public String toString() { - return this.version; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + this.features.hashCode(); - result = prime * result + this.version.hashCode(); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -301,6 +287,20 @@ public class EmbeddedMongoAutoConfiguration { return super.equals(obj); } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + this.features.hashCode(); + result = prime * result + this.version.hashCode(); + return result; + } + + @Override + public String toString() { + return this.version; + } + } } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java index 34c8f16fb7a..e703714f065 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/dependencies/Dependency.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -98,22 +98,6 @@ public final class Dependency { return this.exclusions; } - @Override - public String toString() { - return this.groupId + ":" + this.artifactId + ":" + this.version; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + this.groupId.hashCode(); - result = prime * result + this.artifactId.hashCode(); - result = prime * result + this.version.hashCode(); - result = prime * result + this.exclusions.hashCode(); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -134,6 +118,22 @@ public final class Dependency { return false; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + this.groupId.hashCode(); + result = prime * result + this.artifactId.hashCode(); + result = prime * result + this.version.hashCode(); + result = prime * result + this.exclusions.hashCode(); + return result; + } + + @Override + public String toString() { + return this.groupId + ":" + this.artifactId + ":" + this.version; + } + /** * A dependency exclusion. */ @@ -166,16 +166,6 @@ public final class Dependency { return this.groupId; } - @Override - public String toString() { - return this.groupId + ":" + this.artifactId; - } - - @Override - public int hashCode() { - return this.groupId.hashCode() * 31 + this.artifactId.hashCode(); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -194,6 +184,16 @@ public final class Dependency { return false; } + @Override + public int hashCode() { + return this.groupId.hashCode() * 31 + this.artifactId.hashCode(); + } + + @Override + public String toString() { + return this.groupId + ":" + this.artifactId; + } + } } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositoryConfiguration.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositoryConfiguration.java index 73c0a17f584..a0f5e5c2faf 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositoryConfiguration.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositoryConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,12 +54,6 @@ public final class RepositoryConfiguration { return this.name; } - @Override - public String toString() { - return "RepositoryConfiguration [name=" + this.name + ", uri=" + this.uri - + ", snapshotsEnabled=" + this.snapshotsEnabled + "]"; - } - /** * Return the URI of the repository. * @return the repository URI @@ -76,11 +70,6 @@ public final class RepositoryConfiguration { return this.snapshotsEnabled; } - @Override - public int hashCode() { - return ObjectUtils.nullSafeHashCode(this.name); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -96,4 +85,15 @@ public final class RepositoryConfiguration { return ObjectUtils.nullSafeEquals(this.name, other.name); } + @Override + public int hashCode() { + return ObjectUtils.nullSafeHashCode(this.name); + } + + @Override + public String toString() { + return "RepositoryConfiguration [name=" + this.name + ", uri=" + this.uri + + ", snapshotsEnabled=" + this.snapshotsEnabled + "]"; + } + } diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFile.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFile.java index 9490a697ab2..9b450584344 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFile.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -81,11 +81,6 @@ public final class ChangedFile { return fileName.substring(folderName.length() + 1); } - @Override - public int hashCode() { - return this.file.hashCode() * 31 + this.type.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -101,6 +96,11 @@ public final class ChangedFile { return super.equals(obj); } + @Override + public int hashCode() { + return this.file.hashCode() * 31 + this.type.hashCode(); + } + @Override public String toString() { return this.file + " (" + this.type + ")"; diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFiles.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFiles.java index f4482f5b463..54ed503930e 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFiles.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFiles.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,11 +61,6 @@ public final class ChangedFiles implements Iterable { return this.files; } - @Override - public int hashCode() { - return this.files.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == null) { @@ -82,6 +77,11 @@ public final class ChangedFiles implements Iterable { return super.equals(obj); } + @Override + public int hashCode() { + return this.files.hashCode(); + } + @Override public String toString() { return this.sourceFolder + " " + this.files; diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java index cc03f386166..4a1e34b4abc 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/OverrideAutoConfigurationContextCustomizerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -62,13 +62,13 @@ class OverrideAutoConfigurationContextCustomizerFactory } @Override - public int hashCode() { - return getClass().hashCode(); + public boolean equals(Object obj) { + return (obj != null && obj.getClass() == getClass()); } @Override - public boolean equals(Object obj) { - return (obj != null && obj.getClass() == getClass()); + public int hashCode() { + return getClass().hashCode(); } } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java index 3207ad95fdb..e59ac1f59e3 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java @@ -117,21 +117,6 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud } - @Override - public int hashCode() { - final int prime = 31; - int result = 0; - result = prime * result + Boolean.hashCode(hasAnnotation()); - for (FilterType filterType : FilterType.values()) { - result = prime * result - + ObjectUtils.nullSafeHashCode(getFilters(filterType)); - } - result = prime * result + Boolean.hashCode(isUseDefaultFilters()); - result = prime * result + ObjectUtils.nullSafeHashCode(getDefaultIncludes()); - result = prime * result + ObjectUtils.nullSafeHashCode(getComponentIncludes()); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -155,4 +140,19 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud return result; } + @Override + public int hashCode() { + final int prime = 31; + int result = 0; + result = prime * result + Boolean.hashCode(hasAnnotation()); + for (FilterType filterType : FilterType.values()) { + result = prime * result + + ObjectUtils.nullSafeHashCode(getFilters(filterType)); + } + result = prime * result + Boolean.hashCode(isUseDefaultFilters()); + result = prime * result + ObjectUtils.nullSafeHashCode(getDefaultIncludes()); + result = prime * result + ObjectUtils.nullSafeHashCode(getComponentIncludes()); + return result; + } + } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java index a3df07bf133..66252fefbbc 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java @@ -73,17 +73,17 @@ class TypeExcludeFiltersContextCustomizer implements ContextCustomizer { } } - @Override - public int hashCode() { - return this.filters.hashCode(); - } - @Override public boolean equals(Object obj) { return (obj != null && getClass() == obj.getClass() && this.filters .equals(((TypeExcludeFiltersContextCustomizer) obj).filters)); } + @Override + public int hashCode() { + return this.filters.hashCode(); + } + @Override public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedContextConfiguration) { diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java index 3ea3c774ec9..6cfaa963774 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/AnnotationsPropertySource.java @@ -201,11 +201,6 @@ public class AnnotationsPropertySource extends EnumerablePropertySource return this.properties.isEmpty(); } - @Override - public int hashCode() { - return this.properties.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -217,4 +212,9 @@ public class AnnotationsPropertySource extends EnumerablePropertySource return this.properties.equals(((AnnotationsPropertySource) obj).properties); } + @Override + public int hashCode() { + return this.properties.hashCode(); + } + } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java index 36d2db09782..775478c625f 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/properties/PropertyMappingContextCustomizer.java @@ -55,17 +55,17 @@ class PropertyMappingContextCustomizer implements ContextCustomizer { new PropertyMappingCheckBeanPostProcessor()); } - @Override - public int hashCode() { - return this.propertySource.hashCode(); - } - @Override public boolean equals(Object obj) { return (obj != null && getClass() == obj.getClass() && this.propertySource .equals(((PropertyMappingContextCustomizer) obj).propertySource)); } + @Override + public int hashCode() { + return this.propertySource.hashCode(); + } + /** * {@link BeanPostProcessor} to check that {@link PropertyMapping} is only used on * test classes. diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizerFactory.java b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizerFactory.java index 39e1c04fca6..9d17c49e193 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizerFactory.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/web/servlet/WebDriverContextCustomizerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,11 +49,6 @@ class WebDriverContextCustomizerFactory implements ContextCustomizerFactory { WebDriverScope.registerWith(context); } - @Override - public int hashCode() { - return getClass().hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -65,6 +60,11 @@ class WebDriverContextCustomizerFactory implements ContextCustomizerFactory { return true; } + @Override + public int hashCode() { + return getClass().hashCode(); + } + } } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java index a375465fcec..2d0b73ee8f2 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizerFactoryTests.java @@ -119,13 +119,13 @@ public class TypeExcludeFiltersContextCustomizerFactoryTests { } @Override - public int hashCode() { - return SimpleExclude.class.hashCode(); + public boolean equals(Object obj) { + return obj.getClass() == getClass(); } @Override - public boolean equals(Object obj) { - return obj.getClass() == getClass(); + public int hashCode() { + return SimpleExclude.class.hashCode(); } } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleBasicObject.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleBasicObject.java index 8d99d71ea4d..ba1be0f35a2 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleBasicObject.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleBasicObject.java @@ -33,11 +33,6 @@ public class ExampleBasicObject { this.value = value; } - @Override - public int hashCode() { - return this.value.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == getClass()) { @@ -46,4 +41,9 @@ public class ExampleBasicObject { return false; } + @Override + public int hashCode() { + return this.value.hashCode(); + } + } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java index 3376f45e5fe..372e4f206e1 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleCustomObject.java @@ -29,11 +29,6 @@ public class ExampleCustomObject { this.value = value; } - @Override - public int hashCode() { - return this.value.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj != null && obj.getClass() == getClass()) { @@ -42,6 +37,11 @@ public class ExampleCustomObject { return false; } + @Override + public int hashCode() { + return this.value.hashCode(); + } + @Override public String toString() { return this.value; diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleJsonObjectWithView.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleJsonObjectWithView.java index 450c20ce358..76b9ad7b254 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleJsonObjectWithView.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/json/app/ExampleJsonObjectWithView.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,11 +48,6 @@ public class ExampleJsonObjectWithView { this.id = id; } - @Override - public int hashCode() { - return 0; - } - @Override public boolean equals(Object obj) { if (obj == null || obj.getClass() != getClass()) { @@ -63,6 +58,11 @@ public class ExampleJsonObjectWithView { && ObjectUtils.nullSafeEquals(this.id, other.id); } + @Override + public int hashCode() { + return 0; + } + @Override public String toString() { return this.value + " " + this.id; diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java index fa78ed9108f..8ab6b50e2d2 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java @@ -115,11 +115,6 @@ class ImportsContextCustomizer implements ContextCustomizer { return registry.getBeanDefinition(beanName); } - @Override - public int hashCode() { - return this.key.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -133,6 +128,11 @@ class ImportsContextCustomizer implements ContextCustomizer { return this.key.equals(other.key); } + @Override + public int hashCode() { + return this.key.hashCode(); + } + @Override public String toString() { return new ToStringCreator(this).append("key", this.key).toString(); @@ -338,17 +338,17 @@ class ImportsContextCustomizer implements ContextCustomizer { } } - @Override - public int hashCode() { - return this.key.hashCode(); - } - @Override public boolean equals(Object obj) { return (obj != null && getClass() == obj.getClass() && this.key.equals(((ContextCustomizerKey) obj).key)); } + @Override + public int hashCode() { + return this.key.hashCode(); + } + @Override public String toString() { return this.key.toString(); diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/ExcludeFilterContextCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/ExcludeFilterContextCustomizer.java index 652a0ec20bf..38ac24c60c4 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/ExcludeFilterContextCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/ExcludeFilterContextCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,11 +36,6 @@ class ExcludeFilterContextCustomizer implements ContextCustomizer { new TestTypeExcludeFilter()); } - @Override - public int hashCode() { - return getClass().hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -52,4 +47,9 @@ class ExcludeFilterContextCustomizer implements ContextCustomizer { return true; } + @Override + public int hashCode() { + return getClass().hashCode(); + } + } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/DuplicateJsonObjectContextCustomizerFactory.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/DuplicateJsonObjectContextCustomizerFactory.java index 0f043b0e867..bd875e90349 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/DuplicateJsonObjectContextCustomizerFactory.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/DuplicateJsonObjectContextCustomizerFactory.java @@ -86,11 +86,6 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa this.logger.warn(message); } - @Override - public int hashCode() { - return getClass().hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == null || obj.getClass() != getClass()) { @@ -99,6 +94,11 @@ class DuplicateJsonObjectContextCustomizerFactory implements ContextCustomizerFa return true; } + @Override + public int hashCode() { + return getClass().hashCode(); + } + } } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java index 1f25d884a1a..5eaa44a79cb 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/Definition.java @@ -76,17 +76,6 @@ abstract class Definition { return this.qualifier; } - @Override - public int hashCode() { - int result = 1; - result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.name); - result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.reset); - result = MULTIPLIER * result - + ObjectUtils.nullSafeHashCode(this.proxyTargetAware); - result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.qualifier); - return result; - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -105,4 +94,15 @@ abstract class Definition { return result; } + @Override + public int hashCode() { + int result = 1; + result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.name); + result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.reset); + result = MULTIPLIER * result + + ObjectUtils.nullSafeHashCode(this.proxyTargetAware); + result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.qualifier); + return result; + } + } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java index 8caf8b01963..991d44b666c 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java @@ -100,16 +100,6 @@ class MockDefinition extends Definition { return this.serializable; } - @Override - public int hashCode() { - int result = super.hashCode(); - result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToMock); - result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.extraInterfaces); - result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.answer); - result = MULTIPLIER * result + Boolean.hashCode(this.serializable); - return result; - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -128,6 +118,16 @@ class MockDefinition extends Definition { return result; } + @Override + public int hashCode() { + int result = super.hashCode(); + result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToMock); + result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.extraInterfaces); + result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.answer); + result = MULTIPLIER * result + Boolean.hashCode(this.serializable); + return result; + } + @Override public String toString() { return new ToStringCreator(this).append("name", getName()) diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java index 048f0ab2873..4fd7a1146ca 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoContextCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,11 +46,6 @@ class MockitoContextCustomizer implements ContextCustomizer { } } - @Override - public int hashCode() { - return this.definitions.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -63,4 +58,9 @@ class MockitoContextCustomizer implements ContextCustomizer { return this.definitions.equals(other.definitions); } + @Override + public int hashCode() { + return this.definitions.hashCode(); + } + } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java index dad2d1d9720..b5783ea0282 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/QualifierDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,11 +60,6 @@ class QualifierDefinition { definition.setQualifiedElement(this.field); } - @Override - public int hashCode() { - return this.annotations.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -77,6 +72,11 @@ class QualifierDefinition { return this.annotations.equals(other.annotations); } + @Override + public int hashCode() { + return this.annotations.hashCode(); + } + public static QualifierDefinition forElement(AnnotatedElement element) { if (element != null && element instanceof Field) { Field field = (Field) element; diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java index 9af4d6eccd9..5d4b240e7ad 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/SpyDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -51,13 +51,6 @@ class SpyDefinition extends Definition { return this.typeToSpy; } - @Override - public int hashCode() { - int result = super.hashCode(); - result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToSpy); - return result; - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -72,6 +65,13 @@ class SpyDefinition extends Definition { return result; } + @Override + public int hashCode() { + int result = super.hashCode(); + result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToSpy); + return result; + } + @Override public String toString() { return new ToStringCreator(this).append("name", getName()) diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateContextCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateContextCustomizer.java index 4129048c6f2..262d790e5a8 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateContextCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplateContextCustomizer.java @@ -74,11 +74,6 @@ class TestRestTemplateContextCustomizer implements ContextCustomizer { definition); } - @Override - public int hashCode() { - return getClass().hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == null || obj.getClass() != getClass()) { @@ -87,6 +82,11 @@ class TestRestTemplateContextCustomizer implements ContextCustomizer { return true; } + @Override + public int hashCode() { + return getClass().hashCode(); + } + /** * {@link BeanDefinitionRegistryPostProcessor} that runs after the * {@link ConfigurationClassPostProcessor} and add a {@link TestRestTemplateFactory} diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizer.java index d5292f7b938..0f700d903a9 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/reactive/server/WebTestClientContextCustomizer.java @@ -78,13 +78,13 @@ class WebTestClientContextCustomizer implements ContextCustomizer { } @Override - public int hashCode() { - return getClass().hashCode(); + public boolean equals(Object obj) { + return (obj != null && obj.getClass() == getClass()); } @Override - public boolean equals(Object obj) { - return (obj != null && obj.getClass() == getClass()); + public int hashCode() { + return getClass().hashCode(); } /** diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObject.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObject.java index 3db0036a58a..b7c30a58cce 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObject.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObject.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -43,11 +43,6 @@ public class ExampleObject { this.age = age; } - @Override - public int hashCode() { - return 0; - } - @Override public boolean equals(Object obj) { if (obj == null || obj.getClass() != getClass()) { @@ -58,6 +53,11 @@ public class ExampleObject { && ObjectUtils.nullSafeEquals(this.age, other.age); } + @Override + public int hashCode() { + return 0; + } + @Override public String toString() { return this.name + " " + this.age; diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObjectWithView.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObjectWithView.java index 1bd501c0944..1171bb9bbb3 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObjectWithView.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/json/ExampleObjectWithView.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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,11 +48,6 @@ public class ExampleObjectWithView { this.age = age; } - @Override - public int hashCode() { - return 0; - } - @Override public boolean equals(Object obj) { if (obj == null || obj.getClass() != getClass()) { @@ -63,6 +58,11 @@ public class ExampleObjectWithView { && ObjectUtils.nullSafeEquals(this.age, other.age); } + @Override + public int hashCode() { + return 0; + } + @Override public String toString() { return this.name + " " + this.age; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java index 64d509e22bd..cba6e71c06f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java @@ -68,13 +68,6 @@ public class ItemDeprecation { this.level = level; } - @Override - public String toString() { - return "ItemDeprecation{" + "reason='" + this.reason + '\'' + ", " - + "replacement='" + this.replacement + '\'' + ", " + "level='" - + this.level + '\'' + '}'; - } - @Override public boolean equals(Object o) { if (this == o) { @@ -97,6 +90,13 @@ public class ItemDeprecation { return result; } + @Override + public String toString() { + return "ItemDeprecation{" + "reason='" + this.reason + '\'' + ", " + + "replacement='" + this.replacement + '\'' + ", " + "level='" + + this.level + '\'' + '}'; + } + private boolean nullSafeEquals(Object o1, Object o2) { if (o1 == o2) { return true; diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java index b1da40a98c6..4784c04822c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemMetadata.java @@ -133,24 +133,6 @@ public final class ItemMetadata implements Comparable { this.deprecation = deprecation; } - @Override - public String toString() { - StringBuilder string = new StringBuilder(this.name); - buildToStringProperty(string, "type", this.type); - buildToStringProperty(string, "sourceType", this.sourceType); - buildToStringProperty(string, "description", this.description); - buildToStringProperty(string, "defaultValue", this.defaultValue); - buildToStringProperty(string, "deprecation", this.deprecation); - return string.toString(); - } - - protected void buildToStringProperty(StringBuilder string, String property, - Object value) { - if (value != null) { - string.append(" ").append(property).append(":").append(value); - } - } - @Override public boolean equals(Object o) { if (this == o) { @@ -199,6 +181,24 @@ public final class ItemMetadata implements Comparable { return (o != null) ? o.hashCode() : 0; } + @Override + public String toString() { + StringBuilder string = new StringBuilder(this.name); + buildToStringProperty(string, "type", this.type); + buildToStringProperty(string, "sourceType", this.sourceType); + buildToStringProperty(string, "description", this.description); + buildToStringProperty(string, "defaultValue", this.defaultValue); + buildToStringProperty(string, "deprecation", this.deprecation); + return string.toString(); + } + + protected void buildToStringProperty(StringBuilder string, String property, + Object value) { + if (value != null) { + string.append(" ").append(property).append(":").append(value); + } + } + @Override public int compareTo(ItemMetadata o) { return getName().compareTo(o.getName()); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java index d335f2209b3..3cf46cba62a 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java @@ -162,21 +162,6 @@ public class BuildInfoProperties implements Serializable { this.additionalProperties = additionalProperties; } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((this.additionalProperties == null) ? 0 - : this.additionalProperties.hashCode()); - result = prime * result - + ((this.artifact == null) ? 0 : this.artifact.hashCode()); - result = prime * result + ((this.group == null) ? 0 : this.group.hashCode()); - result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); - result = prime * result + ((this.version == null) ? 0 : this.version.hashCode()); - result = prime * result + ((this.time == null) ? 0 : this.time.hashCode()); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -207,4 +192,19 @@ public class BuildInfoProperties implements Serializable { return (o1.equals(o2)); } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.additionalProperties == null) ? 0 + : this.additionalProperties.hashCode()); + result = prime * result + + ((this.artifact == null) ? 0 : this.artifact.hashCode()); + result = prime * result + ((this.group == null) ? 0 : this.group.hashCode()); + result = prime * result + ((this.name == null) ? 0 : this.name.hashCode()); + result = prime * result + ((this.version == null) ? 0 : this.version.hashCode()); + result = prime * result + ((this.time == null) ? 0 : this.time.hashCode()); + return result; + } + } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java index f42ce7a0ca5..54c464a2212 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java @@ -73,16 +73,6 @@ public class LaunchScriptConfiguration implements Serializable { this.script = script; } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((this.properties == null) ? 0 : this.properties.hashCode()); - result = prime * result + ((this.script == null) ? 0 : this.script.hashCode()); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -118,4 +108,14 @@ public class LaunchScriptConfiguration implements Serializable { } } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((this.properties == null) ? 0 : this.properties.hashCode()); + result = prime * result + ((this.script == null) ? 0 : this.script.hashCode()); + return result; + } + } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java index 85d9f122f38..219e1da8700 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java @@ -384,16 +384,6 @@ public abstract class MainClassFinder { return this.annotationNames; } - @Override - public String toString() { - return this.name; - } - - @Override - public int hashCode() { - return this.name.hashCode(); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -412,6 +402,16 @@ public abstract class MainClassFinder { return true; } + @Override + public int hashCode() { + return this.name.hashCode(); + } + + @Override + public String toString() { + return this.name; + } + } /** diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java index 9b3fd7aeca2..7ce54335371 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/AsciiBytes.java @@ -124,20 +124,6 @@ final class AsciiBytes { return new AsciiBytes(this.bytes, this.offset + beginIndex, length); } - @Override - public String toString() { - if (this.string == null) { - if (this.length == 0) { - this.string = EMPTY_STRING; - } - else { - this.string = new String(this.bytes, this.offset, this.length, - StandardCharsets.UTF_8); - } - } - return this.string; - } - public boolean matches(CharSequence name, char suffix) { int charIndex = 0; int nameLen = name.length(); @@ -178,30 +164,6 @@ final class AsciiBytes { return 0; } - @Override - public int hashCode() { - int hash = this.hash; - if (hash == 0 && this.bytes.length > 0) { - for (int i = this.offset; i < this.offset + this.length; i++) { - int b = this.bytes[i]; - int remainingUtfBytes = getNumberOfUtfBytes(b) - 1; - b &= INITIAL_BYTE_BITMASK[remainingUtfBytes]; - for (int j = 0; j < remainingUtfBytes; j++) { - b = (b << 6) + (this.bytes[++i] & SUBSEQUENT_BYTE_BITMASK); - } - if (b <= 0xFFFF) { - hash = 31 * hash + b; - } - else { - hash = 31 * hash + ((b >> 0xA) + 0xD7C0); - hash = 31 * hash + ((b & 0x3FF) + 0xDC00); - } - } - this.hash = hash; - } - return hash; - } - private int getNumberOfUtfBytes(int b) { if ((b & 0x80) == 0) { return 1; @@ -236,6 +198,44 @@ final class AsciiBytes { return false; } + @Override + public int hashCode() { + int hash = this.hash; + if (hash == 0 && this.bytes.length > 0) { + for (int i = this.offset; i < this.offset + this.length; i++) { + int b = this.bytes[i]; + int remainingUtfBytes = getNumberOfUtfBytes(b) - 1; + b &= INITIAL_BYTE_BITMASK[remainingUtfBytes]; + for (int j = 0; j < remainingUtfBytes; j++) { + b = (b << 6) + (this.bytes[++i] & SUBSEQUENT_BYTE_BITMASK); + } + if (b <= 0xFFFF) { + hash = 31 * hash + b; + } + else { + hash = 31 * hash + ((b >> 0xA) + 0xD7C0); + hash = 31 * hash + ((b & 0x3FF) + 0xDC00); + } + } + this.hash = hash; + } + return hash; + } + + @Override + public String toString() { + if (this.string == null) { + if (this.length == 0) { + this.string = EMPTY_STRING; + } + else { + this.string = new String(this.bytes, this.offset, this.length, + StandardCharsets.UTF_8); + } + } + return this.string; + } + static String toString(byte[] bytes) { return new String(bytes, StandardCharsets.UTF_8); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java index 67beac47b88..896c45561b1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java @@ -106,23 +106,6 @@ final class StringSequence implements CharSequence { return subSequence(offset, offset + prefix.length()).equals(prefix); } - @Override - public String toString() { - return this.source.substring(this.start, this.end); - } - - @Override - public int hashCode() { - int hash = this.hash; - if (hash == 0 && length() > 0) { - for (int i = this.start; i < this.end; i++) { - hash = 31 * hash + this.source.charAt(i); - } - this.hash = hash; - } - return hash; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -146,4 +129,21 @@ final class StringSequence implements CharSequence { return true; } + @Override + public int hashCode() { + int hash = this.hash; + if (hash == 0 && length() > 0) { + for (int i = this.start; i < this.end; i++) { + hash = 31 * hash + this.source.charAt(i); + } + this.hash = hash; + } + return hash; + } + + @Override + public String toString() { + return this.source.substring(this.start, this.end); + } + } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java index 9f69bd5dd27..2499e70d3dd 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/ParentContextCloserApplicationListener.java @@ -101,11 +101,6 @@ public class ParentContextCloserApplicationListener } } - @Override - public int hashCode() { - return ObjectUtils.nullSafeHashCode(this.childContext.get()); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -122,6 +117,11 @@ public class ParentContextCloserApplicationListener return super.equals(obj); } + @Override + public int hashCode() { + return ObjectUtils.nullSafeHashCode(this.childContext.get()); + } + } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index 15af937b0b5..1ecda01dd5e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -733,16 +733,6 @@ public class ConfigFileApplicationListener return this.defaultProfile; } - @Override - public String toString() { - return this.name; - } - - @Override - public int hashCode() { - return this.name.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -754,6 +744,16 @@ public class ConfigFileApplicationListener return ((Profile) obj).name.equals(this.name); } + @Override + public int hashCode() { + return this.name.hashCode(); + } + + @Override + public String toString() { + return this.name; + } + } /** @@ -770,11 +770,6 @@ public class ConfigFileApplicationListener this.resource = resource; } - @Override - public int hashCode() { - return this.loader.hashCode() * 31 + this.resource.hashCode(); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -788,6 +783,11 @@ public class ConfigFileApplicationListener && this.resource.equals(other.resource); } + @Override + public int hashCode() { + return this.loader.hashCode() * 31 + this.resource.hashCode(); + } + } /** diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java index d9a432793bf..f1ff739fa7d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BindResult.java @@ -140,11 +140,6 @@ public final class BindResult { return this.value; } - @Override - public int hashCode() { - return ObjectUtils.nullSafeHashCode(this.value); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -156,6 +151,11 @@ public final class BindResult { return ObjectUtils.nullSafeEquals(this.value, ((BindResult) obj).value); } + @Override + public int hashCode() { + return ObjectUtils.nullSafeHashCode(this.value); + } + @SuppressWarnings("unchecked") static BindResult of(T value) { if (value == null) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java index 645fbf2feea..09ba0a9dc72 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java @@ -106,24 +106,6 @@ public final class Bindable { return null; } - @Override - public String toString() { - ToStringCreator creator = new ToStringCreator(this); - creator.append("type", this.type); - creator.append("value", (this.value != null) ? "provided" : "none"); - creator.append("annotations", this.annotations); - return creator.toString(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ObjectUtils.nullSafeHashCode(this.type); - result = prime * result + ObjectUtils.nullSafeHashCode(this.annotations); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -139,6 +121,24 @@ public final class Bindable { return result; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ObjectUtils.nullSafeHashCode(this.type); + result = prime * result + ObjectUtils.nullSafeHashCode(this.annotations); + return result; + } + + @Override + public String toString() { + ToStringCreator creator = new ToStringCreator(this); + creator.append("type", this.type); + creator.append("value", (this.value != null) ? "provided" : "none"); + creator.append("annotations", this.annotations); + return creator.toString(); + } + private boolean nullSafeEquals(Object o1, Object o2) { return ObjectUtils.nullSafeEquals(o1, o2); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationProperty.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationProperty.java index 30ded56ab33..d8b359c1943 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationProperty.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationProperty.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -63,13 +63,6 @@ public final class ConfigurationProperty return this.origin; } - @Override - public int hashCode() { - int result = ObjectUtils.nullSafeHashCode(this.name); - result = 31 * result + ObjectUtils.nullSafeHashCode(this.value); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -85,6 +78,13 @@ public final class ConfigurationProperty return result; } + @Override + public int hashCode() { + int result = ObjectUtils.nullSafeHashCode(this.name); + result = 31 * result + ObjectUtils.nullSafeHashCode(this.value); + return result; + } + @Override public String toString() { return new ToStringCreator(this).append("name", this.name) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index 0be25c053df..34326b67694 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -295,62 +295,6 @@ public final class ConfigurationPropertyName return e1.compareTo(e2); } - @Override - public String toString() { - if (this.string == null) { - this.string = toString(this.elements); - } - return this.string; - } - - private String toString(CharSequence[] elements) { - StringBuilder result = new StringBuilder(); - for (CharSequence element : elements) { - boolean indexed = isIndexed(element); - if (result.length() > 0 && !indexed) { - result.append("."); - } - if (indexed) { - result.append(element); - } - else { - for (int i = 0; i < element.length(); i++) { - char ch = Character.toLowerCase(element.charAt(i)); - result.append((ch != '_') ? ch : ""); - } - } - } - return result.toString(); - } - - @Override - public int hashCode() { - if (this.elementHashCodes == null) { - this.elementHashCodes = getElementHashCodes(); - } - return ObjectUtils.nullSafeHashCode(this.elementHashCodes); - } - - private int[] getElementHashCodes() { - int[] hashCodes = new int[this.elements.length]; - for (int i = 0; i < this.elements.length; i++) { - hashCodes[i] = getElementHashCode(this.elements[i]); - } - return hashCodes; - } - - private int getElementHashCode(CharSequence element) { - int hash = 0; - boolean indexed = isIndexed(element); - int offset = (indexed ? 1 : 0); - for (int i = 0 + offset; i < element.length() - offset; i++) { - char ch = (indexed ? element.charAt(i) - : Character.toLowerCase(element.charAt(i))); - hash = (ch == '-' || ch == '_') ? hash : 31 * hash + Character.hashCode(ch); - } - return hash; - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -409,6 +353,62 @@ public final class ConfigurationPropertyName return true; } + @Override + public int hashCode() { + if (this.elementHashCodes == null) { + this.elementHashCodes = getElementHashCodes(); + } + return ObjectUtils.nullSafeHashCode(this.elementHashCodes); + } + + private int[] getElementHashCodes() { + int[] hashCodes = new int[this.elements.length]; + for (int i = 0; i < this.elements.length; i++) { + hashCodes[i] = getElementHashCode(this.elements[i]); + } + return hashCodes; + } + + private int getElementHashCode(CharSequence element) { + int hash = 0; + boolean indexed = isIndexed(element); + int offset = (indexed ? 1 : 0); + for (int i = 0 + offset; i < element.length() - offset; i++) { + char ch = (indexed ? element.charAt(i) + : Character.toLowerCase(element.charAt(i))); + hash = (ch == '-' || ch == '_') ? hash : 31 * hash + Character.hashCode(ch); + } + return hash; + } + + @Override + public String toString() { + if (this.string == null) { + this.string = toString(this.elements); + } + return this.string; + } + + private String toString(CharSequence[] elements) { + StringBuilder result = new StringBuilder(); + for (CharSequence element : elements) { + boolean indexed = isIndexed(element); + if (result.length() > 0 && !indexed) { + result.append("."); + } + if (indexed) { + result.append(element); + } + else { + for (int i = 0; i < element.length(); i++) { + char ch = Character.toLowerCase(element.charAt(i)); + result.append((ch != '_') ? ch : ""); + } + } + } + return result.toString(); + } + private static boolean isIndexed(CharSequence element) { return element.charAt(0) == '[' && element.charAt(element.length() - 1) == ']'; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java index 0ccbb61d61f..8fff79f0650 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SpringIterableConfigurationPropertySource.java @@ -191,11 +191,6 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope return ((String[]) key).clone(); } - @Override - public int hashCode() { - return this.key.hashCode(); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -207,6 +202,11 @@ class SpringIterableConfigurationPropertySource extends SpringConfigurationPrope return ObjectUtils.nullSafeEquals(this.key, ((CacheKey) obj).key); } + @Override + public int hashCode() { + return this.key.hashCode(); + } + public static CacheKey get(EnumerablePropertySource source) { if (source instanceof MapPropertySource) { return new CacheKey(((MapPropertySource) source).getSource().keySet()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java index 3c9765d6dd0..588251ef54b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/BeanCurrentlyInCreationFailureAnalyzer.java @@ -139,11 +139,6 @@ class BeanCurrentlyInCreationFailureAnalyzer return ((UnsatisfiedDependencyException) ex).getInjectionPoint(); } - @Override - public int hashCode() { - return this.name.hashCode(); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -155,6 +150,11 @@ class BeanCurrentlyInCreationFailureAnalyzer return this.name.equals(((BeanInCycle) obj).name); } + @Override + public int hashCode() { + return this.name.hashCode(); + } + @Override public String toString() { return this.name + this.description; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java index 5e9bbe26b0d..73df6b6012d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggerConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -72,22 +72,6 @@ public final class LoggerConfiguration { return this.name; } - @Override - public String toString() { - return "LoggerConfiguration [name=" + this.name + ", configuredLevel=" - + this.configuredLevel + ", effectiveLevel=" + this.effectiveLevel + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ObjectUtils.nullSafeHashCode(this.name); - result = prime * result + ObjectUtils.nullSafeHashCode(this.configuredLevel); - result = prime * result + ObjectUtils.nullSafeHashCode(this.effectiveLevel); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -109,4 +93,20 @@ public final class LoggerConfiguration { return super.equals(obj); } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ObjectUtils.nullSafeHashCode(this.name); + result = prime * result + ObjectUtils.nullSafeHashCode(this.configuredLevel); + result = prime * result + ObjectUtils.nullSafeHashCode(this.effectiveLevel); + return result; + } + + @Override + public String toString() { + return "LoggerConfiguration [name=" + this.name + ", configuredLevel=" + + this.configuredLevel + ", effectiveLevel=" + this.effectiveLevel + "]"; + } + } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java index 1a9bcc6fab5..2270692595f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/OriginTrackedValue.java @@ -52,8 +52,11 @@ public class OriginTrackedValue implements OriginProvider { } @Override - public String toString() { - return (this.value != null) ? this.value.toString() : null; + public boolean equals(Object obj) { + if (obj == null || obj.getClass() != getClass()) { + return false; + } + return ObjectUtils.nullSafeEquals(this.value, ((OriginTrackedValue) obj).value); } @Override @@ -62,11 +65,8 @@ public class OriginTrackedValue implements OriginProvider { } @Override - public boolean equals(Object obj) { - if (obj == null || obj.getClass() != getClass()) { - return false; - } - return ObjectUtils.nullSafeEquals(this.value, ((OriginTrackedValue) obj).value); + public String toString() { + return (this.value != null) ? this.value.toString() : null; } public static OriginTrackedValue of(Object value) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java index f939ad18218..77688fc68e9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/SystemEnvironmentOrigin.java @@ -40,16 +40,6 @@ public class SystemEnvironmentOrigin implements Origin { return this.property; } - @Override - public String toString() { - return "System Environment Property \"" + this.property + "\""; - } - - @Override - public int hashCode() { - return ObjectUtils.nullSafeHashCode(this.property); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -62,4 +52,14 @@ public class SystemEnvironmentOrigin implements Origin { return ObjectUtils.nullSafeEquals(this.property, other.property); } + @Override + public int hashCode() { + return ObjectUtils.nullSafeHashCode(this.property); + } + + @Override + public String toString() { + return "System Environment Property \"" + this.property + "\""; + } + } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java index cd7fd5eb671..d8c965f971e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/TextResourceOrigin.java @@ -54,14 +54,6 @@ public class TextResourceOrigin implements Origin { return this.location; } - @Override - public int hashCode() { - int result = 1; - result = 31 * result + ObjectUtils.nullSafeHashCode(this.resource); - result = 31 * result + ObjectUtils.nullSafeHashCode(this.location); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -80,6 +72,14 @@ public class TextResourceOrigin implements Origin { return super.equals(obj); } + @Override + public int hashCode() { + int result = 1; + result = 31 * result + ObjectUtils.nullSafeHashCode(this.resource); + result = 31 * result + ObjectUtils.nullSafeHashCode(this.location); + return result; + } + @Override public String toString() { StringBuilder result = new StringBuilder(); @@ -126,11 +126,6 @@ public class TextResourceOrigin implements Origin { return this.column; } - @Override - public int hashCode() { - return (31 * this.line) + this.column; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -146,6 +141,11 @@ public class TextResourceOrigin implements Origin { return result; } + @Override + public int hashCode() { + return (31 * this.line) + this.column; + } + @Override public String toString() { return (this.line + 1) + ":" + (this.column + 1); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java index fad8b0fea3d..cd07e1eacb1 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationPid.java @@ -60,16 +60,6 @@ public class ApplicationPid { } } - @Override - public String toString() { - return (this.pid != null) ? this.pid : "???"; - } - - @Override - public int hashCode() { - return ObjectUtils.nullSafeHashCode(this.pid); - } - @Override public boolean equals(Object obj) { if (obj == this) { @@ -81,6 +71,16 @@ public class ApplicationPid { return false; } + @Override + public int hashCode() { + return ObjectUtils.nullSafeHashCode(this.pid); + } + + @Override + public String toString() { + return (this.pid != null) ? this.pid : "???"; + } + /** * Write the PID to the specified file. * @param file the PID file diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java index fdc2e33ba1c..53a3f978330 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java @@ -340,16 +340,6 @@ public class UndertowServletWebServer implements WebServer { return this.number; } - @Override - public String toString() { - return this.number + " (" + this.protocol + ")"; - } - - @Override - public int hashCode() { - return this.number; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -368,6 +358,16 @@ public class UndertowServletWebServer implements WebServer { return true; } + @Override + public int hashCode() { + return this.number; + } + + @Override + public String toString() { + return this.number + " (" + this.protocol + ")"; + } + } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java index 1a643dcd4c6..4f56d7847ef 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowWebServer.java @@ -268,16 +268,6 @@ public class UndertowWebServer implements WebServer { return this.number; } - @Override - public String toString() { - return this.number + " (" + this.protocol + ")"; - } - - @Override - public int hashCode() { - return this.number; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -296,6 +286,16 @@ public class UndertowWebServer implements WebServer { return true; } + @Override + public int hashCode() { + return this.number; + } + + @Override + public String toString() { + return this.number + " (" + this.protocol + ")"; + } + } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java index 180fbcc400d..a6ca4a6c29b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java @@ -104,16 +104,6 @@ public class ErrorPage { return (this.status == null && this.exception == null); } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ObjectUtils.nullSafeHashCode(getExceptionName()); - result = prime * result + ObjectUtils.nullSafeHashCode(this.path); - result = prime * result + this.getStatusCode(); - return result; - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -134,4 +124,14 @@ public class ErrorPage { return false; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ObjectUtils.nullSafeHashCode(getExceptionName()); + result = prime * result + ObjectUtils.nullSafeHashCode(this.path); + result = prime * result + this.getStatusCode(); + return result; + } + } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java index f3fa83b026e..da216393137 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java @@ -302,11 +302,6 @@ public final class MimeMappings implements Iterable { return (previous != null) ? previous.getMimeType() : null; } - @Override - public int hashCode() { - return this.map.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == null) { @@ -322,6 +317,11 @@ public final class MimeMappings implements Iterable { return false; } + @Override + public int hashCode() { + return this.map.hashCode(); + } + /** * Create a new unmodifiable view of the specified mapping. Methods that attempt to * modify the returned map will throw {@link UnsupportedOperationException}s. @@ -356,11 +356,6 @@ public final class MimeMappings implements Iterable { return this.mimeType; } - @Override - public int hashCode() { - return this.extension.hashCode(); - } - @Override public boolean equals(Object obj) { if (obj == null) { @@ -377,6 +372,11 @@ public final class MimeMappings implements Iterable { return false; } + @Override + public int hashCode() { + return this.extension.hashCode(); + } + @Override public String toString() { return "Mapping [extension=" + this.extension + ", mimeType=" + this.mimeType diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java index b209eb9db0e..d5b93e57a76 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/origin/MockOrigin.java @@ -32,11 +32,6 @@ public final class MockOrigin implements Origin { this.value = value; } - @Override - public int hashCode() { - return this.value.hashCode(); - } - @Override public boolean equals(Object obj) { if (this == obj) { @@ -48,6 +43,11 @@ public final class MockOrigin implements Origin { return this.value.equals(((MockOrigin) obj).value); } + @Override + public int hashCode() { + return this.value.hashCode(); + } + @Override public String toString() { return this.value;