Buggy code:
public void releaseSavepoint ( ) { } public void releaseSavepoint ( String savepoint ) { } public void rollbackToSavepoint ( ) { } public void rollbackToSavepoint ( String savepoint ) { } public void flush ( ) { } public void preFlush ( ) { } public void validateChanges ( ) { } public boolean isActive ( ) { } public boolean isStoreActive ( ) { } boolean isTransactionEnding ( ) { } public boolean beginOperation ( boolean syncTrans ) { } public boolean endOperation ( ) { } public Synchronization getSynchronization ( ) { } public void setSynchronization ( Synchronization sync ) { } public void beforeCompletion ( ) { } public void afterCompletion ( int status ) { } private RuntimeException translateManagedCompletionException ( RuntimeException re ) { } private void flushSafe ( int reason ) { } protected void flush ( int reason ) { } private void flushAdditions ( Collection transactional , int reason ) { } private boolean flushTransAdditions ( Collection transactional , int reason ) { } private boolean deleteDerefAdditions ( Collection derefs ) { } private void deleteDeref ( StateManagerImpl sm ) { } private int processArgument ( int op , Object obj , OpenJPAStateManager sm , OpCallbacks call ) { } private OpenJPAException newFlushException ( Collection exceps ) { } protected void endTransaction ( int status ) { } public void persist ( Object obj , OpCallbacks call ) { } public OpenJPAStateManager persist ( Object obj , Object id , OpCallbacks call ) { } public void persistAll ( Collection objs , OpCallbacks call ) { } public void persistAll ( Collection objs , boolean explicit , OpCallbacks call ) { } private List add ( List l , Object o ) { } private void throwNestedExceptions ( List exceps , boolean datastore ) { } public void persist ( Object obj , boolean explicit , OpCallbacks call ) { } public OpenJPAStateManager persist ( Object obj , Object id , boolean explicit , OpCallbacks call ) { } private void cascadeTransient ( int op , Object obj , OpCallbacks call , String errOp ) { } public void deleteAll ( Collection objs , OpCallbacks call ) { } public void delete ( Object obj , OpCallbacks call ) { } void delete ( Object obj , StateManagerImpl sm , OpCallbacks call ) { } private OpenJPAException newDetachedException ( Object obj , String operation ) { } public void releaseAll ( Collection objs , OpCallbacks call ) { } public void release ( Object obj , OpCallbacks call ) { } public OpenJPAStateManager embed ( Object obj , Object id , OpenJPAStateManager owner , ValueMetaData ownerMeta ) { } OpenJPAStateManager copy ( OpenJPAStateManager copy , PCState state ) { } public void refreshAll ( Collection objs , OpCallbacks call ) { } public void refresh ( Object obj , OpCallbacks call ) { } void gatherCascadeRefresh ( Object obj , OpCallbacks call ) { } protected void refreshInternal ( Collection objs , OpCallbacks call ) { } protected void refreshInternal ( Object obj , OpCallbacks call ) { } public void retrieveAll ( Collection objs , boolean dfgOnly , OpCallbacks call ) { } public void retrieve ( Object obj , boolean dfgOnly , OpCallbacks call ) { } public void evictAll ( OpCallbacks call ) { } public void evictAll ( Collection objs , OpCallbacks call ) { } public void evictAll ( Extent extent , OpCallbacks call ) { } public void evict ( Object obj , OpCallbacks call ) { if ( obj == null ) return ; beginOperation ( false ) ; try { StateManagerImpl sm = getStateManagerImpl ( obj , true ) ; if ( ( ( processArgument ( OP_EVICT , obj , sm , call ) ) & ( OpCallbacks . ACT_RUN ) ) == 0 ) return ; if ( sm == null ) return ; sm . evict ( ) ; if ( ( _evictDataCache ) && ( ( sm . getObjectId ( ) ) != null ) ) { <START_BUG> DataCache cache = sm . getMetaData ( ) . getDataCache ( ) ; <END_BUG> if ( cache != null ) cache . remove ( sm . getObjectId ( ) ) ; } } catch ( OpenJPAException ke ) { throw ke ; } catch ( RuntimeException re ) { throw new GeneralException ( re ) ; } finally { endOperation ( ) ; } } public Object detach ( Object obj , OpCallbacks call ) { } public Object [ ] detachAll ( Collection objs , OpCallbacks call ) { } public void detachAll ( OpCallbacks call ) { } public void detachAll ( OpCallbacks call , boolean flush ) { } private void detachAllInternal ( OpCallbacks call ) { } public Object attach ( Object obj , boolean copyNew , OpCallbacks call ) { } public Object [ ] attachAll ( Collection objs , boolean copyNew , OpCallbacks call ) { } public void nontransactionalAll ( Collection objs , OpCallbacks call ) { } public void nontransactional ( Object obj , OpCallbacks call ) { } public void transactionalAll ( Collection objs , boolean updateVersion , OpCallbacks call ) { } public void transactional ( Object obj , boolean updateVersion , OpCallbacks call ) { } private void transactionalStatesAll ( Collection sms , Collection failed , List exceps ) { } public Extent newExtent ( Class type , boolean subclasses ) { } private Extent newExtent ( Class type , boolean subclasses , FetchConfiguration fetch ) { } public Iterator extentIterator ( Class type , boolean subclasses , FetchConfiguration fetch , boolean ignoreChanges ) { } public Query newQuery ( String lang , Class cls , Object query ) { } public Query newQuery ( String lang , Object query ) { } protected QueryImpl newQueryImpl ( String lang , StoreQuery sq ) { } public Seq getIdentitySequence ( ClassMetaData meta ) { }

Fix:
DataCache cache = _conf . getDataCacheManagerInstance ( ) . selectCache ( sm ) ;