Fix NullPointerException when running FSCK
@@ -250,8 +250,15 @@ public void storeFileDataInDB(byte[] data)
}else{
fid = (FileInodeData) fida.get(getId());
}
- FSNamesystem.LOG.debug("Stuffed Inode: Read file data from the database. Data length is :" + fid.getInodeData().length);
- return fid.getInodeData();
+ if (FSNamesystem.LOG.isDebugEnabled()) {
+ long dataLength = 0;
+ if(fid!=null && fid.getInodeData()!=null){
+ dataLength = fid.getInodeData().length;
+ }
+ FSNamesystem.LOG.debug("Stuffed Inode: Read file data from the database. Data length is :"
+ + dataLength);
+ }
+ return fid == null ? null : fid.getInodeData();
}
public void deleteFileDataStoredInDB() throws StorageException {
