Buggy code:
@ SuppressWarnings ( "serial" ) public abstract class AbstractBrokerFactory implements BrokerFactory { private static final Localizer _loc = Localizer . forPackage ( AbstractBrokerFactory . class ) ; private static final Map < Object , AbstractBrokerFactory > _pool = Collections . synchronizedMap ( new HashMap < Object , AbstractBrokerFactory > ( ) ) ; private final OpenJPAConfiguration _conf ; private transient boolean _readOnly = false ; private transient boolean _closed = false ; private transient RuntimeException _closedException = null ; private Map < Object , Object > _userObjects = null ; private final ReentrantLock _lock = new ReentrantLock ( ) ; private transient ConcurrentHashMap < Object , Collection < Broker > > _transactional = new ConcurrentHashMap < Object , Collection < Broker > > ( ) ; private transient Set < Broker > _brokers ; private transient Collection < String > _pcClassNames = null ; private transient Collection < ClassLoader > _pcClassLoaders = null ; private transient boolean _persistentTypesLoaded = false ; private transient Map < Object , Class < ? > [ ] > _lifecycleListeners = null ; private transient List < Object > _transactionListeners = null ; private Object _poolKey ; private WriteBehindCallback _writeBehindCallback ; protected static Object toPoolKey ( Map < String , Object > map ) { } protected static void pool ( Object key , AbstractBrokerFactory factory ) { } public static AbstractBrokerFactory getPooledFactoryForKey ( Object key ) { } protected AbstractBrokerFactory ( OpenJPAConfiguration config ) { } public OpenJPAConfiguration getConfiguration ( ) { } public Broker newBroker ( ) { } public Broker newBroker ( String user , String pass ) { } public Broker newBroker ( boolean managed , int connRetainMode ) { } public Broker newBroker ( String user , String pass , boolean managed , int connRetainMode ) { } public Broker newBroker ( String user , String pass , boolean managed , int connRetainMode , boolean findExisting ) { } public Broker newBroker ( String user , String pass , boolean managed , int connRetainMode , boolean findExisting , boolean writeBehindCallback ) { } void initializeBroker ( boolean managed , int connRetainMode , Broker broker , boolean fromDeserialization ) { } void initializeBroker ( boolean managed , int connRetainMode , Broker broker , boolean fromDeserialization , boolean fromWriteBehindCallback ) { } protected void addListeners ( Broker broker ) { } public void loadPersistentTypes ( ClassLoader envLoader ) { } private boolean needsSub ( Class < ? > cls ) { } public void addLifecycleListener ( Object listener , Class < ? > [ ] classes ) { } public void removeLifecycleListener ( Object listener ) { } public void addTransactionListener ( Object listener ) { } public void removeTransactionListener ( Object listener ) { } public boolean isClosed ( ) { } public void close ( ) { } public Map < String , Object > getProperties ( ) { } public Set < String > getSupportedProperties ( ) { } public Object getUserObject ( Object key ) { } public Object putUserObject ( Object key , Object val ) { } public void lock ( ) { } public void unlock ( ) { } protected Object readResolve ( ) throws ObjectStreamException { } private Set < Broker > newBrokerSet ( ) { } protected abstract StoreManager newStoreManager ( ) { } protected Broker findBroker ( String user , String pass , boolean managed ) { } protected BrokerImpl newBrokerImpl ( String user , String pass ) { } protected void setup ( ) { } protected Broker findTransactionalBroker ( String user , String pass ) { } protected void configureBroker ( BrokerImpl broker ) { } public void makeReadOnly ( ) { if ( _readOnly ) return ; lock ( ) ; try { if ( _readOnly ) return ; _readOnly = true ; Log log = _conf . getLog ( LOG_RUNTIME ) ; if ( log . isInfoEnabled ( ) ) log . info ( getFactoryInitializationBanner ( ) ) ; if ( log . isTraceEnabled ( ) ) { Map < String , Object > props = _conf . toProperties ( true ) ; String lineSep = J2DoPrivHelper . getLineSeparator ( ) ; <START_BUG> StringBuffer buf = new StringBuffer ( ) ; <END_BUG> Map . Entry < ? , ? > entry ; for ( Iterator < Map . Entry < String , Object > > itr = props . entrySet ( ) . iterator ( ) ; itr . hasNext ( ) ; ) { entry = itr . next ( ) ; buf . append ( entry . getKey ( ) ) . append ( ":<seq2seq4repair_space>" ) . append ( entry . getValue ( ) ) ; if ( itr . hasNext ( ) ) buf . append ( lineSep ) ; } log . trace ( AbstractBrokerFactory . _loc . get ( "factory-properties" , buf . toString ( ) ) ) ; } setup ( ) ; MetaDataRepository repos = _conf . getMetaDataRepositoryInstance ( ) ; repos . setValidate ( VALIDATE_RUNTIME , true ) ; repos . setResolve ( MODE_MAPPING_INIT , true ) ; PCRegistry . addRegisterClassListener ( repos ) ; _conf . setReadOnly ( INIT_STATE_FREEZING ) ; _conf . instantiateAll ( ) ; if ( _conf . isInitializeEagerly ( ) ) _conf . setReadOnly ( INIT_STATE_FROZEN ) ; _conf . getBrokerFactoryEventManager ( ) . fireEvent ( new BrokerFactoryEvent ( this , BrokerFactoryEvent . BROKER_FACTORY_CREATED ) ) ; } finally { unlock ( ) ; } } protected Object getFactoryInitializationBanner ( ) { } private void assertOpen ( ) { } private void assertNoActiveTransaction ( ) { } boolean syncWithManagedTransaction ( BrokerImpl broker , boolean begin ) { } public Collection < Broker > getOpenBrokers ( ) { } protected void releaseBroker ( BrokerImpl broker ) { } public Object getPoolKey ( ) { } void setPoolKey ( Object key ) { } private class RemoveTransactionSync implements Synchronization { private final Object _trans ; public RemoveTransactionSync ( Object trans ) { }

Fix:
StringBuilder buf = new StringBuilder ( ) ;