diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 23e070a01e..2bc5970ac5 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -122,6 +122,8 @@ Trunk (Unreleased)
HADOOP-8864. Addendum to HADOOP-8840: Add a coloring case for +0 results
too. (harsh)
+ HADOOP-8910. Add examples to GlobExpander#expand method. (suresh)
+
BUG FIXES
HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName.
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
index e780812983..a2bf0f2efe 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
@@ -1391,11 +1391,11 @@ public ContentSummary getContentSummary(Path f) throws IOException {
}
final private static PathFilter DEFAULT_FILTER = new PathFilter() {
- @Override
- public boolean accept(Path file) {
- return true;
- }
- };
+ @Override
+ public boolean accept(Path file) {
+ return true;
+ }
+ };
/**
* List the statuses of the files/directories in the given path if the path is
@@ -1559,17 +1559,16 @@ public FileStatus[] globStatus(Path pathPattern) throws IOException {
}
/**
- * Return an array of FileStatus objects whose path names match pathPattern
- * and is accepted by the user-supplied path filter. Results are sorted by
- * their path names.
- * Return null if pathPattern has no glob and the path does not exist.
- * Return an empty array if pathPattern has a glob and no path matches it.
+ * Return an array of FileStatus objects whose path names match
+ * {@code pathPattern} and is accepted by the user-supplied path filter.
+ * Results are sorted by their path names.
*
- * @param pathPattern
- * a regular expression specifying the path pattern
- * @param filter
- * a user-supplied path filter
- * @return an array of FileStatus objects
+ * @param pathPattern a regular expression specifying the path pattern
+ * @param filter a user-supplied path filter
+ * @return null if {@code pathPattern} has no glob and the path does not exist
+ * an empty array if {@code pathPattern} has a glob and no path
+ * matches it else an array of {@link FileStatus} objects matching the
+ * pattern
* @throws IOException if any I/O error occurs when fetching file status
*/
public FileStatus[] globStatus(Path pathPattern, PathFilter filter)
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobExpander.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobExpander.java
index ef514ca2c4..dff8b70ca9 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobExpander.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobExpander.java
@@ -39,12 +39,26 @@ public StringWithOffset(String string, int offset) {
}
/**
- * Expand globs in the given filePattern
into a collection of
- * file patterns so that in the expanded set no file pattern has a
- * slash character ("/") in a curly bracket pair.
+ * Expand globs in the given filePattern
into a collection of
+ * file patterns so that in the expanded set no file pattern has a slash
+ * character ("/") in a curly bracket pair.
+ *
+ * Some examples of how the filePattern is expanded:
+ *
+ * + * filePattern - Expanded file pattern + * {a/b} - a/b + * /}{a/b} - /}a/b + * p{a/b,c/d}s - pa/bs, pc/ds + * {a/b,c/d,{e,f}} - a/b, c/d, {e,f} + * {a/b,c/d}{e,f} - a/b{e,f}, c/d{e,f} + * {a,b}/{b,{c/d,e/f}} - {a,b}/b, {a,b}/c/d, {a,b}/e/f + * {a,b}/{c/\d} - {a,b}/c/d + *+ * * @param filePattern * @return expanded file patterns - * @throws IOException + * @throws IOException */ public static List
filePattern
.
- * @param filePattern
+ * @param filePatternWithOffset
* @return expanded file patterns
* @throws IOException
*/