Skip to content

Commit fa3bc2d

Browse files
committed
Move locale setting code to ensure it's always set.
1 parent 0997a7b commit fa3bc2d

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

‎jooby/src/main/java/io/jooby/Jooby.java‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -673,17 +673,6 @@ public Jooby errorCode(@Nonnull Class<? extends Throwable> type,
673673
* @return Server.
674674
*/
675675
public @Nonnull Server start() {
676-
if (locales == null) {
677-
String path = "application.lang";
678-
locales = Optional.of(getConfig())
679-
.filter(c -> c.hasPath(path))
680-
.map(c -> c.getString(path))
681-
.map(v -> LocaleUtils.parseLocales(v).orElseThrow(() -> new RuntimeException(String.format(
682-
"Invalid value for configuration property '%s'; check the documentation of %s#parse(): %s",
683-
path, Locale.LanguageRange.class.getName(), v))))
684-
.orElseGet(() -> singletonList(Locale.getDefault()));
685-
}
686-
687676
List<Server> servers = stream(
688677
spliteratorUnknownSize(
689678
ServiceLoader.load(Server.class).iterator(),
@@ -737,6 +726,17 @@ public Jooby errorCode(@Nonnull Class<? extends Throwable> type,
737726
mode = ExecutionMode.DEFAULT;
738727
}
739728

729+
if (locales == null) {
730+
String path = "application.lang";
731+
locales = Optional.of(getConfig())
732+
.filter(c -> c.hasPath(path))
733+
.map(c -> c.getString(path))
734+
.map(v -> LocaleUtils.parseLocales(v).orElseThrow(() -> new RuntimeException(String.format(
735+
"Invalid value for configuration property '%s'; check the documentation of %s#parse(): %s",
736+
path, Locale.LanguageRange.class.getName(), v))))
737+
.orElseGet(() -> singletonList(Locale.getDefault()));
738+
}
739+
740740
ServiceRegistry services = getServices();
741741
services.put(Environment.class, getEnvironment());
742742
services.put(Config.class, getConfig());

0 commit comments

Comments
 (0)