Polish
This commit is contained in:
@@ -1059,7 +1059,7 @@ public class RabbitProperties {
|
||||
}
|
||||
else {
|
||||
this.host = input.substring(0, portIndex);
|
||||
this.port = Integer.valueOf(input.substring(portIndex + 1));
|
||||
this.port = Integer.parseInt(input.substring(portIndex + 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ abstract class RedisConnectionConfiguration {
|
||||
try {
|
||||
String[] parts = StringUtils.split(node, ":");
|
||||
Assert.state(parts.length == 2, "Must be defined as 'host:port'");
|
||||
nodes.add(new RedisNode(parts[0], Integer.valueOf(parts[1])));
|
||||
nodes.add(new RedisNode(parts[0], Integer.parseInt(parts[1])));
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
throw new IllegalStateException("Invalid redis sentinel property '" + node + "'", ex);
|
||||
|
||||
@@ -44,8 +44,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp
|
||||
* needed, otherwise default converters will be used.
|
||||
* <p>
|
||||
* NOTE: The default converters used are the same as standard Spring MVC (see
|
||||
* {@link WebMvcConfigurationSupport#getMessageConverters} with some slight re-ordering to
|
||||
* put XML converters at the back of the list.
|
||||
* {@link WebMvcConfigurationSupport}) with some slight re-ordering to put XML converters
|
||||
* at the back of the list.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Phillip Webb
|
||||
|
||||
@@ -68,10 +68,10 @@ class ArtemisConnectionFactoryFactory {
|
||||
}
|
||||
|
||||
private void startEmbeddedJms() {
|
||||
for (int i = 0; i < EMBEDDED_JMS_CLASSES.length; i++) {
|
||||
if (ClassUtils.isPresent(EMBEDDED_JMS_CLASSES[i], null)) {
|
||||
for (String embeddedJmsClass : EMBEDDED_JMS_CLASSES) {
|
||||
if (ClassUtils.isPresent(embeddedJmsClass, null)) {
|
||||
try {
|
||||
this.beanFactory.getBeansOfType(Class.forName(EMBEDDED_JMS_CLASSES[i]));
|
||||
this.beanFactory.getBeansOfType(Class.forName(embeddedJmsClass));
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// Ignore
|
||||
@@ -103,8 +103,8 @@ class ArtemisConnectionFactoryFactory {
|
||||
}
|
||||
|
||||
private boolean isEmbeddedJmsClassPresent() {
|
||||
for (int i = 0; i < EMBEDDED_JMS_CLASSES.length; i++) {
|
||||
if (ClassUtils.isPresent(EMBEDDED_JMS_CLASSES[i], null)) {
|
||||
for (String embeddedJmsClass : EMBEDDED_JMS_CLASSES) {
|
||||
if (ClassUtils.isPresent(embeddedJmsClass, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class LdapProperties {
|
||||
Assert.notNull(environment, "Environment must not be null");
|
||||
String localPort = environment.getProperty("local.ldap.port");
|
||||
if (localPort != null) {
|
||||
return Integer.valueOf(localPort);
|
||||
return Integer.parseInt(localPort);
|
||||
}
|
||||
return DEFAULT_PORT;
|
||||
}
|
||||
|
||||
@@ -282,17 +282,15 @@ public class TomcatWebServerFactoryCustomizer
|
||||
|
||||
private void customizeStaticResources(ConfigurableTomcatWebServerFactory factory) {
|
||||
ServerProperties.Tomcat.Resource resource = this.serverProperties.getTomcat().getResource();
|
||||
factory.addContextCustomizers((context) -> {
|
||||
context.addLifecycleListener((event) -> {
|
||||
if (event.getType().equals(Lifecycle.CONFIGURE_START_EVENT)) {
|
||||
context.getResources().setCachingAllowed(resource.isAllowCaching());
|
||||
if (resource.getCacheTtl() != null) {
|
||||
long ttl = resource.getCacheTtl().toMillis();
|
||||
context.getResources().setCacheTtl(ttl);
|
||||
}
|
||||
factory.addContextCustomizers((context) -> context.addLifecycleListener((event) -> {
|
||||
if (event.getType().equals(Lifecycle.CONFIGURE_START_EVENT)) {
|
||||
context.getResources().setCachingAllowed(resource.isAllowCaching());
|
||||
if (resource.getCacheTtl() != null) {
|
||||
long ttl = resource.getCacheTtl().toMillis();
|
||||
context.getResources().setCacheTtl(ttl);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void customizeErrorReportValve(ErrorProperties error, ConfigurableTomcatWebServerFactory factory) {
|
||||
|
||||
@@ -168,16 +168,13 @@ public class UndertowWebServerFactoryCustomizer
|
||||
return (value) -> this.factory.addBuilderCustomizers((builder) -> builder.setSocketOption(option, value));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
<T> Consumer<Map<String, String>> forEach(Function<Option<T>, Consumer<T>> function) {
|
||||
return (map) -> {
|
||||
map.forEach((key, value) -> {
|
||||
Option<T> option = (Option<T>) NAME_LOOKUP.get(getCanonicalName(key));
|
||||
Assert.state(option != null, "Unable to find '" + key + "' in UndertowOptions");
|
||||
T parsed = option.parseValue(value, getClass().getClassLoader());
|
||||
function.apply(option).accept(parsed);
|
||||
});
|
||||
};
|
||||
return (map) -> map.forEach((key, value) -> {
|
||||
Option<T> option = (Option<T>) NAME_LOOKUP.get(getCanonicalName(key));
|
||||
Assert.state(option != null, "Unable to find '" + key + "' in UndertowOptions");
|
||||
T parsed = option.parseValue(value, getClass().getClassLoader());
|
||||
function.apply(option).accept(parsed);
|
||||
});
|
||||
}
|
||||
|
||||
private static String getCanonicalName(String name) {
|
||||
|
||||
Reference in New Issue
Block a user