private CorruptFileBlocks methodBasedListCorruptFileBlocks ( String path , String cookie ) throws IOException { if ( ! namenodeProtocolProxy . isMethodSupported ( "listCorruptFileBlocks" , String . class , String . class ) ) { LOG . info ( "NameNode version is " + namenodeVersion + " Using older version of getCorruptFiles." ) ; if ( cookie != null ) { return new CorruptFileBlocks ( new String [ 0 ] , "" ) ; } ArrayList < String > str = new ArrayList < String > ( ) ; for ( FileStatus stat : namenode . getCorruptFiles ( ) ) { String filename = stat . getPath ( ) . toUri ( ) . getPath ( ) ; if ( filename . startsWith ( path ) ) { str . add ( filename ) ; } } return new CorruptFileBlocks ( str . toArray ( new String [ str . size ( ) ] ) , "" ) ; } return namenode . listCorruptFileBlocks ( path , cookie ) ; }
Method based listCorruptFileBlocks