code: List<LocatedBlock> corruptBlocksInFile(
      DistributedFileSystem fs, String uriPath, FileStatus stat)
    throws IOException {
      List<LocatedBlock> corrupt = new LinkedList<LocatedBlock>();
      LocatedBlocks locatedBlocks = fs.getClient().namenode.getBlockLocations(
        uriPath, 0, stat.getLen());
      for (LocatedBlock b: locatedBlocks.getLocatedBlocks()) {
        if (b.isCorrupt() || 
           (b.getLocations().length == 0 && b.getBlockSize() > 0)) {
          LOG.info("Adding bad block for file " + uriPath);
          corrupt.add(b);
        }
      }
      return corrupt;
    }
docs: Returns the corrupt blocks in a file.