NIFI-5908 Inject locale info into JsonInjector object to make sure we don't lose that information.

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #3226.
This commit is contained in:
Mike Thomsen 2018-12-18 12:53:29 -05:00 committed by Pierre Villard
parent fea17d0ca8
commit 6fa5deafc2
No known key found for this signature in database
GPG Key ID: BEE1599F0726E9CD
1 changed files with 5 additions and 0 deletions

View File

@ -57,6 +57,7 @@ public class DatabaseReader implements GeoIp2Provider, Closeable {
private final Reader reader;
private final ObjectMapper om;
private List<String> locales;
private DatabaseReader(final Builder builder) throws IOException {
if (builder.stream != null) {
@ -74,6 +75,8 @@ public class DatabaseReader implements GeoIp2Provider, Closeable {
this.om.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
InjectableValues inject = new InjectableValues.Std().addValue("locales", builder.locales);
this.om.setInjectableValues(inject);
this.locales = builder.locales;
}
/**
@ -259,6 +262,8 @@ public class DatabaseReader implements GeoIp2Provider, Closeable {
return ip;
} else if ("traits".equals(valueId)) {
return new Traits(ip);
} else if ("locales".equals(valueId)) {
return locales;
}
return null;