[ 
https://issues.apache.org/jira/browse/NIFI-1859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15274758#comment-15274758
 ] 

ASF GitHub Bot commented on NIFI-1859:
--------------------------------------

GitHub user apiri opened a pull request:

    https://github.com/apache/nifi/pull/418

    NIFI-1859 Using .equals instead of == for default locale check.  Addi…

    NIFI-1859 Using .equals instead of == for default locale check.  Adding 
some additional information for the input and output schema properties.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apiri/incubator-nifi NIFI-1859

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/418.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #418
    
----
commit fa3f18f0c7a455682724d4d1855a9c0b179c60e7
Author: Aldrin Piri <ald...@apache.org>
Date:   2016-05-06T21:33:00Z

    NIFI-1859 Using .equals instead of == for default locale check.  Adding 
some additional information for the input and output schema properties.

----


> 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)

Reply via email to