Buggy code:
public class DetachedStateManager extends AttachStrategy implements Serializable , OpenJPAStateManager { private static final Localizer _loc = Localizer . forPackage ( DetachedStateManager . class ) ; private final PersistenceCapable _pc ; private final boolean _embedded ; private final boolean _access ; private final BitSet _loaded ; private final BitSet _dirty ; private final Object _oid ; private final Object _version ; private final ReentrantLock _lock ; public DetachedStateManager ( PersistenceCapable pc , OpenJPAStateManager sm , BitSet load , boolean access , boolean multithreaded ) { } public Object attach ( AttachManager manager , Object toAttach , ClassMetaData meta , PersistenceCapable into , OpenJPAStateManager owner , ValueMetaData ownerMeta ) { } protected Object getDetachedObjectId ( AttachManager manager , Object toAttach ) { } void provideField ( int field ) { } protected void provideField ( Object toAttach , StateManagerImpl sm , int field ) { } protected static boolean ignoreLoaded ( FieldMetaData fmd ) { } public Object getGenericContext ( ) { } public byte replaceFlags ( ) { } public StateManager replaceStateManager ( StateManager sm ) { } public Object getVersion ( ) { } public void setVersion ( Object version ) { } public boolean isDirty ( ) { } public boolean isTransactional ( ) { } public boolean isPersistent ( ) { } public boolean isNew ( ) { } public boolean isDeleted ( ) { } public boolean isDetached ( ) { } public boolean isVersionUpdateRequired ( ) { } public boolean isVersionCheckRequired ( ) { } public void dirty ( String field ) { } public Object fetchObjectId ( ) { } public void accessingField ( int idx ) { if ( ( ! ( _access ) ) && ( ! ( _loaded . get ( idx ) ) ) ) <START_BUG> throw new IllegalStateException ( DetachedStateManager . _loc . get ( "unloaded-detached" , _pc ) ) ; <END_BUG> } public boolean serializing ( ) { } public boolean writeDetached ( ObjectOutput out ) throws IOException { } public void proxyDetachedDeserialized ( int idx ) { } public void settingBooleanField ( PersistenceCapable pc , int idx , boolean cur , boolean next , int set ) { } public void settingCharField ( PersistenceCapable pc , int idx , char cur , char next , int set ) { } public void settingByteField ( PersistenceCapable pc , int idx , byte cur , byte next , int set ) { } public void settingShortField ( PersistenceCapable pc , int idx , short cur , short next , int set ) { } public void settingIntField ( PersistenceCapable pc , int idx , int cur , int next , int set ) { } public void settingLongField ( PersistenceCapable pc , int idx , long cur , long next , int set ) { } public void settingFloatField ( PersistenceCapable pc , int idx , float cur , float next , int set ) { } public void settingDoubleField ( PersistenceCapable pc , int idx , double cur , double next , int set ) { } public void settingStringField ( PersistenceCapable pc , int idx , String cur , String next , int set ) { } public void settingObjectField ( PersistenceCapable pc , int idx , Object cur , Object next , int set ) { } public void providedBooleanField ( PersistenceCapable pc , int idx , boolean cur ) { } public void providedCharField ( PersistenceCapable pc , int idx , char cur ) { } public void providedByteField ( PersistenceCapable pc , int idx , byte cur ) { } public void providedShortField ( PersistenceCapable pc , int idx , short cur ) { } public void providedIntField ( PersistenceCapable pc , int idx , int cur ) { } public void providedLongField ( PersistenceCapable pc , int idx , long cur ) { } public void providedFloatField ( PersistenceCapable pc , int idx , float cur ) { } public void providedDoubleField ( PersistenceCapable pc , int idx , double cur ) { } public void providedStringField ( PersistenceCapable pc , int idx , String cur ) { } public void providedObjectField ( PersistenceCapable pc , int idx , Object cur ) { } public boolean replaceBooleanField ( PersistenceCapable pc , int idx ) { } public char replaceCharField ( PersistenceCapable pc , int idx ) { } public byte replaceByteField ( PersistenceCapable pc , int idx ) { } public short replaceShortField ( PersistenceCapable pc , int idx ) { } public int replaceIntField ( PersistenceCapable pc , int idx ) { } public long replaceLongField ( PersistenceCapable pc , int idx ) { } public float replaceFloatField ( PersistenceCapable pc , int idx ) { } public double replaceDoubleField ( PersistenceCapable pc , int idx ) { } public String replaceStringField ( PersistenceCapable pc , int idx ) { } public Object replaceObjectField ( PersistenceCapable pc , int idx ) { } public void initialize ( Class forType , PCState state ) { } public void load ( FetchConfiguration fetch ) { } public Object getManagedInstance ( ) { } public PersistenceCapable getPersistenceCapable ( ) { } public ClassMetaData getMetaData ( ) { } public OpenJPAStateManager getOwner ( ) { } public ValueMetaData getOwnerMetaData ( ) { } public boolean isEmbedded ( ) { } public boolean isFlushed ( ) { } public boolean isFlushedDirty ( ) { } public BitSet getLoaded ( ) { } public BitSet getDirty ( ) { } public BitSet getFlushed ( ) { } public BitSet getUnloaded ( FetchConfiguration fetch ) { } public Object newProxy ( int field ) { } public Object newFieldProxy ( int field ) { } public boolean isDefaultValue ( int field ) { } public StoreContext getContext ( ) { } public PCState getPCState ( ) { } public Object getObjectId ( ) { } public void setObjectId ( Object oid ) { } public boolean assignObjectId ( boolean flush ) { } public Object getId ( ) { }

Fix:
throw new IllegalStateException ( DetachedStateManager . _loc . get ( "unloaded-detached" , _pc ) . getMessage ( ) ) ;