Author: eli
Date: Mon Nov 15 05:05:42 2010
New Revision: 1035147
URL: http://svn.apache.org/viewvc?rev=1035147&view=rev
Log:
HADOOP-7032. Assert type constraints in the FileStatus constructor. Contributed
by Eli Collins
Modified:
hadoop/common/trunk/CHANGES.txt
hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileStatus.java
Modified: hadoop/common/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1035147&r1=1035146&r2=1035147&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Mon Nov 15 05:05:42 2010
@@ -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(..).
Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileStatus.java
URL:
http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileStatus.java?rev=1035147&r1=1035146&r2=1035147&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileStatus.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/FileStatus.java Mon Nov
15 05:05:42 2010
@@ -85,6 +85,11 @@ public class FileStatus implements Writa
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;
}
/**