hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zheng Shao (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HDFS-1154) libhdfs::hdfsExists should return different value in case of 1. error and 2. file does not exist
Date Fri, 14 May 2010 04:34:43 GMT

    [ https://issues.apache.org/jira/browse/HDFS-1154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12867389#action_12867389
] 

Zheng Shao commented on HDFS-1154:
----------------------------------

Current code looks like this:

{code}
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;
    jobject jFS = (jobject)fs;

    if (jPath == NULL) {
        return -1;
    }

    if (invokeMethod(env, &jVal, &jExc, INSTANCE, jFS, HADOOP_FS,
                     "exists", JMETHOD1(JPARAM(HADOOP_PATH), "Z"),
                     jPath) != 0) {
        errno = errnoFromException(jExc, env, "org.apache.hadoop.fs."
                                   "FileSystem::exists");
        destroyLocalReference(env, jPath);
        return -1;
    }

    destroyLocalReference(env, jPath);
    return jVal.z ? 0 : -1;
}

{code}


I will change it to:

{code}
    return jVal.z ? 0 : 1;
{code}


> libhdfs::hdfsExists should return different value in case of 1. error and 2. file does
not exist
> ------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-1154
>                 URL: https://issues.apache.org/jira/browse/HDFS-1154
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: Zheng Shao
>            Assignee: Zheng Shao
>
> Now the code always return "-1" for those cases. There is no way for the application
know which is which.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message