Buggy code:
public class RuleFileBuilder extends Configured implements Tool { private RuleFilter ruleFilter ; private PatternInstanceCreator2 patternInstanceCreator ; public RuleFileBuilder ( String filterConfig ) throws FileNotFoundException , IOException { } private static byte [ ] object2ByteArray ( Writable obj ) throws IOException { } private static ArrayWritable convertValueBytes ( ByteBuffer bytes ) { } Set < Rule > getSourceRuleInstances ( String patternFile , String testFile ) throws FileNotFoundException , IOException { } private List < PairWritable3 > getRules ( String patternFile , String testFile , String hfile ) throws IOException { } private Set < Rule > getAsciiConstraints ( String filename ) throws IOException { } private Set < Integer > getAsciiVocab ( String filename ) throws IOException { } private Set < Integer > getTestVocab ( String testFile ) throws FileNotFoundException , IOException { } private List < PairWritable3 > getAsciiOovDeletionRules ( String testFile , String hfile , String asciiConstraints ) throws IOException { } List < PairWritable3 > getGlueRules ( ) { } public int run ( String [ ] args ) throws IOException { Properties p = new Properties ( ) ; try { p . load ( new FileInputStream ( args [ 0 ] ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } String testFile = p . getProperty ( "testfile" ) ; if ( testFile == null ) { System . err . println ( "Missing<seq2seq4repair_space>property<seq2seq4repair_space>'testfile'<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config" ) ; System . exit ( 1 ) ; } Integer maxSourcePhrase = Integer . parseInt ( p . getProperty ( "max_source_phrase" ) ) ; if ( maxSourcePhrase == null ) { System . err . println ( "Missing<seq2seq4repair_space>property<seq2seq4repair_space>'max_source_phrase'<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config" ) ; } String patternFile = p . getProperty ( "patternfile" ) ; if ( patternFile == null ) { System . err . println ( "Missing<seq2seq4repair_space>property<seq2seq4repair_space>'patternfile'<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config" ) ; System . exit ( 1 ) ; } String outRuleFile = p . getProperty ( "outrulefile" ) ; if ( outRuleFile == null ) { System . err . println ( "Missing<seq2seq4repair_space>property<seq2seq4repair_space>'outrulefile'<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config" ) ; System . exit ( 1 ) ; } String hfile = p . getProperty ( "hfile" ) ; if ( hfile == null ) { System . err . println ( "Missing<seq2seq4repair_space>property<seq2seq4repair_space>'hfile'<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config" ) ; System . exit ( 1 ) ; } List < PairWritable3 > rules = getRules ( patternFile , testFile , hfile ) ; String source2TargetLexicalModel = p . getProperty ( "source2target_lexical_model" ) ; if ( source2TargetLexicalModel == null ) { System . err . println ( ( "Missing<seq2seq4repair_space>property<seq2seq4repair_space>" + "'source2target_lexical_model'<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config" ) ) ; System . exit ( 1 ) ; } String target2SourceLexicalModel = p . getProperty ( "target2source_lexical_model" ) ; if ( target2SourceLexicalModel == null ) { System . err . println ( ( "Missing<seq2seq4repair_space>property<seq2seq4repair_space>" + "'target2source_lexical_model'<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config" ) ) ; System . exit ( 1 ) ; } String selectedFeaturesString = p . getProperty ( "features" ) ; if ( selectedFeaturesString == null ) { System . err . println ( "Missing<seq2seq4repair_space>property<seq2seq4repair_space>'features'<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config" ) ; System . exit ( 1 ) ; } String [ ] selectedFeatures = selectedFeaturesString . split ( "," ) ; FeatureCreator featureCreator = new FeatureCreator ( source2TargetLexicalModel , target2SourceLexicalModel , rules , selectedFeatures ) ; List < PairWritable3 > rulesWithFeatures = featureCreator . createFeatures ( rules ) ; String asciiConstraints = p . getProperty ( "ascii_constraints" ) ; if ( asciiConstraints == null ) { System . err . println ( "Missing<seq2seq4repair_space>property<seq2seq4repair_space>'ascii_constraints'<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config" ) ; System . exit ( 1 ) ; } List < PairWritable3 > asciiOovDeletionRules = getAsciiOovDeletionRules ( testFile , hfile , asciiConstraints ) ; List < PairWritable3 > asciiOovDeletionRulesWithFeatures = featureCreator . createFeaturesAsciiOovDeletion ( asciiOovDeletionRules ) ; List < PairWritable3 > glueRules = getGlueRules ( ) ; List < PairWritable3 > glueRulesWithFeatures = featureCreator . createFeaturesGlueRules ( glueRules ) ; try ( BufferedOutputStream bos = new BufferedOutputStream ( new GZIPOutputStream ( new FileOutputStream ( outRuleFile ) ) ) ) { Set < Rule > asciiRules = getAsciiConstraints ( asciiConstraints ) ; for ( PairWritable3 ruleWithFeatures : rulesWithFeatures ) { <START_BUG> Rule checkNotAscii = new Rule ( ruleWithFeatures . first ) ; <END_BUG> if ( asciiRules . contains ( checkNotAscii ) ) { System . err . println ( ( "Ascii<seq2seq4repair_space>rule<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>extracted:<seq2seq4repair_space>" + ( checkNotAscii . toString ( ) ) ) ) ; continue ; } bos . write ( ruleWithFeatures . first . toString ( ) . getBytes ( ) ) ; Writable [ ] features = ruleWithFeatures . second . get ( ) ; for ( Writable w : features ) { bos . write ( ( "<seq2seq4repair_space>" + ( w . toString ( ) ) ) . getBytes ( ) ) ; } bos . write ( "\n" . getBytes ( ) ) ; } for ( PairWritable3 asciiOovDeletionRuleWithFeatures : asciiOovDeletionRulesWithFeatures ) { bos . write ( asciiOovDeletionRuleWithFeatures . first . toString ( ) . getBytes ( ) ) ; Writable [ ] features = asciiOovDeletionRuleWithFeatures . second . get ( ) ; for ( Writable w : features ) { bos . write ( ( "<seq2seq4repair_space>" + ( w . toString ( ) ) ) . getBytes ( ) ) ; } bos . write ( "\n" . getBytes ( ) ) ; } for ( PairWritable3 glueRuleWithFeatures : glueRulesWithFeatures ) { bos . write ( glueRuleWithFeatures . first . toString ( ) . getBytes ( ) ) ; Writable [ ] features = glueRuleWithFeatures . second . get ( ) ; for ( Writable w : features ) { bos . write ( ( "<seq2seq4repair_space>" + ( w . toString ( ) ) ) . getBytes ( ) ) ; } bos . write ( "\n" . getBytes ( ) ) ; } } return 0 ; } public static void main ( String [ ] args ) throws Exception { } }

Fix:
Rule checkNotAscii = new Rule ( ( - 1 ) , ruleWithFeatures . first ) ;