Buggy code:
Option dirOpt = obuilder . withLongName ( "testDir" ) . withRequired ( true ) . withArgument ( abuilder . withName ( "testDir" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . withDescription ( "The<seq2seq4repair_space>directory<seq2seq4repair_space>where<seq2seq4repair_space>test<seq2seq4repair_space>documents<seq2seq4repair_space>resides<seq2seq4repair_space>in" ) . withShortName ( "t" ) . create ( ) ; Option encodingOpt = obuilder . withLongName ( "encoding" ) . withArgument ( abuilder . withName ( "encoding" ) . withMinimum ( 1 ) . withMaximum ( 1 ) . create ( ) ) . withDescription ( "The<seq2seq4repair_space>file<seq2seq4repair_space>encoding.<seq2seq4repair_space>Defaults<seq2seq4repair_space>to<seq2seq4repair_space>UTF-8" ) . withShortName ( "e" ) . create ( ) ; Option analyzerOpt = obuilder . withLongName ( "analyzer" ) . 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" ) . 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:<seq2seq4repair_space>bayes|cbayes" ) . withShortName ( "type" ) . create ( ) ; Group group = gbuilder . withName ( "Options" ) . withOption ( analyzerOpt ) . withOption ( defaultCatOpt ) . withOption ( dirOpt ) . withOption ( encodingOpt ) . withOption ( gramSizeOpt ) . withOption ( pathOpt ) . withOption ( typeOpt ) . create ( ) ; Parser parser = new Parser ( ) ; parser . setGroup ( group ) ; CommandLine cmdLine = parser . parse ( args ) ; JobConf conf = new JobConf ( TestClassifier . 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> TestClassifier . log . info ( "Loading<seq2seq4repair_space>model<seq2seq4repair_space>from:<seq2seq4repair_space>{}" , modelPaths ) ; Model model ; Classifier classifier ; String classifierType = ( ( String ) ( cmdLine . getValue ( typeOpt ) ) ) ; if ( classifierType . equalsIgnoreCase ( "bayes" ) ) { TestClassifier . log . info ( "Testing<seq2seq4repair_space>Bayes<seq2seq4repair_space>Classifier" ) ; model = new BayesModel ( ) ; classifier = new BayesClassifier ( ) ; } else if ( classifierType . equalsIgnoreCase ( "cbayes" ) ) { TestClassifier . log . info ( "Testing<seq2seq4repair_space>Complementary<seq2seq4repair_space>Bayes<seq2seq4repair_space>Classifier" ) ; model = new CBayesModel ( ) ; classifier = new CBayesClassifier ( ) ; } else { throw new IllegalArgumentException ( ( "Unrecognized<seq2seq4repair_space>classifier<seq2seq4repair_space>type:<seq2seq4repair_space>" + classifierType ) ) ; } SequenceFileModelReader . loadModel ( model , fs , modelPaths , conf ) ; TestClassifier . log . info ( "Done<seq2seq4repair_space>loading<seq2seq4repair_space>model:<seq2seq4repair_space>#<seq2seq4repair_space>labels:<seq2seq4repair_space>{}" , model . getLabels ( ) . size ( ) ) ; TestClassifier . log . info ( "Done<seq2seq4repair_space>generating<seq2seq4repair_space>Model" ) ; String defaultCat = "unknown" ; if ( cmdLine . hasOption ( defaultCatOpt ) ) { defaultCat = ( ( String ) ( cmdLine . getValue ( defaultCatOpt ) ) ) ; } String encoding = "UTF-8" ; if ( cmdLine . hasOption ( encodingOpt ) ) { encoding = ( ( String ) ( cmdLine . getValue ( encodingOpt ) ) ) ; } int gramSize = 1 ; if ( cmdLine . hasOption ( gramSizeOpt ) ) { gramSize = Integer . parseInt ( ( ( String ) ( cmdLine . getValue ( gramSizeOpt ) ) ) ) ; } String testDirPath = ( ( String ) ( cmdLine . getValue ( dirOpt ) ) ) ; File dir = new File ( testDirPath ) ; File [ ] subdirs = dir . listFiles ( ) ; ResultAnalyzer resultAnalyzer = new ResultAnalyzer ( model . getLabels ( ) , defaultCat ) ; if ( subdirs != null ) { for ( File subdir : subdirs ) { String correctLabel = subdir . getName ( ) . split ( ".txt" ) [ 0 ] ; BufferedReader fileReader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( subdir . getPath ( ) ) , encoding ) ) ; try { String line ; while ( ( line = fileReader . readLine ( ) ) != null ) { Map < String , List < String > > document = Model . generateNGrams ( line , gramSize ) ; for ( Map . Entry < String , List < String > > stringListEntry : document . entrySet ( ) ) { List < String > strings = stringListEntry . getValue ( ) ; ClassifierResult classifiedLabel = classifier . classify ( model , strings . toArray ( new String [ strings . size ( ) ] ) , defaultCat ) ; resultAnalyzer . addInstance ( correctLabel , classifiedLabel ) ; } } TestClassifier . log . info ( "{}\t{}\t{}//{}"

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