From 02b325b07e67a641c727665177d88d06566ac8c5 Mon Sep 17 00:00:00 2001 From: Mark Payne Date: Fri, 1 Jan 2016 13:16:44 -0500 Subject: [PATCH] NIFI-1343: Make comparisons case sensitive if configured to do so. This closes #153. Signed-off-by: joewitt --- .../nifi/processors/standard/RouteText.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RouteText.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RouteText.java index c412126934..d00121f212 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RouteText.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/RouteText.java @@ -510,13 +510,29 @@ public class RouteText extends AbstractProcessor { protected static boolean lineMatches(final String line, final Object comparison, final String matchingStrategy, final boolean ignoreCase) { switch (matchingStrategy) { case startsWithValue: - return line.toLowerCase().startsWith(((String) comparison).toLowerCase()); + if (ignoreCase) { + return line.toLowerCase().startsWith(((String) comparison).toLowerCase()); + } else { + return line.startsWith((String) comparison); + } case endsWithValue: - return line.toLowerCase().endsWith(((String) comparison).toLowerCase()); + if (ignoreCase) { + return line.toLowerCase().endsWith(((String) comparison).toLowerCase()); + } else { + return line.endsWith((String) comparison); + } case containsValue: - return line.toLowerCase().contains(((String) comparison).toLowerCase()); + if (ignoreCase) { + return line.toLowerCase().contains(((String) comparison).toLowerCase()); + } else { + return line.contains((String) comparison); + } case equalsValue: - return line.equalsIgnoreCase((String) comparison); + if (ignoreCase) { + return line.equalsIgnoreCase((String) comparison); + } else { + return line.equals(comparison); + } case matchesRegularExpressionValue: return ((Pattern) comparison).matcher(line).matches(); case containsRegularExpressionValue: