You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by lo...@apache.org on 2008/09/06 20:08:44 UTC

svn commit: r692700 - in /hadoop/core/trunk: CHANGES.txt src/c++/libhdfs/hdfs.c

Author: lohit
Date: Sat Sep  6 11:08:44 2008
New Revision: 692700

URL: http://svn.apache.org/viewvc?rev=692700&view=rev
Log:
HADOOP-3968. Fix getFileBlockLocations calls to use FileStatus instead of Path reflecting the new API. (Pete Wyckoff via lohit)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/c++/libhdfs/hdfs.c

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=692700&r1=692699&r2=692700&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Sat Sep  6 11:08:44 2008
@@ -472,6 +472,9 @@
     HADOOP-4078. Create test files for TestKosmosFileSystem in separate
     directory under test.build.data. (lohit)
 
+    HADOOP-3968. Fix getFileBlockLocations calls to use FileStatus instead
+    of Path reflecting the new API. (Pete Wyckoff via lohit)
+
 Release 0.18.1 - Unreleased
 
   BUG FIXES

Modified: hadoop/core/trunk/src/c++/libhdfs/hdfs.c
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/c%2B%2B/libhdfs/hdfs.c?rev=692700&r1=692699&r2=692700&view=diff
==============================================================================
--- hadoop/core/trunk/src/c++/libhdfs/hdfs.c (original)
+++ hadoop/core/trunk/src/c++/libhdfs/hdfs.c Sat Sep  6 11:08:44 2008
@@ -1191,6 +1191,20 @@
         return NULL;
     }
 
+    jvalue jFSVal;
+    jthrowable jFSExc = NULL;
+    if (invokeMethod(env, &jFSVal, &jFSExc, INSTANCE, jFS,
+                     HADOOP_FS, "getFileStatus", 
+                     "(Lorg/apache/hadoop/fs/Path;)"
+                     "Lorg/apache/hadoop/fs/FileStatus;",
+                     jPath) != 0) {
+        errno = errnoFromException(jFSExc, env, "org.apache.hadoop.fs."
+                                   "FileSystem::getFileStatus");
+        destroyLocalReference(env, jPath);
+        return NULL;
+    }
+    jobject jFileStatus = jFSVal.l;
+
     //org.apache.hadoop.fs.FileSystem::getFileBlockLocations
     char*** blockHosts = NULL;
     jobjectArray jBlockLocations;;
@@ -1198,12 +1212,13 @@
     jthrowable jExc = NULL;
     if (invokeMethod(env, &jVal, &jExc, INSTANCE, jFS,
                      HADOOP_FS, "getFileBlockLocations", 
-                     "(Lorg/apache/hadoop/fs/Path;JJ)"
+                     "(Lorg/apache/hadoop/fs/FileStatus;JJ)"
                      "[Lorg/apache/hadoop/fs/BlockLocation;",
-                     jPath, start, length) != 0) {
+                     jFileStatus, start, length) != 0) {
         errno = errnoFromException(jExc, env, "org.apache.hadoop.fs."
-                                   "FileSystem::getFileCacheHints");
+                                   "FileSystem::getFileBlockLocations");
         destroyLocalReference(env, jPath);
+        destroyLocalReference(env, jFileStatus);
         return NULL;
     }
     jBlockLocations = jVal.l;
@@ -1237,6 +1252,7 @@
             errno = errnoFromException(jExc, env, "org.apache.hadoop.fs."
                                        "BlockLocation::getHosts");
             destroyLocalReference(env, jPath);
+            destroyLocalReference(env, jFileStatus);
             destroyLocalReference(env, jBlockLocations);
             return NULL;
         }
@@ -1279,6 +1295,7 @@
 
     //Delete unnecessary local references
     destroyLocalReference(env, jPath);
+    destroyLocalReference(env, jFileStatus);
     destroyLocalReference(env, jBlockLocations);
 
     return blockHosts;