Merge pull request #12236 from igor-suhorukov:master

* pr/12236:
  Polish contribution
  Polish
pull/12269/merge
Stephane Nicoll 7 years ago
commit 0bbdcfde30

@ -56,11 +56,10 @@ public class BackgroundPreinitializer
@Override @Override
public void onApplicationEvent(SpringApplicationEvent event) { public void onApplicationEvent(SpringApplicationEvent event) {
if (event instanceof ApplicationStartingEvent) { if (event instanceof ApplicationStartingEvent
if (preinitializationStarted.compareAndSet(false, true)) { && preinitializationStarted.compareAndSet(false, true)) {
performPreinitialization(); performPreinitialization();
} }
}
if ((event instanceof ApplicationReadyEvent if ((event instanceof ApplicationReadyEvent
|| event instanceof ApplicationFailedEvent) || event instanceof ApplicationFailedEvent)
&& preinitializationStarted.get()) { && preinitializationStarted.get()) {

@ -218,14 +218,13 @@ public class EmbeddedLdapAutoConfiguration {
AnnotatedTypeMetadata metadata) { AnnotatedTypeMetadata metadata) {
Builder message = ConditionMessage.forCondition("Embedded LDAP"); Builder message = ConditionMessage.forCondition("Embedded LDAP");
Environment environment = context.getEnvironment(); Environment environment = context.getEnvironment();
if (environment != null) { if (environment != null
if (!Binder.get(environment) && !Binder.get(environment)
.bind("spring.ldap.embedded.base-dn", STRING_LIST) .bind("spring.ldap.embedded.base-dn", STRING_LIST)
.orElseGet(Collections::emptyList).isEmpty()) { .orElseGet(Collections::emptyList).isEmpty()) {
return ConditionOutcome return ConditionOutcome
.match(message.because("Found base-dn property")); .match(message.because("Found base-dn property"));
} }
}
return ConditionOutcome.noMatch(message.because("No base-dn property found")); return ConditionOutcome.noMatch(message.because("No base-dn property found"));
} }

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -74,13 +74,12 @@ public class ConditionEvaluationReportLoggingListener
logAutoConfigurationReport(); logAutoConfigurationReport();
} }
} }
else if (event instanceof ApplicationFailedEvent) { else if (event instanceof ApplicationFailedEvent
if (((ApplicationFailedEvent) event) && ((ApplicationFailedEvent) event)
.getApplicationContext() == initializerApplicationContext) { .getApplicationContext() == initializerApplicationContext) {
logAutoConfigurationReport(true); logAutoConfigurationReport(true);
} }
} }
}
private void logAutoConfigurationReport() { private void logAutoConfigurationReport() {
logAutoConfigurationReport(!this.applicationContext.isActive()); logAutoConfigurationReport(!this.applicationContext.isActive());

@ -248,8 +248,8 @@ public class SessionAutoConfiguration {
public void checkSessionRepository() { public void checkSessionRepository() {
StoreType storeType = this.sessionProperties.getStoreType(); StoreType storeType = this.sessionProperties.getStoreType();
if (storeType != StoreType.NONE if (storeType != StoreType.NONE
&& this.sessionRepositoryProvider.getIfAvailable() == null) { && this.sessionRepositoryProvider.getIfAvailable() == null
if (storeType != null) { && storeType != null) {
throw new SessionRepositoryUnavailableException( throw new SessionRepositoryUnavailableException(
"No session repository could be auto-configured, check your " "No session repository could be auto-configured, check your "
+ "configuration (session store type is '" + "configuration (session store type is '"
@ -257,7 +257,6 @@ public class SessionAutoConfiguration {
storeType); storeType);
} }
} }
}
} }

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -147,12 +147,10 @@ class Installer {
String home = SystemPropertyUtils String home = SystemPropertyUtils
.resolvePlaceholders("${spring.home:${SPRING_HOME:.}}"); .resolvePlaceholders("${spring.home:${SPRING_HOME:.}}");
File extDirectory = new File(new File(home, "lib"), "ext"); File extDirectory = new File(new File(home, "lib"), "ext");
if (!extDirectory.isDirectory()) { if (!extDirectory.isDirectory() && !extDirectory.mkdirs()) {
if (!extDirectory.mkdirs()) {
throw new IllegalStateException( throw new IllegalStateException(
"Failed to create ext directory " + extDirectory); "Failed to create ext directory " + extDirectory);
} }
}
return extDirectory; return extDirectory;
} }

@ -179,12 +179,11 @@ public abstract class AstUtils {
private static ClosureExpression getClosure(String name, private static ClosureExpression getClosure(String name,
MethodCallExpression expression) { MethodCallExpression expression) {
Expression method = expression.getMethod(); Expression method = expression.getMethod();
if (method instanceof ConstantExpression) { if (method instanceof ConstantExpression
if (name.equals(((ConstantExpression) method).getValue())) { && name.equals(((ConstantExpression) method).getValue())) {
return (ClosureExpression) ((ArgumentListExpression) expression return (ClosureExpression) ((ArgumentListExpression) expression
.getArguments()).getExpression(0); .getArguments()).getExpression(0);
} }
}
return null; return null;
} }

@ -103,12 +103,11 @@ public abstract class ResourceUtils {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
for (Resource resource : resources) { for (Resource resource : resources) {
if (resource.exists()) { if (resource.exists()) {
if (resource.getURI().getScheme().equals("file")) { if (resource.getURI().getScheme().equals("file")
if (resource.getFile().isDirectory()) { && resource.getFile().isDirectory()) {
result.addAll(getChildFiles(resource)); result.addAll(getChildFiles(resource));
continue; continue;
} }
}
result.add(absolutePath(resource)); result.add(absolutePath(resource));
} }
} }

@ -63,8 +63,7 @@ class Tree extends ReflectionWrapper {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public Object invoke(Object proxy, Method method, Object[] args) public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable { throws Throwable {
if (method.getName().equals("visitClass")) { if (method.getName().equals("visitClass") && (Integer) args[1] == 0) {
if ((Integer) args[1] == 0) {
Iterable members = (Iterable) Tree.this.getClassTreeMembers Iterable members = (Iterable) Tree.this.getClassTreeMembers
.invoke(args[0]); .invoke(args[0]);
for (Object member : members) { for (Object member : members) {
@ -74,7 +73,6 @@ class Tree extends ReflectionWrapper {
} }
} }
} }
}
if (method.getName().equals("visitVariable")) { if (method.getName().equals("visitVariable")) {
this.treeVisitor.visitVariable(new VariableTree(args[0])); this.treeVisitor.visitVariable(new VariableTree(args[0]));
} }

@ -266,12 +266,11 @@ final class JarURLConnection extends java.net.JarURLConnection {
index = separator + SEPARATOR.length(); index = separator + SEPARATOR.length();
} }
JarEntryName jarEntryName = JarEntryName.get(spec, index); JarEntryName jarEntryName = JarEntryName.get(spec, index);
if (Boolean.TRUE.equals(useFastExceptions.get())) { if (Boolean.TRUE.equals(useFastExceptions.get())
if (!jarEntryName.isEmpty() && !jarEntryName.isEmpty()
&& !jarFile.containsEntry(jarEntryName.toString())) { && !jarFile.containsEntry(jarEntryName.toString())) {
return NOT_FOUND_CONNECTION; return NOT_FOUND_CONNECTION;
} }
}
return new JarURLConnection(url, jarFile, jarEntryName); return new JarURLConnection(url, jarFile, jarEntryName);
} }

@ -147,14 +147,13 @@ class BeanDefinitionLoader {
} }
private int load(Class<?> source) { private int load(Class<?> source) {
if (isGroovyPresent()) { if (isGroovyPresent()
&& GroovyBeanDefinitionSource.class.isAssignableFrom(source)) {
// Any GroovyLoaders added in beans{} DSL can contribute beans here // Any GroovyLoaders added in beans{} DSL can contribute beans here
if (GroovyBeanDefinitionSource.class.isAssignableFrom(source)) {
GroovyBeanDefinitionSource loader = BeanUtils.instantiateClass(source, GroovyBeanDefinitionSource loader = BeanUtils.instantiateClass(source,
GroovyBeanDefinitionSource.class); GroovyBeanDefinitionSource.class);
load(loader); load(loader);
} }
}
if (isComponent(source)) { if (isComponent(source)) {
this.annotatedReader.register(source); this.annotatedReader.register(source);
return 1; return 1;

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -60,14 +60,13 @@ public class ParentContextCloserApplicationListener
} }
private void maybeInstallListenerInParent(ConfigurableApplicationContext child) { private void maybeInstallListenerInParent(ConfigurableApplicationContext child) {
if (child == this.context) { if (child == this.context
if (child.getParent() instanceof ConfigurableApplicationContext) { && child.getParent() instanceof ConfigurableApplicationContext) {
ConfigurableApplicationContext parent = (ConfigurableApplicationContext) child ConfigurableApplicationContext parent = (ConfigurableApplicationContext) child
.getParent(); .getParent();
parent.addApplicationListener(createContextCloserListener(child)); parent.addApplicationListener(createContextCloserListener(child));
} }
} }
}
/** /**
* Subclasses may override to create their own subclass of ContextCloserListener. This * Subclasses may override to create their own subclass of ContextCloserListener. This

@ -136,8 +136,8 @@ public class ApplicationPidFileWriter
@Override @Override
public void onApplicationEvent(SpringApplicationEvent event) { public void onApplicationEvent(SpringApplicationEvent event) {
if (this.triggerEventType.isInstance(event)) { if (this.triggerEventType.isInstance(event)
if (created.compareAndSet(false, true)) { && created.compareAndSet(false, true)) {
try { try {
writePidFile(event); writePidFile(event);
} }
@ -151,7 +151,6 @@ public class ApplicationPidFileWriter
} }
} }
} }
}
private void writePidFile(SpringApplicationEvent event) throws IOException { private void writePidFile(SpringApplicationEvent event) throws IOException {
File pidFile = this.file; File pidFile = this.file;

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -51,11 +51,10 @@ public class SpringBootConfigurationFactory extends ConfigurationFactory {
@Override @Override
public Configuration getConfiguration(LoggerContext loggerContext, public Configuration getConfiguration(LoggerContext loggerContext,
ConfigurationSource source) { ConfigurationSource source) {
if (source != null && source != ConfigurationSource.NULL_SOURCE) { if (source != null && source != ConfigurationSource.NULL_SOURCE
if (LoggingSystem.get(loggerContext.getClass().getClassLoader()) != null) { && LoggingSystem.get(loggerContext.getClass().getClassLoader()) != null) {
return new DefaultConfiguration(); return new DefaultConfiguration();
} }
}
return null; return null;
} }

Loading…
Cancel
Save