Buggy code:
} } String dictionaryType = getOption ( "dictionaryType" , "text" ) ; boolean sortVectors = hasOption ( "sortVectors" ) ; boolean quiet = hasOption ( "quiet" ) ; if ( ! quiet ) { VectorDumper . log . info ( "Sort?<seq2seq4repair_space>{}" , sortVectors ) ; } String [ ] dictionary = null ; if ( hasOption ( "dictionary" ) ) { String dictFile = getOption ( "dictionary" ) ; if ( "text" . equals ( dictionaryType ) ) { dictionary = VectorHelper . loadTermDictionary ( new File ( dictFile ) ) ; } else if ( "sequencefile" . equals ( dictionaryType ) ) { dictionary = VectorHelper . loadTermDictionary ( conf , dictFile ) ; } else { throw new IOException ( ( "Invalid<seq2seq4repair_space>dictionary<seq2seq4repair_space>type:<seq2seq4repair_space>" + dictionaryType ) ) ; } } Set < String > filters ; if ( hasOption ( "filter" ) ) { filters = Sets . newHashSet ( getOptions ( "filter" ) ) ; } else { filters = null ; } boolean useCSV = hasOption ( "csv" ) ; boolean sizeOnly = hasOption ( "sizeOnly" ) ; boolean nameOnly = hasOption ( "nameOnly" ) ; boolean namesAsComments = hasOption ( "namesAsComments" ) ; boolean transposeKeyValue = hasOption ( "vectorAsKey" ) ; Writer writer ; boolean shouldClose ; File output = getOutputFile ( ) ; if ( output != null ) { shouldClose = true ; writer = Files . newWriter ( output , Charsets . UTF_8 ) ; } else { shouldClose = false ; writer = new OutputStreamWriter ( System . out , Charsets . UTF_8 ) ; } try { boolean printKey = hasOption ( "printKey" ) ; if ( useCSV && ( dictionary != null ) ) { writer . write ( "#" ) ; for ( int j = 0 ; j < ( dictionary . length ) ; j ++ ) { writer . write ( dictionary [ j ] ) ; if ( j < ( ( dictionary . length ) - 1 ) ) { writer . write ( ',' ) ; } } writer . write ( '\n' ) ; } Long numItems = null ; if ( hasOption ( "numItems" ) ) { numItems = Long . parseLong ( getOption ( "numItems" ) ) ; if ( quiet ) { writer . append ( "#Max<seq2seq4repair_space>Items<seq2seq4repair_space>to<seq2seq4repair_space>dump:<seq2seq4repair_space>" ) . append ( String . valueOf ( numItems ) ) . append ( '\n' ) ; } } int maxIndexesPerVector = ( hasOption ( "vectorSize" ) ) ? Integer . parseInt ( getOption ( "vectorSize" ) ) : Integer . MAX_VALUE ; long itemCount = 0 ; int fileCount = 0 ; for ( Path path : pathArr ) { if ( ( numItems != null ) && ( numItems <= itemCount ) ) { break ; } if ( quiet ) { VectorDumper . log . info ( "Processing<seq2seq4repair_space>file<seq2seq4repair_space>'{}'<seq2seq4repair_space>({}//{})" , path , ( ++ fileCount ) , pathArr . length ) ; } SequenceFileIterable < Writable , Writable > iterable = new SequenceFileIterable < Writable , Writable > ( path , true , conf ) ; Iterator < Pair < Writable , Writable > > iterator = iterable . iterator ( ) ; long i = 0 ; while ( ( iterator . hasNext ( ) ) && ( ( numItems == null ) || ( itemCount < numItems ) ) ) { Pair < Writable , Writable > record = iterator . next ( ) ; Writable keyWritable = record . getFirst ( ) ; Writable valueWritable = record . getSecond ( ) ; if ( printKey ) { Writable notTheVectorWritable = ( transposeKeyValue ) ? valueWritable : keyWritable ; writer . write ( notTheVectorWritable . toString ( ) ) ; writer . write ( '\t' ) ; } Vector vector ; try { vector = ( ( org . apache . mahout . math . VectorWritable ) ( transposeKeyValue ? keyWritable : valueWritable ) ) . get ( ) ; } catch ( ClassCastException e ) { if ( ( transposeKeyValue ? keyWritable : valueWritable ) instanceof WeightedPropertyVectorWritable ) { vector = ( ( WeightedPropertyVectorWritable ) ( transposeKeyValue ? keyWritable : valueWritable ) ) . getVector ( ) ; } else { throw e ; } } if ( ( ( filters != null ) && ( vector instanceof NamedVector ) ) && ( ! ( filters . contains ( ( ( NamedVector ) ( vector ) ) . getName ( ) ) ) ) ) { continue ; } if ( sizeOnly ) { if ( vector instanceof NamedVector ) { writer . write ( ( ( NamedVector ) ( vector ) ) . getName ( ) ) ; writer . write ( ":" ) ; } else { writer . write ( String . valueOf ( ( i ++ ) ) ) ; writer . write ( ":" ) ; } writer . write ( String . valueOf ( vector . size ( ) ) ) ; writer . write ( '\n' ) ; } else if ( nameOnly ) { if ( vector instanceof NamedVector ) { writer . write ( ( ( NamedVector ) ( vector ) ) . getName ( ) ) ; writer . write ( '\n' ) ; } } else { String fmtStr ; if ( useCSV ) { fmtStr = VectorHelper . vectorToCSVString ( vector , namesAsComments ) ; } else { fmtStr = VectorHelper . vectorToJson ( vector , dictionary , maxIndexesPerVector , sortVectors ) ; } writer . write ( fmtStr ) ; writer . write ( '\n' ) ; } itemCount ++ ; } } writer . flush ( ) ; } finally { if ( shouldClose ) { <START_BUG> Closeables . closeQuietly ( writer ) ; <END_BUG> } } return 0 ; } public static void main ( String [ ] args ) throws Exception { } }

Fix:
Closeables . close ( writer , true ) ;