HADOOP-13976. Path globbing does not match newlines. Contributed by Eric Badger.

(cherry picked from commit 706d630eb9)
This commit is contained in:
Kihwal Lee 2017-01-17 15:13:56 -06:00
parent fbcc45c8d1
commit 7d949cc432
2 changed files with 5 additions and 5 deletions

View File

@ -153,7 +153,7 @@ public class GlobPattern {
if (curlyOpen > 0) { if (curlyOpen > 0) {
error("Unclosed group", glob, len); error("Unclosed group", glob, len);
} }
compiled = Pattern.compile(regex.toString()); compiled = Pattern.compile(regex.toString(), Pattern.DOTALL);
} }
/** /**

View File

@ -50,11 +50,11 @@ public class TestGlobPattern {
} }
@Test public void testValidPatterns() { @Test public void testValidPatterns() {
assertMatch(true, "*", "^$", "foo", "bar"); assertMatch(true, "*", "^$", "foo", "bar", "\n");
assertMatch(true, "?", "?", "^", "[", "]", "$"); assertMatch(true, "?", "?", "^", "[", "]", "$");
assertMatch(true, "foo*", "foo", "food", "fool"); assertMatch(true, "foo*", "foo", "food", "fool", "foo\n", "foo\nbar");
assertMatch(true, "f*d", "fud", "food"); assertMatch(true, "f*d", "fud", "food", "foo\nd");
assertMatch(true, "*d", "good", "bad"); assertMatch(true, "*d", "good", "bad", "\nd");
assertMatch(true, "\\*\\?\\[\\{\\\\", "*?[{\\"); assertMatch(true, "\\*\\?\\[\\{\\\\", "*?[{\\");
assertMatch(true, "[]^-]", "]", "-", "^"); assertMatch(true, "[]^-]", "]", "-", "^");
assertMatch(true, "]", "]"); assertMatch(true, "]", "]");