Return-Path: Delivered-To: apmail-hadoop-core-commits-archive@www.apache.org Received: (qmail 56763 invoked from network); 8 Sep 2008 06:29:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Sep 2008 06:29:28 -0000 Received: (qmail 96449 invoked by uid 500); 8 Sep 2008 06:29:25 -0000 Delivered-To: apmail-hadoop-core-commits-archive@hadoop.apache.org Received: (qmail 96421 invoked by uid 500); 8 Sep 2008 06:29:25 -0000 Mailing-List: contact core-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-commits@hadoop.apache.org Received: (qmail 96412 invoked by uid 99); 8 Sep 2008 06:29:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Sep 2008 23:29:25 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2008 06:28:35 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C274123889BB; Sun, 7 Sep 2008 23:28:36 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r692996 - in /hadoop/core/trunk: CHANGES.txt src/c++/libhdfs/hdfs.c Date: Mon, 08 Sep 2008 06:28:36 -0000 To: core-commits@hadoop.apache.org From: dhruba@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080908062836.C274123889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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;