FAQ
Fix NullPointerException when certain File APIs return null
-----------------------------------------------------------

Key: HDFS-1934
URL: https://issues.apache.org/jira/browse/HDFS-1934
Project: Hadoop HDFS
Issue Type: Bug
Affects Versions: 0.20.205.0, 0.23.0
Reporter: Bharath Mundlapudi
Assignee: Bharath Mundlapudi
Fix For: 0.20.205.0, 0.23.0


While testing Disk Fail Inplace, We encountered the NPE from this part of the code.

File[] files = dir.listFiles();
for (File f : files) {
...
}

This is kinda of an API issue. When a disk is bad (or name is not a directory), this API (listFiles, list) return null rather than throwing an exception. This 'for loop' throws a NPE exception. And same applies to dir.list() API.

Fix all the places where null condition was not checked.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphdfs-dev @
categorieshadoop
postedMay 13, '11 at 1:21a
activeMay 13, '11 at 1:21a
posts1
users1
websitehadoop.apache.org...
irc#hadoop

1 user in discussion

Bharath Mundlapudi (JIRA): 1 post

People

Translate

site design / logo © 2022 Grokbase