Buggy code:
private static final String CONTEXTNAME = "GenericContext" ; private static final Class USEREXCEP = UserException . class ; private static final Class INTERNEXCEP = InternalException . class ; private static final Class HELPERTYPE = PCRegistry . class ; private static final String SUPER = ( PCEnhancer . PRE ) + "PCSuperclass" ; private static final Class OIDFSTYPE = FieldSupplier . class ; private static final Class OIDFCTYPE = FieldConsumer . class ; private static final String VERSION_INIT_STR = ( PCEnhancer . PRE ) + "VersionInit" ; private static final Localizer _loc = Localizer . forPackage ( PCEnhancer . class ) ; private static final String REDEFINED_ATTRIBUTE = ( PCEnhancer . class . getName ( ) ) + "#redefined-type" ; private static final PCEnhancer . AuxiliaryEnhancer [ ] _auxEnhancers ; private BCClass _pc ; private final BCClass _managedType ; private final MetaDataRepository _repos ; private final ClassMetaData _meta ; private final Log _log ; private Collection _oids = null ; private boolean _defCons = true ; private boolean _redefine = false ; private boolean _subclass = false ; private boolean _fail = false ; private Set _violations = null ; private File _dir = null ; private BytecodeWriter _writer = null ; private Map _backingFields = null ; private Map _attrsToFields = null ; private Map _fieldsToAttrs = null ; private boolean _isAlreadyRedefined = false ; private boolean _isAlreadySubclassed = false ; private boolean _bcsConfigured = false ; public PCEnhancer ( OpenJPAConfiguration conf , Class type ) { } public PCEnhancer ( OpenJPAConfiguration conf , ClassMetaData meta ) { } public PCEnhancer ( OpenJPAConfiguration conf , BCClass type , MetaDataRepository repos ) { } public PCEnhancer ( OpenJPAConfiguration conf , BCClass type , MetaDataRepository repos , ClassLoader loader ) { } public PCEnhancer ( MetaDataRepository repos , BCClass type , ClassMetaData meta ) { } static String toPCSubclassName ( Class cls ) { } public static boolean isPCSubclassName ( String className ) { } public static String toManagedTypeName ( String className ) { } public PCEnhancer ( OpenJPAConfiguration conf , BCClass type , ClassMetaData meta ) { } public BCClass getPCBytecode ( ) { } public BCClass getManagedTypeBytecode ( ) { } public ClassMetaData getMetaData ( ) { } public boolean getAddDefaultConstructor ( ) { } public void setAddDefaultConstructor ( boolean addDefaultConstructor ) { } public boolean getRedefine ( ) { } public void setRedefine ( boolean redefine ) { } public boolean isAlreadyRedefined ( ) { } public boolean isAlreadySubclassed ( ) { } public boolean getCreateSubclass ( ) { } public void setCreateSubclass ( boolean subclass ) { } public boolean getEnforcePropertyRestrictions ( ) { } public void setEnforcePropertyRestrictions ( boolean fail ) { } public File getDirectory ( ) { } public void setDirectory ( File dir ) { } public BytecodeWriter getBytecodeWriter ( ) { } public void setBytecodeWriter ( BytecodeWriter writer ) { } public int run ( ) { } private void configureBCs ( ) { } public void record ( ) throws IOException { } private void record ( BCClass bc ) throws IOException { } private void validateProperties ( ) { } private void registerBackingFieldInfo ( FieldMetaData fmd , BCMethod method , BCField field ) { } private void addAttributeTranslation ( ) { } private static String getSetterName ( FieldMetaData fmd ) { } static BCField getReturnedField ( BCMethod meth ) { } static BCField getAssignedField ( BCMethod meth ) { } private static BCField findField ( BCMethod meth , Instruction template , boolean findAccessed ) { } private void addViolation ( String key , Object [ ] args , boolean fatal ) { } private void processViolations ( ) { if ( ( _violations ) == null ) return ; String sep = J2DoPrivHelper . getLineSeparator ( ) ; <START_BUG> StringBuffer buf = new StringBuffer ( ) ; <END_BUG> for ( Iterator itr = _violations . iterator ( ) ; itr . hasNext ( ) ; ) { buf . append ( itr . next ( ) ) ; if ( itr . hasNext ( ) ) buf . append ( sep ) ; } Message msg = PCEnhancer . _loc . get ( "property-violations" , buf ) ; if ( _fail ) throw new UserException ( msg ) ; if ( _log . isWarnEnabled ( ) ) _log . warn ( msg ) ; } private void replaceAndValidateFieldAccess ( ) throws NoSuchMethodException { } private void replaceAndValidateFieldAccess ( Code code , Instruction ins , boolean get , Instruction stat ) throws NoSuchMethodException { } private void addNotifyAccess ( Code code , FieldMetaData fmd ) { } private void addNotifyMutation ( Code code , FieldMetaData fmd , int val , int param ) throws NoSuchMethodException { } private boolean isBackingFieldOfAnotherProperty ( String name , Code code ) { } private ClassMetaData getPersistenceCapableOwner ( String fieldName , Class owner ) { } private void addPCMethods ( ) throws NoSuchMethodException { } private void addClearFieldsMethod ( ) throws NoSuchMethodException { } private void addNewInstanceMethod ( boolean oid ) { } private void addManagedFieldCountMethod ( ) { } private void addProvideFieldsMethods ( ) throws NoSuchMethodException { } private void addReplaceFieldsMethods ( ) throws NoSuchMethodException { } private void addCopyFieldsMethod ( ) throws NoSuchMethodException { } private int beginSwitchMethod ( String name , Code code ) { } private void addMultipleFieldsMethodVersion ( BCMethod single ) { } private void addStockMethods ( ) throws NoSuchMethodException { } private void translateFromStateManagerMethod ( Method m , boolean isDirtyCheckMethod ) { } private void addGetVersionMethod ( ) throws NoSuchMethodException { } private Class toPrimitiveWrapper ( FieldMetaData fmd ) { } private void addReplaceStateManagerMethod ( ) { } private void addNoOpApplicationIdentityMethods ( ) { } private void addCopyKeyFieldsToObjectIdMethod ( boolean fieldManager ) throws NoSuchMethodException { } private void addExtractObjectIdFieldValueCode ( Code code , FieldMetaData pk ) { } private void addCopyKeyFieldsFromObjectIdMethod ( boolean fieldManager ) throws NoSuchMethodException { } private Boolean usesClassStringIdConstructor ( ) { } private Class unwrapSingleFieldIdentity ( FieldMetaData fmd ) { }

Fix:
StringBuilder buf = new StringBuilder ( ) ;