NIFI-1343: Make comparisons case sensitive if configured to do so. This closes #153.

Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
Mark Payne 2016-01-01 13:16:44 -05:00 committed by joewitt
parent 8e031c987b
commit 02b325b07e
1 changed files with 20 additions and 4 deletions

View File

@ -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:
if (ignoreCase) {
return line.toLowerCase().startsWith(((String) comparison).toLowerCase());
} else {
return line.startsWith((String) comparison);
}
case endsWithValue:
if (ignoreCase) {
return line.toLowerCase().endsWith(((String) comparison).toLowerCase());
} else {
return line.endsWith((String) comparison);
}
case containsValue:
if (ignoreCase) {
return line.toLowerCase().contains(((String) comparison).toLowerCase());
} else {
return line.contains((String) comparison);
}
case equalsValue:
if (ignoreCase) {
return line.equalsIgnoreCase((String) comparison);
} else {
return line.equals(comparison);
}
case matchesRegularExpressionValue:
return ((Pattern) comparison).matcher(line).matches();
case containsRegularExpressionValue: