Skip to content

Commit 0bbdcfd

Browse files
committed
Merge pull request #12236 from igor-suhorukov:master
* pr/12236: Polish contribution Polish
2 parents a93052f + 4180762 commit 0bbdcfd

File tree

13 files changed

+67
-82
lines changed

13 files changed

+67
-82
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/BackgroundPreinitializer.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ public class BackgroundPreinitializer
5656

5757
@Override
5858
public void onApplicationEvent(SpringApplicationEvent event) {
59-
if (event instanceof ApplicationStartingEvent) {
60-
if (preinitializationStarted.compareAndSet(false, true)) {
61-
performPreinitialization();
62-
}
59+
if (event instanceof ApplicationStartingEvent
60+
&& preinitializationStarted.compareAndSet(false, true)) {
61+
performPreinitialization();
6362
}
6463
if ((event instanceof ApplicationReadyEvent
6564
|| event instanceof ApplicationFailedEvent)

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/embedded/EmbeddedLdapAutoConfiguration.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,12 @@ public ConditionOutcome getMatchOutcome(ConditionContext context,
218218
AnnotatedTypeMetadata metadata) {
219219
Builder message = ConditionMessage.forCondition("Embedded LDAP");
220220
Environment environment = context.getEnvironment();
221-
if (environment != null) {
222-
if (!Binder.get(environment)
221+
if (environment != null
222+
&& !Binder.get(environment)
223223
.bind("spring.ldap.embedded.base-dn", STRING_LIST)
224224
.orElseGet(Collections::emptyList).isEmpty()) {
225-
return ConditionOutcome
226-
.match(message.because("Found base-dn property"));
227-
}
225+
return ConditionOutcome
226+
.match(message.because("Found base-dn property"));
228227
}
229228
return ConditionOutcome.noMatch(message.because("No base-dn property found"));
230229
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportLoggingListener.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,11 +74,10 @@ protected void onApplicationEvent(ApplicationEvent event) {
7474
logAutoConfigurationReport();
7575
}
7676
}
77-
else if (event instanceof ApplicationFailedEvent) {
78-
if (((ApplicationFailedEvent) event)
77+
else if (event instanceof ApplicationFailedEvent
78+
&& ((ApplicationFailedEvent) event)
7979
.getApplicationContext() == initializerApplicationContext) {
80-
logAutoConfigurationReport(true);
81-
}
80+
logAutoConfigurationReport(true);
8281
}
8382
}
8483

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionAutoConfiguration.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,13 @@ protected AbstractSessionRepositoryValidator(SessionProperties sessionProperties
248248
public void checkSessionRepository() {
249249
StoreType storeType = this.sessionProperties.getStoreType();
250250
if (storeType != StoreType.NONE
251-
&& this.sessionRepositoryProvider.getIfAvailable() == null) {
252-
if (storeType != null) {
253-
throw new SessionRepositoryUnavailableException(
254-
"No session repository could be auto-configured, check your "
255-
+ "configuration (session store type is '"
256-
+ storeType.name().toLowerCase(Locale.ENGLISH) + "')",
257-
storeType);
258-
}
251+
&& this.sessionRepositoryProvider.getIfAvailable() == null
252+
&& storeType != null) {
253+
throw new SessionRepositoryUnavailableException(
254+
"No session repository could be auto-configured, check your "
255+
+ "configuration (session store type is '"
256+
+ storeType.name().toLowerCase(Locale.ENGLISH) + "')",
257+
storeType);
259258
}
260259
}
261260

spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/install/Installer.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -147,11 +147,9 @@ private File getDefaultExtDirectory() {
147147
String home = SystemPropertyUtils
148148
.resolvePlaceholders("${spring.home:${SPRING_HOME:.}}");
149149
File extDirectory = new File(new File(home, "lib"), "ext");
150-
if (!extDirectory.isDirectory()) {
151-
if (!extDirectory.mkdirs()) {
152-
throw new IllegalStateException(
153-
"Failed to create ext directory " + extDirectory);
154-
}
150+
if (!extDirectory.isDirectory() && !extDirectory.mkdirs()) {
151+
throw new IllegalStateException(
152+
"Failed to create ext directory " + extDirectory);
155153
}
156154
return extDirectory;
157155
}

spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,10 @@ private static List<ExpressionStatement> getExpressionStatements(
179179
private static ClosureExpression getClosure(String name,
180180
MethodCallExpression expression) {
181181
Expression method = expression.getMethod();
182-
if (method instanceof ConstantExpression) {
183-
if (name.equals(((ConstantExpression) method).getValue())) {
184-
return (ClosureExpression) ((ArgumentListExpression) expression
185-
.getArguments()).getExpression(0);
186-
}
182+
if (method instanceof ConstantExpression
183+
&& name.equals(((ConstantExpression) method).getValue())) {
184+
return (ClosureExpression) ((ArgumentListExpression) expression
185+
.getArguments()).getExpression(0);
187186
}
188187
return null;
189188
}

spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/util/ResourceUtils.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,10 @@ private static List<String> getUrlsFromPrefixedWildcardPath(String path,
103103
List<String> result = new ArrayList<>();
104104
for (Resource resource : resources) {
105105
if (resource.exists()) {
106-
if (resource.getURI().getScheme().equals("file")) {
107-
if (resource.getFile().isDirectory()) {
108-
result.addAll(getChildFiles(resource));
109-
continue;
110-
}
106+
if (resource.getURI().getScheme().equals("file")
107+
&& resource.getFile().isDirectory()) {
108+
result.addAll(getChildFiles(resource));
109+
continue;
111110
}
112111
result.add(absolutePath(resource));
113112
}

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/Tree.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,13 @@ private class TreeVisitorInvocationHandler implements InvocationHandler {
6363
@SuppressWarnings("rawtypes")
6464
public Object invoke(Object proxy, Method method, Object[] args)
6565
throws Throwable {
66-
if (method.getName().equals("visitClass")) {
67-
if ((Integer) args[1] == 0) {
68-
Iterable members = (Iterable) Tree.this.getClassTreeMembers
69-
.invoke(args[0]);
70-
for (Object member : members) {
71-
if (member != null) {
72-
Tree.this.acceptMethod.invoke(member, proxy,
73-
((Integer) args[1]) + 1);
74-
}
66+
if (method.getName().equals("visitClass") && (Integer) args[1] == 0) {
67+
Iterable members = (Iterable) Tree.this.getClassTreeMembers
68+
.invoke(args[0]);
69+
for (Object member : members) {
70+
if (member != null) {
71+
Tree.this.acceptMethod.invoke(member, proxy,
72+
((Integer) args[1]) + 1);
7573
}
7674
}
7775
}

spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarURLConnection.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,10 @@ static JarURLConnection get(URL url, JarFile jarFile) throws IOException {
266266
index = separator + SEPARATOR.length();
267267
}
268268
JarEntryName jarEntryName = JarEntryName.get(spec, index);
269-
if (Boolean.TRUE.equals(useFastExceptions.get())) {
270-
if (!jarEntryName.isEmpty()
271-
&& !jarFile.containsEntry(jarEntryName.toString())) {
272-
return NOT_FOUND_CONNECTION;
273-
}
269+
if (Boolean.TRUE.equals(useFastExceptions.get())
270+
&& !jarEntryName.isEmpty()
271+
&& !jarFile.containsEntry(jarEntryName.toString())) {
272+
return NOT_FOUND_CONNECTION;
274273
}
275274
return new JarURLConnection(url, jarFile, jarEntryName);
276275
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,12 @@ private int load(Object source) {
147147
}
148148

149149
private int load(Class<?> source) {
150-
if (isGroovyPresent()) {
150+
if (isGroovyPresent()
151+
&& GroovyBeanDefinitionSource.class.isAssignableFrom(source)) {
151152
// Any GroovyLoaders added in beans{} DSL can contribute beans here
152-
if (GroovyBeanDefinitionSource.class.isAssignableFrom(source)) {
153-
GroovyBeanDefinitionSource loader = BeanUtils.instantiateClass(source,
154-
GroovyBeanDefinitionSource.class);
155-
load(loader);
156-
}
153+
GroovyBeanDefinitionSource loader = BeanUtils.instantiateClass(source,
154+
GroovyBeanDefinitionSource.class);
155+
load(loader);
157156
}
158157
if (isComponent(source)) {
159158
this.annotatedReader.register(source);

0 commit comments

Comments
 (0)