You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by al...@apache.org on 2016/05/07 03:05:05 UTC

[2/2] nifi git commit: NIFI-1859 Using .equals instead of == for default locale check. Adding some additional information for the input and output schema properties.

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 <al...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/993d3cd7
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/993d3cd7
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/993d3cd7

Branch: refs/heads/master
Commit: 993d3cd78f66c24ccad2c4b5c6b5b2ddaf957832
Parents: 63a0d0c
Author: Aldrin Piri <al...@apache.org>
Authored: Fri May 6 17:33:00 2016 -0400
Committer: Aldrin Piri <al...@apache.org>
Committed: Fri May 6 23:04:11 2016 -0400

----------------------------------------------------------------------
 .../nifi/processors/kite/ConvertAvroSchema.java | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/993d3cd7/nifi-nar-bundles/nifi-kite-bundle/nifi-kite-processors/src/main/java/org/apache/nifi/processors/kite/ConvertAvroSchema.java
----------------------------------------------------------------------
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 b0d3518..ffcd653 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);