Pārlūkot izejas kodu

HADOOP-6796. Reverting the patch.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@954165 13f79535-47bb-0310-9956-ffa450edef68
Eli Collins 15 gadi atpakaļ
vecāks
revīzija
6749f0275c

+ 0 - 2
CHANGES.txt

@@ -76,8 +76,6 @@ Trunk (unreleased changes)
     HADOOP-6687.   user object in the subject in UGI should be reused in case 
     of a relogin. (jnp via boryas)
 
-    HADOOP-6796. FileStatus allows null srcPath but crashes if that's done. (Rodrigo Schmidt via eli)
-
     HADOOP-6603. Provide workaround for issue with Kerberos not resolving 
     cross-realm principal (Kan Zhang and Jitendra Pandey via jghoman)
 

+ 12 - 19
src/java/org/apache/hadoop/fs/FileStatus.java

@@ -33,19 +33,19 @@ import org.apache.hadoop.io.Writable;
 @InterfaceStability.Stable
 public class FileStatus implements Writable, Comparable {
 
-  private Path path = null;
-  private long length = 0;
-  private boolean isdir = false;
-  private short block_replication = 0;
-  private long blocksize = 0;
-  private long modification_time = 0;
-  private long access_time = 0;
-  private FsPermission permission = null;
-  private String owner = null;
-  private String group = null;
-  private Path symlink = null;
+  private Path path;
+  private long length;
+  private boolean isdir;
+  private short block_replication;
+  private long blocksize;
+  private long modification_time;
+  private long access_time;
+  private FsPermission permission;
+  private String owner;
+  private String group;
+  private Path symlink;
   
-  public FileStatus() {}
+  public FileStatus() { this(0, false, 0, 0, 0, 0, null, null, null, null); }
   
   //We should deprecate this soon?
   public FileStatus(long length, boolean isdir, int block_replication,
@@ -67,12 +67,6 @@ public class FileStatus implements Writable, Comparable {
          access_time, permission, owner, group, null, path);
   }
 
-  private void stateSanityCheck() {
-    if (path == null) {
-      throw new IllegalArgumentException("path cannot be null");
-    }
-  }
-
   public FileStatus(long length, boolean isdir,
                     int block_replication,
                     long blocksize, long modification_time, long access_time,
@@ -91,7 +85,6 @@ public class FileStatus implements Writable, Comparable {
     this.group = (group == null) ? "" : group;
     this.symlink = symlink;
     this.path = path;
-    stateSanityCheck();
   }
 
   /**

+ 0 - 71
src/test/core/org/apache/hadoop/fs/TestFileStatus.java

@@ -1,71 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.fs;
-
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.apache.hadoop.fs.permission.FsPermission;
-
-public class TestFileStatus {
-
-  @Test
-  public void testFileStatusNullPath() throws Exception {
-
-    new FileStatus();
-    new FileStatus(1,false,3,3,4, new Path("/"));  new FileStatus(1,false,5,3,4,5,null,null,null,new Path("/a/b"));
-    new FileStatus(1,false,5,3,4,5,null,null,null,null,new Path("/a/b"));
-    new FileStatus(1,false,5,3,4,5,new FsPermission((short) 7),
-            "bla","bla",new Path ("/b/c"), new Path("/a/b"));
-
-    boolean error = false;
-    try{
-        new FileStatus(1,false,3,3,4, null);
-    } catch (IllegalArgumentException exc) {
-        error = true;
-    }
-
-    assertTrue("Accepted null path", error);
-
-    try {
-      new FileStatus(1,false,5,3,4,5,null,null,null,null);
-    } catch (IllegalArgumentException exc) {
-      error = true;
-    }
-
-    assertTrue("Accepted null path",error);
-
-    try {
-      new FileStatus(1,false,5,3,4,5,null,null,null,null,null);
-    } catch (IllegalArgumentException exc) {
-      error = true;
-    }
-
-    assertTrue("Accepted null path",error);
-
-    try {
-      new FileStatus(1,false,5,3,4,5,new FsPermission((short) 7),
-          "bla","bla",new Path ("/b/c"), null);
-    } catch (IllegalArgumentException exc) {
-      error = true;
-    }
-
-    assertTrue("Accepted null path",error);
-
-  }
-}