hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r692996 - in /hadoop/core/trunk: CHANGES.txt src/c++/libhdfs/hdfs.c
Date Mon, 08 Sep 2008 06:28:36 GMT
Author: dhruba
Date: Sun Sep  7 23:28:35 2008
New Revision: 692996

URL: http://svn.apache.org/viewvc?rev=692996&view=rev
Log:
HADOOP-3963. libhdfs does not exit on its own, instead it returns error
to the caller and behaves as a true library. (Pete Wyckoff via dhruba)


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=692996&r1=692995&r2=692996&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Sun Sep  7 23:28:35 2008
@@ -475,6 +475,9 @@
     HADOOP-3968. Fix getFileBlockLocations calls to use FileStatus instead
     of Path reflecting the new API. (Pete Wyckoff via lohit)
 
+    HADOOP-3963. libhdfs does not exit on its own, instead it returns error 
+    to the caller and behaves as a true library. (Pete Wyckoff via dhruba)
+
 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=692996&r1=692995&r2=692996&view=diff
==============================================================================
--- hadoop/core/trunk/src/c++/libhdfs/hdfs.c (original)
+++ hadoop/core/trunk/src/c++/libhdfs/hdfs.c Sun Sep  7 23:28:35 2008
@@ -114,7 +114,11 @@
     if (exc == NULL)
         goto default_error;
 
-    excClass = classNameOfObject((jobject) exc, env);
+    if ((excClass = classNameOfObject((jobject) exc, env)) == NULL) {
+      errnum = EINTERNAL;
+      goto done;
+    }
+
     if (!strcmp(excClass, "org.apache.hadoop.fs.permission."
                 "AccessControlException")) {
         errnum = EACCES;
@@ -163,6 +167,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return NULL;
+    }
 
     //Create the org.apache.hadoop.conf.Configuration object
     jConfiguration =
@@ -255,6 +263,11 @@
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
 
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -2;
+    }
+
     //Parameters
     jobject jFS = (jobject)fs;
 
@@ -294,6 +307,11 @@
     /* Get the JNIEnv* corresponding to current thread */
     JNIEnv* env = getJNIEnv();
 
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return NULL;
+    }
+
     jobject jFS = (jobject)fs;
 
     if(flags & O_RDWR) {
@@ -435,6 +453,11 @@
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
 
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -2;
+    }
+
     //Parameters
     jobject jStream = (jobject)(file ? file->file : NULL);
 
@@ -469,6 +492,11 @@
 int hdfsExists(hdfsFS fs, const char *path)
 {
     JNIEnv *env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -2;
+    }
+
     jobject jPath = constructNewObjectOfPath(env, path);
     jvalue  jVal;
     jthrowable jExc = NULL;
@@ -499,6 +527,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     //Parameters
     jobject jInputStream = (jobject)(f ? f->file : NULL);
@@ -556,6 +588,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     //Parameters
     jobject jInputStream = (jobject)(f ? f->file : NULL);
@@ -611,6 +647,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     //Parameters
     jobject jOutputStream = (jobject)(f ? f->file : 0);
@@ -666,6 +706,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     //Parameters
     jobject jInputStream = (jobject)(f ? f->file : 0);
@@ -698,6 +742,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     //Parameters
     jobject jStream = (jobject)(f ? f->file : 0);
@@ -734,6 +782,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     //Parameters
     jobject jOutputStream = (jobject)(f ? f->file : 0);
@@ -766,6 +818,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     //Parameters
     jobject jInputStream = (jobject)(f ? f->file : 0);
@@ -802,6 +858,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     //Parameters
     jobject jSrcFS = (jobject)srcFS;
@@ -869,6 +929,11 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
+
 
     //Parameters
     jobject jSrcFS = (jobject)srcFS;
@@ -937,6 +1002,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     jobject jFS = (jobject)fs;
 
@@ -974,6 +1043,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     jobject jFS = (jobject)fs;
 
@@ -1020,6 +1093,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return NULL;
+    }
 
     jobject jFS = (jobject)fs;
     jobject jPath = NULL;
@@ -1072,6 +1149,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     jobject jFS = (jobject)fs;
     int retval = 0;
@@ -1107,6 +1188,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     jobject jFS = (jobject)fs;
 
@@ -1144,6 +1229,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     jobject jFS = (jobject)fs;
 
@@ -1182,6 +1271,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return NULL;
+    }
 
     jobject jFS = (jobject)fs;
 
@@ -1322,6 +1415,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     jobject jFS = (jobject)fs;
 
@@ -1349,6 +1446,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     jobject jFS = (jobject)fs;
 
@@ -1381,6 +1482,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return -1;
+    }
 
     jobject jFS = (jobject)fs;
 
@@ -1533,6 +1638,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return NULL;
+    }
 
     jobject jFS = (jobject)fs;
 
@@ -1608,6 +1717,10 @@
 
     //Get the JNIEnv* corresponding to current thread
     JNIEnv* env = getJNIEnv();
+    if (env == NULL) {
+      errno = EINTERNAL;
+      return NULL;
+    }
 
     jobject jFS = (jobject)fs;
 



Mime
View raw message