Buggy code:
Option classifyOpt = obuilder . withLongName ( "classify" ) . withRequired ( true ) . withArgument ( abuilder . withName ( "classify" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . withDescription ( "The<seq2seq4repair_space>doc<seq2seq4repair_space>to<seq2seq4repair_space>classify" ) . withShortName ( "" ) . create ( ) ; Option encodingOpt = obuilder . withLongName ( "encoding" ) . withRequired ( true ) . withArgument ( abuilder . withName ( "encoding" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . withDescription ( "The<seq2seq4repair_space>file<seq2seq4repair_space>encoding.<seq2seq4repair_space>Default:<seq2seq4repair_space>UTF-8" ) . withShortName ( "e" ) . create ( ) ; Option analyzerOpt = obuilder . withLongName ( "analyzer" ) . withRequired ( true ) . withArgument ( abuilder . withName ( "analyzer" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . withDescription ( "The<seq2seq4repair_space>Analyzer<seq2seq4repair_space>to<seq2seq4repair_space>use" ) . withShortName ( "a" ) . create ( ) ; Option defaultCatOpt = obuilder . withLongName ( "defaultCat" ) . withRequired ( true ) . withArgument ( abuilder . withName ( "defaultCat" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . withDescription ( "The<seq2seq4repair_space>default<seq2seq4repair_space>category" ) . withShortName ( "d" ) . create ( ) ; Option gramSizeOpt = obuilder . withLongName ( "gramSize" ) . withRequired ( true ) . withArgument ( abuilder . withName ( "gramSize" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . withDescription ( "Size<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>n-gram" ) . withShortName ( "ng" ) . create ( ) ; Option typeOpt = obuilder . withLongName ( "classifierType" ) . withRequired ( true ) . withArgument ( abuilder . withName ( "classifierType" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . withDescription ( "Type<seq2seq4repair_space>of<seq2seq4repair_space>classifier" ) . withShortName ( "type" ) . create ( ) ; Group options = gbuilder . withName ( "Options" ) . withOption ( pathOpt ) . withOption ( classifyOpt ) . withOption ( encodingOpt ) . withOption ( analyzerOpt ) . withOption ( defaultCatOpt ) . withOption ( gramSizeOpt ) . withOption ( typeOpt ) . create ( ) ; Parser parser = new Parser ( ) ; parser . setGroup ( options ) ; CommandLine cmdLine = parser . parse ( args ) ; JobConf conf = new JobConf ( Classify . class ) ; Map < String , Path > modelPaths = new HashMap < String , Path > ( ) ; String modelBasePath = ( ( String ) ( cmdLine . getValue ( pathOpt ) ) ) ; modelPaths . put ( "sigma_j" , new Path ( ( modelBasePath + "//trainer-weights//Sigma_j//part-*" ) ) ) ; modelPaths . put ( "sigma_k" , new Path ( ( modelBasePath + "//trainer-weights//Sigma_k//part-*" ) ) ) ; modelPaths . put ( "sigma_kSigma_j" , new Path ( ( modelBasePath + "//trainer-weights//Sigma_kSigma_j//part-*" ) ) ) ; modelPaths . put ( "thetaNormalizer" , new Path ( ( modelBasePath + "//trainer-thetaNormalizer//part-*" ) ) ) ; modelPaths . put ( "weight" , new Path ( ( modelBasePath + "//trainer-tfIdf//trainer-tfIdf//part-*" ) ) ) ; <START_BUG> FileSystem fs = FileSystem . get ( conf ) ; <END_BUG> Classify . log . info ( "Loading<seq2seq4repair_space>model<seq2seq4repair_space>from:<seq2seq4repair_space>{}" , modelPaths ) ; Model model ; String classifierType = ( ( String ) ( cmdLine . getValue ( typeOpt ) ) ) ; if ( classifierType . equalsIgnoreCase ( "bayes" ) ) { Classify . log . info ( "Testing<seq2seq4repair_space>Bayes<seq2seq4repair_space>Classifier" ) ; model = new BayesModel ( ) ; } else if ( classifierType . equalsIgnoreCase ( "cbayes" ) ) { Classify . log . info ( "Testing<seq2seq4repair_space>Complementary<seq2seq4repair_space>Bayes<seq2seq4repair_space>Classifier" ) ; model = new CBayesModel ( ) ; } else { throw new IllegalArgumentException ( ( "Unrecognized<seq2seq4repair_space>classifier<seq2seq4repair_space>type:<seq2seq4repair_space>" + classifierType ) ) ; } Classifier classifier = new BayesClassifier ( ) ; SequenceFileModelReader . loadModel ( model , fs , modelPaths , conf ) ; Classify . log . info ( "Done<seq2seq4repair_space>loading<seq2seq4repair_space>model:<seq2seq4repair_space>#<seq2seq4repair_space>labels:<seq2seq4repair_space>{}" , model . getLabels ( ) . size ( ) ) ; Classify . log . info ( "Done<seq2seq4repair_space>generating<seq2seq4repair_space>Model" ) ; String defaultCat = "unknown" ; if ( cmdLine . hasOption ( defaultCatOpt ) ) { defaultCat = ( ( String ) ( cmdLine . getValue ( defaultCatOpt ) ) ) ; } File docPath = new File ( ( ( String ) ( cmdLine . getValue ( classifyOpt ) ) ) ) ; String encoding = "UTF-8" ; if ( cmdLine . hasOption ( encodingOpt ) ) { encoding = ( ( String ) ( cmdLine . getValue ( encodingOpt ) ) ) ; } Analyzer analyzer = null ; if ( cmdLine . hasOption ( analyzerOpt ) ) { String className = ( ( String ) ( cmdLine . getValue ( analyzerOpt ) ) ) ; analyzer = Class . forName ( className ) . asSubclass ( Analyzer . class ) . newInstance ( ) ; } if ( analyzer == null ) { analyzer = new StandardAnalyzer ( ) ; } int gramSize = 1 ; if ( cmdLine . hasOption ( gramSizeOpt ) ) { gramSize = Integer . parseInt ( ( ( String ) ( cmdLine . getValue ( gramSizeOpt ) ) ) ) ; } Classify . log . info ( "Converting<seq2seq4repair_space>input<seq2seq4repair_space>document<seq2seq4repair_space>to<seq2seq4repair_space>proper<seq2seq4repair_space>format" ) ; String [ ] document = BayesFileFormatter . readerToDocument ( analyzer , new InputStreamReader ( new FileInputStream ( docPath ) , Charset . forName ( encoding ) ) ) ; StringBuilder line = new StringBuilder ( ) ; for ( String token : document ) { line . append ( token ) . append ( '<seq2seq4repair_space>' ) ; } List < String > doc = Model . generateNGramsWithoutLabel ( line . toString ( ) , gramSize ) ; Classify . log . info ( "Done<seq2seq4repair_space>converting" ) ; Classify . log . info ( "Classifying<seq2seq4repair_space>document:<seq2seq4repair_space>{}" , docPath ) ; ClassifierResult category = classifier . classify ( model , doc . toArray ( new String [ doc . size ( ) ] ) , defaultCat ) ; Classify . log . info ( "Category<seq2seq4repair_space>for<seq2seq4repair_space>{}<seq2seq4repair_space>is<seq2seq4repair_space>{}"

Fix:
FileSystem fs = FileSystem . get ( new Path ( modelBasePath ) . toUri ( ) , conf ) ;