hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lium...@apache.org
Subject hadoop git commit: HADOOP-12856. FileUtil.checkDest() and RawLocalFileSystem.mkdirs() to throw stricter IOEs; RawLocalFS contract tests to verify. Contributed by Steve Loughran
Date Wed, 26 Apr 2017 01:34:08 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 475f933b4 -> d11d280b8


HADOOP-12856. FileUtil.checkDest() and RawLocalFileSystem.mkdirs() to throw stricter IOEs;
RawLocalFS contract tests to verify. Contributed by Steve Loughran


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d11d280b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d11d280b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d11d280b

Branch: refs/heads/trunk
Commit: d11d280b8b527d572ca0b29ef57434e9ff533ffe
Parents: 475f933
Author: Mingliang Liu <liuml07@apache.org>
Authored: Tue Apr 25 18:33:41 2017 -0700
Committer: Mingliang Liu <liuml07@apache.org>
Committed: Tue Apr 25 18:33:41 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/fs/FileUtil.java     |  5 +--
 .../apache/hadoop/fs/RawLocalFileSystem.java    |  2 +-
 .../contract/rawlocal/RawlocalFSContract.java   |  2 +-
 .../src/test/resources/contract/rawlocal.xml    | 32 ++++++++++++++------
 4 files changed, 28 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d11d280b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
index bb70cbd..0b27a7e 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java
@@ -492,11 +492,12 @@ public class FileUtil {
     if (null != sdst) {
       if (sdst.isDirectory()) {
         if (null == srcName) {
-          throw new IOException("Target " + dst + " is a directory");
+          throw new PathIsDirectoryException(dst.toString());
         }
         return checkDest(null, dstFS, new Path(dst, srcName), overwrite);
       } else if (!overwrite) {
-        throw new IOException("Target " + dst + " already exists");
+        throw new PathExistsException(dst.toString(),
+            "Target " + dst + " already exists");
       }
     }
     return dst;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d11d280b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
index 7bf429e..e4e0659 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
@@ -552,7 +552,7 @@ public class RawLocalFileSystem extends FileSystem {
       }
     }
     if (p2f.exists() && !p2f.isDirectory()) {
-      throw new FileNotFoundException("Destination exists" +
+      throw new FileAlreadyExistsException("Destination exists" +
               " and is not a directory: " + p2f.getCanonicalPath());
     }
     return (parent == null || parent2f.exists() || mkdirs(parent)) &&

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d11d280b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/rawlocal/RawlocalFSContract.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/rawlocal/RawlocalFSContract.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/rawlocal/RawlocalFSContract.java
index 0cd32f3..3c49955 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/rawlocal/RawlocalFSContract.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/rawlocal/RawlocalFSContract.java
@@ -34,7 +34,7 @@ public class RawlocalFSContract extends LocalFSContract {
     super(conf);
   }
 
-  public static final String RAW_CONTRACT_XML = "contract/localfs.xml";
+  public static final String RAW_CONTRACT_XML = "contract/rawlocal.xml";
 
   @Override
   protected String getContractXml() {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d11d280b/hadoop-common-project/hadoop-common/src/test/resources/contract/rawlocal.xml
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/resources/contract/rawlocal.xml
b/hadoop-common-project/hadoop-common/src/test/resources/contract/rawlocal.xml
index b51f3d0..a0d1d21 100644
--- a/hadoop-common-project/hadoop-common/src/test/resources/contract/rawlocal.xml
+++ b/hadoop-common-project/hadoop-common/src/test/resources/contract/rawlocal.xml
@@ -17,10 +17,24 @@
   -->
 
 <configuration>
+
+  <!--
+  case sensitivity and permission options are determined at run time from OS type
+  -->
+
+  <property>
+    <name>fs.contract.is-case-sensitive</name>
+    <value>true</value>
+  </property>
+
+
+  <property>
+    <name>fs.contract.supports-unix-permissions</name>
+    <value>true</value>
+  </property>
+
   <!--
-  Here are most of the local FS contract options.
-  some of them may be overridden at run time based on the OS,
-  others potentially generated.
+  The remaining options are static
   -->
 
   <property>
@@ -34,11 +48,6 @@
   </property>
 
   <property>
-    <name>fs.contract.is-case-sensitive</name>
-    <value>true</value>
-  </property>
-
-  <property>
     <name>fs.contract.supports-append</name>
     <value>true</value>
   </property>
@@ -74,6 +83,11 @@
   </property>
 
   <property>
+    <name>fs.contract.rename-remove-dest-if-empty-dir</name>
+    <value>true</value>
+  </property>
+
+  <property>
     <name>fs.contract.supports-seek</name>
     <value>true</value>
   </property>
@@ -108,4 +122,4 @@
     <value>true</value>
   </property>
 
-</configuration>
\ No newline at end of file
+</configuration>


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message