Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
The documentation says it returns NULL on error, but it could also return NULL when the directory is empty.
/**
- hdfsListDirectory - Get list of files/directories for a given
- directory-path. hdfsFreeFileInfo should be called to deallocate memory.
- @param fs The configured filesystem handle.
- @param path The path of the directory.
- @param numEntries Set to the number of files/directories in path.
- @return Returns a dynamically-allocated array of hdfsFileInfo
- objects; NULL on error.
*/hdfsFileInfo *pathList = NULL; ... //Figure out the number of entries in that directory jPathListSize = (*env)->GetArrayLength(env, jPathList); if (jPathListSize == 0) { ret = 0; goto done; } ... if (ret) { hdfsFreeFileInfo(pathList, jPathListSize); errno = ret; return NULL; } *numEntries = jPathListSize; return pathList;
Either change the implementation to match the doc, or fix the doc to match the implementation.