Buggy code:
public final class RecommenderJob extends AbstractJob { public static final String BOOLEAN_DATA = "booleanData" ; private static final int DEFAULT_MAX_SIMILARITIES_PER_ITEM = 100 ; private static final int DEFAULT_MAX_PREFS_PER_USER = 1000 ; private static final int DEFAULT_MIN_PREFS_PER_USER = 1 ; @ Override public int run ( String [ ] args ) throws Exception { addInputOption ( ) ; addOutputOption ( ) ; addOption ( "numRecommendations" , "n" , "Number<seq2seq4repair_space>of<seq2seq4repair_space>recommendations<seq2seq4repair_space>per<seq2seq4repair_space>user" , String . valueOf ( DEFAULT_NUM_RECOMMENDATIONS ) ) ; addOption ( "usersFile" , null , "File<seq2seq4repair_space>of<seq2seq4repair_space>users<seq2seq4repair_space>to<seq2seq4repair_space>recommend<seq2seq4repair_space>for" , null ) ; addOption ( "itemsFile" , null , "File<seq2seq4repair_space>of<seq2seq4repair_space>items<seq2seq4repair_space>to<seq2seq4repair_space>recommend<seq2seq4repair_space>for" , null ) ; addOption ( "filterFile" , "f" , ( "File<seq2seq4repair_space>containing<seq2seq4repair_space>comma-separated<seq2seq4repair_space>userID,itemID<seq2seq4repair_space>pairs.<seq2seq4repair_space>Used<seq2seq4repair_space>to<seq2seq4repair_space>exclude<seq2seq4repair_space>the<seq2seq4repair_space>item<seq2seq4repair_space>from<seq2seq4repair_space>" + "the<seq2seq4repair_space>recommendations<seq2seq4repair_space>for<seq2seq4repair_space>that<seq2seq4repair_space>user<seq2seq4repair_space>(optional)" ) , null ) ; addOption ( "booleanData" , "b" , "Treat<seq2seq4repair_space>input<seq2seq4repair_space>as<seq2seq4repair_space>without<seq2seq4repair_space>pref<seq2seq4repair_space>values" , Boolean . FALSE . toString ( ) ) ; addOption ( "maxPrefsPerUser" , "mxp" , "Maximum<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>preferences<seq2seq4repair_space>considered<seq2seq4repair_space>per<seq2seq4repair_space>user<seq2seq4repair_space>in<seq2seq4repair_space>final<seq2seq4repair_space>recommendation<seq2seq4repair_space>phase" , String . valueOf ( DEFAULT_MAX_PREFS_PER_USER_CONSIDERED ) ) ; addOption ( "minPrefsPerUser" , "mp" , ( ( ( "ignore<seq2seq4repair_space>users<seq2seq4repair_space>with<seq2seq4repair_space>less<seq2seq4repair_space>preferences<seq2seq4repair_space>than<seq2seq4repair_space>this<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>similarity<seq2seq4repair_space>computation<seq2seq4repair_space>" + "(default:<seq2seq4repair_space>" ) + ( RecommenderJob . DEFAULT_MIN_PREFS_PER_USER ) ) + ')' ) , String . valueOf ( RecommenderJob . DEFAULT_MIN_PREFS_PER_USER ) ) ; addOption ( "maxSimilaritiesPerItem" , "m" , "Maximum<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>similarities<seq2seq4repair_space>considered<seq2seq4repair_space>per<seq2seq4repair_space>item<seq2seq4repair_space>" , String . valueOf ( RecommenderJob . DEFAULT_MAX_SIMILARITIES_PER_ITEM ) ) ; addOption ( "maxPrefsPerUserInItemSimilarity" , "mppuiis" , ( ( ( "max<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>preferences<seq2seq4repair_space>to<seq2seq4repair_space>consider<seq2seq4repair_space>per<seq2seq4repair_space>user<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>" + "item<seq2seq4repair_space>similarity<seq2seq4repair_space>computation<seq2seq4repair_space>phase,<seq2seq4repair_space>users<seq2seq4repair_space>with<seq2seq4repair_space>more<seq2seq4repair_space>preferences<seq2seq4repair_space>will<seq2seq4repair_space>be<seq2seq4repair_space>sampled<seq2seq4repair_space>down<seq2seq4repair_space>(default:<seq2seq4repair_space>" ) + ( RecommenderJob . DEFAULT_MAX_PREFS_PER_USER ) ) + ')' ) , String . valueOf ( RecommenderJob . DEFAULT_MAX_PREFS_PER_USER ) ) ; addOption ( "similarityClassname" , "s" , ( ( ( "Name<seq2seq4repair_space>of<seq2seq4repair_space>distributed<seq2seq4repair_space>similarity<seq2seq4repair_space>measures<seq2seq4repair_space>class<seq2seq4repair_space>to<seq2seq4repair_space>instantiate,<seq2seq4repair_space>" + "alternatively<seq2seq4repair_space>use<seq2seq4repair_space>one<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>predefined<seq2seq4repair_space>similarities<seq2seq4repair_space>(" ) + ( VectorSimilarityMeasures . list ( ) ) ) + ')' ) , true ) ; addOption ( "threshold" , "tr" , "discard<seq2seq4repair_space>item<seq2seq4repair_space>pairs<seq2seq4repair_space>with<seq2seq4repair_space>a<seq2seq4repair_space>similarity<seq2seq4repair_space>value<seq2seq4repair_space>below<seq2seq4repair_space>this" , false ) ; Map < String , List < String > > parsedArgs = parseArguments ( args ) ; if ( parsedArgs == null ) { return - 1 ; } Path outputPath = getOutputPath ( ) ; int numRecommendations = Integer . parseInt ( getOption ( "numRecommendations" ) ) ; String usersFile = getOption ( "usersFile" ) ; String itemsFile = getOption ( "itemsFile" ) ; String filterFile = getOption ( "filterFile" ) ; boolean booleanData = Boolean . valueOf ( getOption ( "booleanData" ) ) ; int maxPrefsPerUser = Integer . parseInt ( getOption ( "maxPrefsPerUser" ) ) ; int minPrefsPerUser = Integer . parseInt ( getOption ( "minPrefsPerUser" ) ) ; int maxPrefsPerUserInItemSimilarity = Integer . parseInt ( getOption ( "maxPrefsPerUserInItemSimilarity" ) ) ; int maxSimilaritiesPerItem = Integer . parseInt ( getOption ( "maxSimilaritiesPerItem" ) ) ; String similarityClassname = getOption ( "similarityClassname" ) ; <START_BUG> double threshold = ( parsedArgs . containsKey ( "threshold" ) ) ? Double . parseDouble ( getOption ( "threshold" ) ) : RowSimilarityJob . NO_THRESHOLD ; <END_BUG> Path prepPath = getTempPath ( "preparePreferenceMatrix" ) ; Path similarityMatrixPath = getTempPath ( "similarityMatrix" ) ; Path prePartialMultiplyPath1 = getTempPath ( "prePartialMultiply1" ) ; Path prePartialMultiplyPath2 = getTempPath ( "prePartialMultiply2" ) ; Path explicitFilterPath = getTempPath ( "explicitFilterPath" ) ; Path partialMultiplyPath = getTempPath ( "partialMultiply" ) ; AtomicInteger currentPhase = new AtomicInteger ( ) ; int numberOfUsers = - 1 ; if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { ToolRunner . run ( getConf ( ) , new PreparePreferenceMatrixJob ( ) , new String [ ] { "--input" , getInputPath ( ) . toString ( ) , "--output" , prepPath . toString ( ) , "--maxPrefsPerUser" , String . valueOf ( maxPrefsPerUserInItemSimilarity ) , "--minPrefsPerUser" , String . valueOf ( minPrefsPerUser ) , "--booleanData" , String . valueOf ( booleanData ) , "--tempDir" , getTempPath ( ) . toString ( ) } ) ; numberOfUsers = HadoopUtil . readInt ( new Path ( prepPath , PreparePreferenceMatrixJob . NUM_USERS ) , getConf ( ) ) ; } if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { if ( numberOfUsers == ( - 1 ) ) { numberOfUsers = ( ( int ) ( HadoopUtil . countRecords ( new Path ( prepPath , PreparePreferenceMatrixJob . USER_VECTORS ) , LIST , null , getConf ( ) ) ) ) ; } ToolRunner . run ( getConf ( ) , new RowSimilarityJob ( ) , new String [ ] { "--input" , new Path ( prepPath , PreparePreferenceMatrixJob . RATING_MATRIX ) . toString ( ) , "--output" , similarityMatrixPath . toString ( ) , "--numberOfColumns" , String . valueOf ( numberOfUsers ) , "--similarityClassname" , similarityClassname , "--maxSimilaritiesPerRow" , String . valueOf ( maxSimilaritiesPerItem ) , "--excludeSelfSimilarity" , String . valueOf ( Boolean . TRUE ) , "--threshold" , String . valueOf ( threshold ) , "--tempDir" , getTempPath ( ) . toString ( ) } ) ; } if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { Job prePartialMultiply1 = prepareJob ( similarityMatrixPath , prePartialMultiplyPath1 , SequenceFileInputFormat . class , SimilarityMatrixRowWrapperMapper . class , VarIntWritable . class , VectorOrPrefWritable . class , Reducer . class , VarIntWritable . class , VectorOrPrefWritable . class , SequenceFileOutputFormat . class ) ; boolean succeeded = prePartialMultiply1 . waitForCompletion ( true ) ; if ( ! succeeded ) return - 1 ; Job prePartialMultiply2 = prepareJob ( new Path ( prepPath , PreparePreferenceMatrixJob . USER_VECTORS ) , prePartialMultiplyPath2 , SequenceFileInputFormat . class , UserVectorSplitterMapper . class , VarIntWritable . class , VectorOrPrefWritable . class , Reducer . class , VarIntWritable . class , VectorOrPrefWritable . class , SequenceFileOutputFormat . class ) ; if ( usersFile != null ) { prePartialMultiply2 . getConfiguration ( ) . set ( USERS_FILE , usersFile ) ; } prePartialMultiply2 . getConfiguration ( ) . setInt ( MAX_PREFS_PER_USER_CONSIDERED , maxPrefsPerUser ) ; succeeded = prePartialMultiply2 . waitForCompletion ( true ) ; if ( ! succeeded ) return - 1 ; Job partialMultiply = prepareJob ( new Path ( ( ( prePartialMultiplyPath1 + "," ) + prePartialMultiplyPath2 ) ) , partialMultiplyPath , SequenceFileInputFormat . class , Mapper . class , VarIntWritable . class , VectorOrPrefWritable . class , ToVectorAndPrefReducer . class , VarIntWritable . class , VectorAndPrefsWritable . class , SequenceFileOutputFormat . class ) ;

Fix:
double threshold = ( hasOption ( "threshold" ) ) ? Double . parseDouble ( getOption ( "threshold" ) ) : RowSimilarityJob . NO_THRESHOLD ;