Fix error in plaveholder for timeout

This commit is contained in:
Dave Syer
2015-12-08 16:28:12 +00:00
parent e9b9897aba
commit eb67c2fe5a

View File

@@ -91,9 +91,15 @@ public class InetUtils {
String hostname;
try {
SystemPropertyUtils.resolvePlaceholders(
"${spring.util.timeout.sec:${SPRING_UTIL_TIMEOUT_SEC:1}");
hostname = result.get(1, TimeUnit.SECONDS);
String value = SystemPropertyUtils.resolvePlaceholders(
"${spring.util.timeout.sec:${SPRING_UTIL_TIMEOUT_SEC:1}}");
int timeout = 1;
try {
timeout = Integer.valueOf(value);
}
catch (NumberFormatException e) {
}
hostname = result.get(timeout, TimeUnit.SECONDS);
}
catch (Exception e) {
log.info("Cannot determine local hostname");