svn merge -c 1349088 from trunk for HDFS-3522. If a namenode is in safemode, it should throw SafeModeException when getBlockLocations has zero locations.