Buggy code:
public class RegexObjectConverter { private ParsingObject po ; private Map < String , RegexObject > rules ; private int ruleId = 1 ; private static final String rulePrefix = "E" ; private int blockId = 1 ; private static final String blockPrefix = "B" ; private int groupId = 1 ; private static final String groupPrefix = "G" ; public RegexObjectConverter ( ParsingObject po ) { } private String createRuleId ( ) { } private String createBlockId ( ) { } private String createGroupId ( ) { } public Map < String , RegexObject > convert ( ) { } private RegSeq createSequence ( ParsingObject po ) { } private RegexObject createRegexObject ( ParsingObject e ) { switch ( e . getTag ( ) . toString ( ) ) { case "Or" : RegChoice roOr = new RegChoice ( ) ; roOr . add ( createSequence ( e . get ( 0 ) ) ) ; roOr . add ( createSequence ( e . get ( 1 ) ) ) ; return roOr ; case "Item" : return createSequence ( e . get ( 0 ) ) ; default : { switch ( e . get ( 1 ) . getTag ( ) . toString ( ) ) { case "Char" : case "OneOf" : case "ExceptFor" : case "EscapedChar" : return new RegCharSet ( e ) ; case "Block" : RegNonTerminal rnBlock = new RegNonTerminal ( createBlockId ( ) ) ; RegSeq rsBlock = createSequence ( e . get ( 1 ) ) ; rsBlock . setParent ( rnBlock ) ; rnBlock . setDefName ( ) ; this . rules . put ( rnBlock . toString ( ) , rsBlock ) ; rnBlock . addQuantifier ( e ) ; return rnBlock ; case "Group" : RegNonTerminal rnGroup = new RegNonTerminal ( createGroupId ( ) ) ; RegSeq rsGroup = createSequence ( e . get ( 1 ) ) ; this . rules . put ( rnGroup . toString ( ) , rsGroup ) ; rnGroup . addQuantifier ( e ) ; return rnGroup ; case "BlockReference" : int refId = Integer . parseInt ( e . get ( 1 ) . get ( 0 ) . getText ( ) ) ; <START_BUG> String ntName = ( RegexObjectConverter . blockPrefix ) + refId ; <END_BUG> RegexObject roBRefer = rules . get ( ntName ) ; if ( ( roBRefer != null ) && ( ( roBRefer . getParent ( ) ) instanceof RegNonTerminal ) ) { RegNonTerminal rnBRefer = new RegNonTerminal ( ntName ) ; rnBRefer . addQuantifier ( e ) ; rnBRefer . setIsa ( ) ; ( ( RegNonTerminal ) ( roBRefer . getParent ( ) ) ) . setRefer ( true ) ; return rnBRefer ; } else { System . err . println ( "An<seq2seq4repair_space>undefined<seq2seq4repair_space>reference." ) ; return null ; } default : System . err . println ( "Sorry!!<seq2seq4repair_space>An<seq2seq4repair_space>error<seq2seq4repair_space>occurred<seq2seq4repair_space>on<seq2seq4repair_space>'createRegexObject'." ) ; return null ; } } } } private RegexObject pi ( RegexObject target , RegexObject continuation ) { } private RegexObject continuationBasedConversion ( RegSeq rcLeft , RegexObject roRight ) { } private RegexObject continuationBasedConversion ( RegCharSet rcLeft , RegexObject roRight ) { } private void createNewLongestZeroMoreRule ( RegexObject rHead , RegNonTerminal nt ) { } private void createNewShortestZeroMoreRule ( RegexObject rHead , RegNonTerminal nt ) { } private void createNewLongestOptionalRule ( RegexObject rHead , RegNonTerminal nt ) { } private void createNewShortestOptionalRule ( RegexObject rHead , RegNonTerminal nt ) { } }

Fix:
String ntName = ( RegexObjectConverter . blockPrefix ) + ( String . format ( "%1$02d" , refId ) ) ;