Buggy code:
public class EntityManagerFactoryImpl implements OpenJPAEntityManagerFactory { private static final Localizer _loc = Localizer . forPackage ( EntityManagerFactoryImpl . class ) ; private final DelegatingBrokerFactory _factory ; private transient Constructor < FetchPlan > _plan = null ; private transient StoreCache _cache = null ; private transient QueryResultCache _queryCache = null ; protected EntityManagerFactoryImpl ( BrokerFactory factory ) { } public BrokerFactory getBrokerFactory ( ) { } public OpenJPAConfiguration getConfiguration ( ) { } public Properties getProperties ( ) { } public Object putUserObject ( Object key , Object val ) { } public Object getUserObject ( Object key ) { } public StoreCache getStoreCache ( ) { } public StoreCache getStoreCache ( String cacheName ) { } public QueryResultCache getQueryResultCache ( ) { } public OpenJPAEntityManager createEntityManager ( ) { } public OpenJPAEntityManager createEntityManager ( Map props ) { if ( props == null ) props = Collections . EMPTY_MAP ; else if ( ! ( props . isEmpty ( ) ) ) props = new HashMap ( props ) ; OpenJPAConfiguration conf = getConfiguration ( ) ; String user = ( ( String ) ( props . remove ( "openjpa.ConnectionUserName" ) ) ) ; if ( user == null ) user = conf . getConnectionUserName ( ) ; String pass = ( ( String ) ( props . remove ( "openjpa.ConnectionPassword" ) ) ) ; if ( pass == null ) pass = conf . getConnectionPassword ( ) ; String str = ( ( String ) ( props . remove ( "openjpa.TransactionMode" ) ) ) ; boolean managed ; if ( str == null ) managed = conf . isTransactionModeManaged ( ) ; else { Value val = conf . getValue ( "openjpa.TransactionMode" ) ; managed = Boolean . parseBoolean ( val . unalias ( str ) ) ; } Object obj = props . remove ( "openjpa.ConnectionRetainMode" ) ; int retainMode ; if ( obj instanceof Number ) retainMode = ( ( Number ) ( obj ) ) . intValue ( ) ; else if ( obj != null ) { Value val = conf . getValue ( "openjpa.ConnectionRetainMode" ) ; try { retainMode = Integer . parseInt ( val . unalias ( ( ( String ) ( obj ) ) ) ) ; } catch ( Exception e ) { throw new ArgumentException ( EntityManagerFactoryImpl . _loc . get ( "bad-em-prop" , "openjpa.ConnectionRetainMode" , obj ) , new Throwable [ ] { e } , obj , true ) ; } } else retainMode = conf . getConnectionRetainModeConstant ( ) ; Broker broker = _factory . newBroker ( user , pass , managed , retainMode , false ) ; broker . setAutoDetach ( DETACH_CLOSE ) ; broker . setDetachedNew ( false ) ; OpenJPAEntityManager em = OpenJPAPersistence . toEntityManager ( broker ) ; List < RuntimeException > errs = null ; Method setter = null ; String prop ; Object val ; for ( Map . Entry entry : ( ( Set < Map . Entry > ) ( props . entrySet ( ) ) ) ) { prop = ( ( String ) ( entry . getKey ( ) ) ) ; if ( ! ( prop . startsWith ( "openjpa." ) ) ) continue ; <START_BUG> prop = prop . substring ( 5 ) ; <END_BUG> try { setter = ImplHelper . getSetter ( em . getClass ( ) , prop ) ; } catch ( OpenJPAException ke ) { if ( errs == null ) errs = new LinkedList < RuntimeException > ( ) ; errs . add ( PersistenceExceptions . toPersistenceException ( ke ) ) ; continue ; } val = entry . getValue ( ) ; try { if ( val instanceof String ) { if ( "null" . equals ( val ) ) val = null ; else val = Strings . parse ( ( ( String ) ( val ) ) , setter . getParameterTypes ( ) [ 0 ] ) ; } setter . invoke ( em , new Object [ ] { val } ) ; } catch ( Exception e ) { ArgumentException err = new ArgumentException ( EntityManagerFactoryImpl . _loc . get ( "bad-em-prop" , prop , entry . getValue ( ) ) , new Throwable [ ] { e } , null , true ) ; if ( errs == null ) errs = new LinkedList < RuntimeException > ( ) ; errs . add ( err ) ; } } if ( errs != null ) { em . close ( ) ; if ( ( errs . size ( ) ) == 1 ) throw errs . get ( 0 ) ; throw new ArgumentException ( EntityManagerFactoryImpl . _loc . get ( "bad-em-props" ) , ( ( Throwable [ ] ) ( errs . toArray ( new Throwable [ errs . size ( ) ] ) ) ) , null , true ) ; } return em ; } public void addLifecycleListener ( Object listener , Class ... classes ) { } public void removeLifecycleListener ( Object listener ) { } public void close ( ) { } public boolean isOpen ( ) { } public int hashCode ( ) { } public boolean equals ( Object other ) { } FetchPlan toFetchPlan ( Broker broker , FetchConfiguration fetch ) { } }

Fix:
prop = prop . substring ( "openjpa." . length ( ) ) ;