Browse Source

HADOOP-5579. Set errno correctly in libhdfs for permission, quota, and FNF
conditions. Contributed by Brian Bockelman


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.19@772484 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 16 năm trước cách đây
mục cha
commit
b2e9bc2aff
2 tập tin đã thay đổi với 15 bổ sung1 xóa
  1. 3 0
      CHANGES.txt
  2. 12 1
      src/c++/libhdfs/hdfs.c

+ 3 - 0
CHANGES.txt

@@ -108,6 +108,9 @@ Release 0.19.2 - Unreleased
     was used and user closed a output stream without writing any data.
     (Zheng Shao via dhruba)
 
+    HADOOP-5579. Set errno correctly in libhdfs for permission, quota, and FNF
+    conditions. (Brian Bockelman via cdouglas)
+
 Release 0.19.1 - 2009-02-23 
 
     HADOOP-5225. Workaround for tmp file handling in HDFS. sync() is 

+ 12 - 1
src/c++/libhdfs/hdfs.c

@@ -124,12 +124,23 @@ static int errnoFromException(jthrowable exc, JNIEnv *env,
       goto done;
     }
 
-    if (!strcmp(excClass, "org.apache.hadoop.fs.permission."
+    if (!strcmp(excClass, "org.apache.hadoop.security."
                 "AccessControlException")) {
         errnum = EACCES;
         goto done;
     }
 
+    if (!strcmp(excClass, "org.apache.hadoop.hdfs.protocol."
+                "QuotaExceededException")) {
+        errnum = EDQUOT;
+        goto done;
+    }
+
+    if (!strcmp(excClass, "java.io.FileNotFoundException")) {
+        errnum = ENOENT;
+        goto done;
+    }
+
     //TODO: interpret more exceptions; maybe examine exc.getMessage()
 
 default_error: