From 993d3cd78f66c24ccad2c4b5c6b5b2ddaf957832 Mon Sep 17 00:00:00 2001 From: Aldrin Piri Date: Fri, 6 May 2016 17:33:00 -0400 Subject: [PATCH] NIFI-1859 Using .equals instead of == for default locale check. Adding some additional information for the input and output schema properties. This closes #418. Signed-off-by: Aldrin Piri --- .../processors/kite/ConvertAvroSchema.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/ConvertAvroSchema.java b/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/ConvertAvroSchema.java index b0d3518249..ffcd653539 100644 --- a/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/ConvertAvroSchema.java +++ b/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/ConvertAvroSchema.java @@ -135,12 +135,12 @@ public class ConvertAvroSchema extends AbstractKiteProcessor { @Override public ValidationResult validate(final String subject, final String value, final ValidationContext context) { String reason = null; - if (value.equals(DEFAULT_LOCALE_VALUE) == false) { + if (!value.equals(DEFAULT_LOCALE_VALUE)) { try { final Locale locale = LocaleUtils.toLocale(value); if (locale == null) { reason = "null locale returned"; - } else if (LocaleUtils.isAvailableLocale(locale) == false) { + } else if (!LocaleUtils.isAvailableLocale(locale)) { reason = "locale not available"; } } catch (final IllegalArgumentException e) { @@ -153,15 +153,19 @@ public class ConvertAvroSchema extends AbstractKiteProcessor { @VisibleForTesting static final PropertyDescriptor INPUT_SCHEMA = new PropertyDescriptor.Builder() - .name("Input Schema").description("Avro Schema of Input Flowfiles") - .addValidator(SCHEMA_VALIDATOR).expressionLanguageSupported(true) - .required(true).build(); + .name("Input Schema") + .description("Avro Schema of Input Flowfiles. This can be a URI (dataset, view, or resource) or literal JSON schema.") + .addValidator(SCHEMA_VALIDATOR) + .expressionLanguageSupported(true) + .required(true) + .build(); @VisibleForTesting static final PropertyDescriptor OUTPUT_SCHEMA = new PropertyDescriptor.Builder() .name("Output Schema") - .description("Avro Schema of Output Flowfiles") - .addValidator(MAPPED_SCHEMA_VALIDATOR).expressionLanguageSupported(true) + .description("Avro Schema of Output Flowfiles. This can be a URI (dataset, view, or resource) or literal JSON schema.") + .addValidator(MAPPED_SCHEMA_VALIDATOR) + .expressionLanguageSupported(true) .required(true).build(); @VisibleForTesting @@ -274,7 +278,7 @@ public class ConvertAvroSchema extends AbstractKiteProcessor { } // Set locale final String localeProperty = context.getProperty(LOCALE).getValue(); - final Locale locale = (localeProperty == DEFAULT_LOCALE_VALUE)?Locale.getDefault():LocaleUtils.toLocale(localeProperty); + final Locale locale = localeProperty.equals(DEFAULT_LOCALE_VALUE) ? Locale.getDefault() : LocaleUtils.toLocale(localeProperty); final AvroRecordConverter converter = new AvroRecordConverter( inputSchema, outputSchema, fieldMapping, locale);