You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2022/10/31 23:43:40 UTC

[nifi] branch main updated: NIFI-10637 Simplified Locale validation in ParseCEF

This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 238c356219 NIFI-10637 Simplified Locale validation in ParseCEF
238c356219 is described below

commit 238c356219309c919e37cf6dc619e1cf72365195
Author: TheGreatRandall <62...@users.noreply.github.com>
AuthorDate: Wed Oct 12 20:04:07 2022 -0500

    NIFI-10637 Simplified Locale validation in ParseCEF
    
    This closes #6522
    
    Signed-off-by: David Handermann <ex...@apache.org>
---
 .../src/main/java/org/apache/nifi/processors/standard/ParseCEF.java  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseCEF.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseCEF.java
index de486a23ec..6590b30039 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseCEF.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ParseCEF.java
@@ -393,10 +393,9 @@ public class ParseCEF extends AbstractProcessor {
             }
 
             final Locale testLocale = Locale.forLanguageTag(input);
-            final Locale[] availableLocales = Locale.getAvailableLocales();
 
-            // Check if the provided Locale is valid by checking against the first value of the array (i.e. "null" locale)
-            if (availableLocales[0].equals(testLocale)) {
+            // Check if the provided Locale is valid by checking against the empty locale string
+            if ("".equals(testLocale.toString())) {
                 // Locale matches the "null" locale so it is treated as invalid
                 return new ValidationResult.Builder().subject(subject).input(input).valid(false)
                         .explanation(input + " is not a valid locale format.").build();