[
https://issues.apache.org/jira/browse/NIFI-1859?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aldrin Piri resolved NIFI-1859.
-------------------------------
Resolution: Fixed
> ConvertAvroSchema performs improper equality check on locale property
> ---------------------------------------------------------------------
>
> Key: NIFI-1859
> URL: https://issues.apache.org/jira/browse/NIFI-1859
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 0.6.1
> Reporter: Aldrin Piri
> Assignee: Aldrin Piri
> Fix For: 1.0.0, 0.7.0
>
>
> From the users list:
> {quote}
> Hi,
> I am seeing this error in my logs (may or may not be linked to upgrade to
> 0.6.1)
> java.lang.IllegalArgumentException: Invalid locale format: default
> at
> org.apache.commons.lang.LocaleUtils.toLocale(LocaleUtils.java:110) ~[na:na]
> at
> org.apache.nifi.processors.kite.ConvertAvroSchema.onTrigger(ConvertAvroSchema.java:277)
> ~[na:na]
> ….
> I have a number of flows that use ConvertAvroSchema processor but I just have
> the default locale of ‘default’ in there which would appear to be the
> problem. I’m running on Java 8 if that make a difference.
> Running >locale on a node in my cluster with the problem returns the same as
> nodes without the error.
> [root@yarn-cm1 opt]# locale
> LANG=en_GB.UTF-8
> LC_CTYPE="en_GB.UTF-8"
> LC_NUMERIC="en_GB.UTF-8"
> LC_TIME="en_GB.UTF-8"
> LC_COLLATE="en_GB.UTF-8"
> LC_MONETARY="en_GB.UTF-8"
> LC_MESSAGES="en_GB.UTF-8"
> LC_PAPER="en_GB.UTF-8"
> LC_NAME="en_GB.UTF-8"
> LC_ADDRESS="en_GB.UTF-8"
> LC_TELEPHONE="en_GB.UTF-8"
> LC_MEASUREMENT="en_GB.UTF-8"
> LC_IDENTIFICATION="en_GB.UTF-8"
> LC_ALL=
> Should I manually set the locale in the ConvertAvroSchema or need to do
> something else??
> Thanks
> Conrad
> SecureData, combating cyber threats
> {quote}
> Based on the snippet of stacktrace, it appears the culprit is the incorrect
> use of "==" in lieu of ".equals."
> The lines in question are:
> final String localeProperty = context.getProperty(LOCALE).getValue();
> final Locale locale = (localeProperty ==
> DEFAULT_LOCALE_VALUE)?Locale.getDefault():LocaleUtils.toLocale(localeProperty);
> For some instances, I believe localeProperty is not getting internalized with
> the "default" string for DEFAULT_LOCALE_VALUE, and thus, is being passed to
> #toLocale. I was able to reproduce locally by changing the property to
> something other than "default" and then, changing it back to "default." Was
> also able to verify that .equals remedied the issue.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)