HADOOP-13976. Path globbing does not match newlines. Contributed by Eric Badger.
This commit is contained in:
parent
695f110f93
commit
706d630eb9
@ -153,7 +153,7 @@ public void set(String glob) {
|
||||
if (curlyOpen > 0) {
|
||||
error("Unclosed group", glob, len);
|
||||
}
|
||||
compiled = Pattern.compile(regex.toString());
|
||||
compiled = Pattern.compile(regex.toString(), Pattern.DOTALL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,11 +50,11 @@ private void shouldThrow(String... globs) {
|
||||
}
|
||||
|
||||
@Test public void testValidPatterns() {
|
||||
assertMatch(true, "*", "^$", "foo", "bar");
|
||||
assertMatch(true, "*", "^$", "foo", "bar", "\n");
|
||||
assertMatch(true, "?", "?", "^", "[", "]", "$");
|
||||
assertMatch(true, "foo*", "foo", "food", "fool");
|
||||
assertMatch(true, "f*d", "fud", "food");
|
||||
assertMatch(true, "*d", "good", "bad");
|
||||
assertMatch(true, "foo*", "foo", "food", "fool", "foo\n", "foo\nbar");
|
||||
assertMatch(true, "f*d", "fud", "food", "foo\nd");
|
||||
assertMatch(true, "*d", "good", "bad", "\nd");
|
||||
assertMatch(true, "\\*\\?\\[\\{\\\\", "*?[{\\");
|
||||
assertMatch(true, "[]^-]", "]", "-", "^");
|
||||
assertMatch(true, "]", "]");
|
||||
|
Loading…
Reference in New Issue
Block a user