Buggy code:
public class ApplicationIdTool { public static final String TOKEN_DEFAULT = "::" ; private static final String TOKENIZER_CUSTOM = "Tokenizer" ; private static final String TOKENIZER_STD = "StringTokenizer" ; private static final Localizer _loc = Localizer . forPackage ( ApplicationIdTool . class ) ; private final Log _log ; private final Class _type ; private final ClassMetaData _meta ; private boolean _abstract = false ; private FieldMetaData [ ] _fields = null ; private boolean _ignore = true ; private File _dir = null ; private Writer _writer = null ; private String _code = null ; private String _token = ApplicationIdTool . TOKEN_DEFAULT ; private CodeFormat _format = null ; public ApplicationIdTool ( OpenJPAConfiguration conf , Class type ) { } public ApplicationIdTool ( OpenJPAConfiguration conf , Class type , ClassMetaData meta ) { } private static FieldMetaData [ ] getDeclaredPrimaryKeyFields ( ClassMetaData meta ) { } public boolean getIgnoreErrors ( ) { } public void setIgnoreErrors ( boolean ignore ) { } public CodeFormat getCodeFormat ( ) { } public void setCodeFormat ( CodeFormat format ) { } public File getDirectory ( ) { } public void setDirectory ( File dir ) { } public String getToken ( ) { } public void setToken ( String token ) { } public Writer getWriter ( ) { } public void setWriter ( Writer writer ) { } public Class getType ( ) { } public ClassMetaData getMetaData ( ) { } public String getCode ( ) { } public boolean isInnerClass ( ) { } private String getClassName ( ) { } public boolean run ( ) { } public void record ( ) throws IOException { } private String getImports ( ) { } public Set getImportPackages ( ) { } private String getFieldDeclarations ( ) { } private String getTypeName ( FieldMetaData fmd ) { } private String getProperties ( ) { } private String getConstructor ( boolean hasSuperclass ) { } private String getFromStringCode ( boolean hasSuperclass ) { } private String getTokenizer ( boolean hasSuperclass ) { } private String getConversionCode ( FieldMetaData field , String var ) { } private String getEqualsCode ( boolean hasSuperclass ) { } private String getHashCodeCode ( boolean hasSuperclass ) { } private boolean hasConcreteSuperclass ( ) { } private void appendHashCodeCode ( FieldMetaData field , CodeFormat code ) { } private String getToStringCode ( boolean hasSuperclass ) { } private String getToBytesByteArrayCode ( ) { } private String getToStringByteArrayCode ( ) { CodeFormat code = newCodeFormat ( ) ; code . tab ( ) . append ( "private<seq2seq4repair_space>static<seq2seq4repair_space>String<seq2seq4repair_space>toString" ) . openParen ( true ) . append ( "byte[]<seq2seq4repair_space>b" ) . closeParen ( ) . openBrace ( 2 ) . endl ( ) ; code . tab ( 2 ) . append ( "if" ) . openParen ( true ) . append ( "b<seq2seq4repair_space>==<seq2seq4repair_space>null" ) . closeParen ( ) . endl ( ) ; code . tab ( 3 ) . append ( "return<seq2seq4repair_space>\"null\";" ) . endl ( 2 ) ; <START_BUG> code . tab ( 2 ) . append ( "StringBuffer<seq2seq4repair_space>r<seq2seq4repair_space>=<seq2seq4repair_space>new<seq2seq4repair_space>StringBuffer" ) . openParen ( true ) . append ( "b.length<seq2seq4repair_space>*<seq2seq4repair_space>2" ) . closeParen ( ) . append ( ";" ) . endl ( ) ; <END_BUG> code . tab ( 2 ) . append ( "for" ) . openParen ( true ) . append ( "int<seq2seq4repair_space>i<seq2seq4repair_space>=<seq2seq4repair_space>0;<seq2seq4repair_space>i<seq2seq4repair_space><<seq2seq4repair_space>b.length;<seq2seq4repair_space>i++" ) . closeParen ( ) . endl ( ) ; code . tab ( 3 ) . append ( "for" ) . openParen ( true ) . append ( "int<seq2seq4repair_space>j<seq2seq4repair_space>=<seq2seq4repair_space>1;<seq2seq4repair_space>j<seq2seq4repair_space>>=<seq2seq4repair_space>0;<seq2seq4repair_space>j--" ) . closeParen ( ) . endl ( ) ; code . tab ( 4 ) . append ( "r.append" ) . openParen ( true ) . append ( "HEX[" ) . openParen ( false ) . append ( "b[i]<seq2seq4repair_space>>><seq2seq4repair_space>" ) . openParen ( false ) . append ( "j<seq2seq4repair_space>*<seq2seq4repair_space>4" ) . closeParen ( ) . closeParen ( ) . append ( "<seq2seq4repair_space>&<seq2seq4repair_space>0xF]" ) . closeParen ( ) . append ( ";" ) . endl ( ) ; code . tab ( 2 ) . append ( "return<seq2seq4repair_space>r.toString" ) . parens ( ) . append ( ";" ) . endl ( ) ; code . closeBrace ( 2 ) ; return code . toString ( ) ; } private String getEqualsByteArrayCode ( ) { } private String getHashCodeByteArrayCode ( ) { } private String getCustomTokenizerClass ( ) { } private File getFile ( ) { } private CodeFormat newCodeFormat ( ) { } public static void main ( String [ ] args ) throws IOException , ClassNotFoundException { } public static boolean run ( OpenJPAConfiguration conf , String [ ] args , Options opts ) throws IOException , ClassNotFoundException { } public static boolean run ( OpenJPAConfiguration conf , String [ ] args , ApplicationIdTool . Flags flags , ClassLoader loader ) throws IOException , ClassNotFoundException { } private static void setObjectIdType ( ClassMetaData meta , ApplicationIdTool . Flags flags , BCClassLoader bc ) throws ClassNotFoundException { } private static Class loadClass ( Class context , String name , BCClassLoader bc ) throws ClassNotFoundException { } private static void loadObjectIds ( MetaDataRepository repos , boolean fatal ) { } public static class Flags { public File directory = null ; public boolean ignoreErrors = true ; public String token = ApplicationIdTool . TOKEN_DEFAULT ; public CodeFormat format = null ; public String name = null ; public String suffix = null ; } public static interface ObjectIdLoader { public void setLoadObjectIds ( ) { } } }

Fix:
code . tab ( 2 ) . append ( "StringBuilder<seq2seq4repair_space>r<seq2seq4repair_space>=<seq2seq4repair_space>new<seq2seq4repair_space>StringBuilder" ) . openParen ( true ) . append ( "b.length<seq2seq4repair_space>*<seq2seq4repair_space>2" ) . closeParen ( ) . append ( ";" ) . endl ( ) ;