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) {
|
protected static boolean lineMatches(final String line, final Object comparison, final String matchingStrategy, final boolean ignoreCase) {
|
||||||
switch (matchingStrategy) {
|
switch (matchingStrategy) {
|
||||||
case startsWithValue:
|
case startsWithValue:
|
||||||
|
if (ignoreCase) {
|
||||||
return line.toLowerCase().startsWith(((String) comparison).toLowerCase());
|
return line.toLowerCase().startsWith(((String) comparison).toLowerCase());
|
||||||
|
} else {
|
||||||
|
return line.startsWith((String) comparison);
|
||||||
|
}
|
||||||
case endsWithValue:
|
case endsWithValue:
|
||||||
|
if (ignoreCase) {
|
||||||
return line.toLowerCase().endsWith(((String) comparison).toLowerCase());
|
return line.toLowerCase().endsWith(((String) comparison).toLowerCase());
|
||||||
|
} else {
|
||||||
|
return line.endsWith((String) comparison);
|
||||||
|
}
|
||||||
case containsValue:
|
case containsValue:
|
||||||
|
if (ignoreCase) {
|
||||||
return line.toLowerCase().contains(((String) comparison).toLowerCase());
|
return line.toLowerCase().contains(((String) comparison).toLowerCase());
|
||||||
|
} else {
|
||||||
|
return line.contains((String) comparison);
|
||||||
|
}
|
||||||
case equalsValue:
|
case equalsValue:
|
||||||
|
if (ignoreCase) {
|
||||||
return line.equalsIgnoreCase((String) comparison);
|
return line.equalsIgnoreCase((String) comparison);
|
||||||
|
} else {
|
||||||
|
return line.equals(comparison);
|
||||||
|
}
|
||||||
case matchesRegularExpressionValue:
|
case matchesRegularExpressionValue:
|
||||||
return ((Pattern) comparison).matcher(line).matches();
|
return ((Pattern) comparison).matcher(line).matches();
|
||||||
case containsRegularExpressionValue:
|
case containsRegularExpressionValue:
|
||||||
|
|
Loading…
Reference in New Issue