BlockMissingException extends IOException { public BlockMissingException(String filename, String description, long offset) { super(description); this.filename = filename; this.offset = offset; } BlockMissingException(String filename, String description,
      long offset); String getFile(); long getOffset();  }
@Test public void testBlockMissingException() throws Exception { LOG.info("Test testBlockMissingException started."); long blockSize = 1024L; int numBlocks = 4; conf = new HdfsConfiguration(); conf.setInt(HdfsClientConfigKeys.Retry.WINDOW_BASE_KEY, 10); try { dfs = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_DATANODES).build(); dfs.waitActive(); fileSys = (DistributedFileSystem) dfs.getFileSystem(); Path file1 = new Path("/user/dhruba/raidtest/file1"); createOldFile(fileSys, file1, 1, numBlocks, blockSize); LocatedBlocks locations = null; locations = fileSys.dfs.getNamenode() .getBlockLocations(file1.toString(), 0, numBlocks * blockSize); LOG.info("Remove first block of file"); corruptBlock(file1, locations.get(0).getBlock()); validateFile(fileSys, file1); } finally { if (fileSys != null) { fileSys.close(); } if (dfs != null) { dfs.shutdown(); } } LOG.info("Test testBlockMissingException completed."); }