mirror of https://github.com/apache/nifi.git
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:
parent
fea17d0ca8
commit
6fa5deafc2
|
@ -57,6 +57,7 @@ public class DatabaseReader implements GeoIp2Provider, Closeable {
|
||||||
|
|
||||||
private final Reader reader;
|
private final Reader reader;
|
||||||
private final ObjectMapper om;
|
private final ObjectMapper om;
|
||||||
|
private List<String> locales;
|
||||||
|
|
||||||
private DatabaseReader(final Builder builder) throws IOException {
|
private DatabaseReader(final Builder builder) throws IOException {
|
||||||
if (builder.stream != null) {
|
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);
|
this.om.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
|
||||||
InjectableValues inject = new InjectableValues.Std().addValue("locales", builder.locales);
|
InjectableValues inject = new InjectableValues.Std().addValue("locales", builder.locales);
|
||||||
this.om.setInjectableValues(inject);
|
this.om.setInjectableValues(inject);
|
||||||
|
|
||||||
|
this.locales = builder.locales;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -259,6 +262,8 @@ public class DatabaseReader implements GeoIp2Provider, Closeable {
|
||||||
return ip;
|
return ip;
|
||||||
} else if ("traits".equals(valueId)) {
|
} else if ("traits".equals(valueId)) {
|
||||||
return new Traits(ip);
|
return new Traits(ip);
|
||||||
|
} else if ("locales".equals(valueId)) {
|
||||||
|
return locales;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue