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:
parent
05a497f35a
commit
ee08b2c803
@ -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(..).
|
||||
|
@ -85,6 +85,11 @@ public FileStatus(long length, boolean isdir,
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user