Repository: nifi
Updated Branches:
  refs/heads/0.x 089fb0814 -> c81248f26
  refs/heads/master 63a0d0c21 -> 993d3cd78


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 <[email protected]>


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

Branch: refs/heads/0.x
Commit: c81248f2690fd35288c44fd22be6eb0d9e766e23
Parents: 089fb08
Author: Aldrin Piri <[email protected]>
Authored: Fri May 6 17:33:00 2016 -0400
Committer: Aldrin Piri <[email protected]>
Committed: Fri May 6 23:03:29 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/c81248f2/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);
 

Reply via email to