Преглед на файлове

commit d6e31875ab8888814e3776038943c0cade74b912
Author: Eli Collins <eli@apache.org>
Date: Mon Nov 15 05:05:42 2010 +0000

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


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/yahoo-merge@1079130 13f79535-47bb-0310-9956-ffa450edef68

Owen O'Malley преди 14 години
родител
ревизия
9a682e169e
променени са 2 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 2 0
      CHANGES.txt
  2. 5 0
      src/java/org/apache/hadoop/fs/FileStatus.java

+ 2 - 0
CHANGES.txt

@@ -180,6 +180,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(..).

+ 5 - 0
src/java/org/apache/hadoop/fs/FileStatus.java

@@ -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;
   }
 
   /**