Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hadoop >> mail # dev >> NullPointerExceptipn in getPos of buffered FsDataInputStream

Copy link to this message
NullPointerExceptipn in getPos of buffered FsDataInputStream
I'm finding funny behaviour in the multifilewordcount example .  The getPos implementation in the RecirdReader is failing for me when the input steam is closed, and throwing a cryptic null pointer exception.

What is the correct behaviour for getPos  in a record reader, and how
should it behave when the underlying stream is null?  It appears this can
happen in the rawlocalfilesystem.  Not sure if its implemented more safely
in DistributedfileSYstem just yet.
   I've found that the getPos in the RawLocalFileSystem's input stream can
throw a null pointer exception if its underlying stream is closed.

I discovered this when playing with a custom record reader.

to patch it, I simply check if a call to "stream.available()" throws an
exception, and if so, I return 0 in the getPos() function.

The existing getPos() implementation is found here:


What should be the correct behaviour of getPos() in the RecordReader?

Jay Vyas