HADOOP-7032. Assert type constraints in the FileStatus constructor. Contributed by Eli Collins

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1035147 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2010-11-15 05:05:42 +00:00
parent 05a497f35a
commit ee08b2c803
2 changed files with 7 additions and 0 deletions

View File

@ -175,6 +175,8 @@ Trunk (unreleased changes)
HADOOP-7034. Add TestPath tests to cover dot, dot dot, and slash normalization. (eli)
HADOOP-7032. Assert type constraints in the FileStatus constructor. (eli)
OPTIMIZATIONS
HADOOP-6884. Add LOG.isDebugEnabled() guard for each LOG.debug(..).

View File

@ -85,6 +85,11 @@ public class FileStatus implements Writable, Comparable {
this.group = (group == null) ? "" : group;
this.symlink = symlink;
this.path = path;
// The variables isdir and symlink indicate the type:
// 1. isdir implies directory, in which case symlink must be null.
// 2. !isdir implies a file or symlink, symlink != null implies a
// symlink, otherwise it's a file.
assert (isdir && symlink == null) || !isdir;
}
/**