You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Conrad Crampton <co...@SecData.com> on 2016/05/06 12:27:01 UTC

ConvertAvroSchema locale default error

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
______________________________________________________________________ 
The information contained in this message or any of its attachments may be privileged and confidential and intended for the exclusive use of the intended recipient. If you are not the intended recipient any disclosure, reproduction, distribution or other dissemination or use of this communications is strictly prohibited. The views expressed in this email are those of the individual and not necessarily of SecureData Europe Ltd. Any prices quoted are only valid if followed up by a formal written quote.

SecureData Europe Limited. Registered in England & Wales 04365896. Registered Address: SecureData House, Hermitage Court, Hermitage Lane, Maidstone, Kent, ME16 9NT

Re: ConvertAvroSchema locale default error

Posted by Conrad Crampton <co...@SecData.com>.
Hi,
Excellent – thanks for sorting this.
Conrad

From: Aldrin Piri <al...@gmail.com>>
Reply-To: "users@nifi.apache.org<ma...@nifi.apache.org>" <us...@nifi.apache.org>>
Date: Friday, 6 May 2016 at 22:00
To: "users@nifi.apache.org<ma...@nifi.apache.org>" <us...@nifi.apache.org>>
Subject: Re: ConvertAvroSchema locale default error

Hi Conrad,

Not very knowledgeable in Avro by any means, but did do a cursory glance over the code during a build.  Based on your 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.

Created an issue (https://issues.apache.org/jira/browse/NIFI-1859) and will provide a patch (noticed a few other items with that processor I would like to address as well).


On Fri, May 6, 2016 at 8:27 AM, Conrad Crampton <co...@secdata.com>> wrote:
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

________________________________

The information contained in this message or any of its attachments may be privileged and confidential and intended for the exclusive use of the intended recipient. If you are not the intended recipient any disclosure, reproduction, distribution or other dissemination or use of this communications is strictly prohibited. The views expressed in this email are those of the individual and not necessarily of SecureData Europe Ltd. Any prices quoted are only valid if followed up by a formal written quote.

SecureData Europe Limited. Registered in England & Wales 04365896. Registered Address: SecureData House, Hermitage Court, Hermitage Lane, Maidstone, Kent, ME16 9NT




***This email originated outside SecureData***

Click here<https://www.mailcontrol.com/sr/RAYCNIT2FCvGX2PQPOmvUs3oG7lEfVxCet2AcgGoODpCKJ3nlb5uIOJZd6KDNQVteUDNxz32L0KoZTw26POg4w==> to report this email as spam.

Re: ConvertAvroSchema locale default error

Posted by Aldrin Piri <al...@gmail.com>.
Hi Conrad,

Not very knowledgeable in Avro by any means, but did do a cursory glance
over the code during a build.  Based on your 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.

Created an issue (https://issues.apache.org/jira/browse/NIFI-1859) and
will provide a patch (noticed a few other items with that processor I
would like to address as well).


On Fri, May 6, 2016 at 8:27 AM, Conrad Crampton <conrad.crampton@secdata.com
> wrote:

> 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
>
> ------------------------------
>
> The information contained in this message or any of its attachments may be
> privileged and confidential and intended for the exclusive use of the
> intended recipient. If you are not the intended recipient any disclosure,
> reproduction, distribution or other dissemination or use of this
> communications is strictly prohibited. The views expressed in this email
> are those of the individual and not necessarily of SecureData Europe Ltd.
> Any prices quoted are only valid if followed up by a formal written quote.
>
> SecureData Europe Limited. Registered in England & Wales 04365896.
> Registered Address: SecureData House, Hermitage Court, Hermitage Lane,
> Maidstone, Kent, ME16 9NT
>