mirror of https://github.com/apache/nifi.git
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:
parent
8e031c987b
commit
02b325b07e
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue