Buggy code:
public class AnnotationPersistenceMetaDataParser implements MetaDataModes { private static final Localizer _loc = Localizer . forPackage ( AnnotationPersistenceMetaDataParser . class ) ; private static final Map < Class , MetaDataTag . MetaDataTag > _tags = new HashMap < Class , MetaDataTag . MetaDataTag > ( ) ; private final OpenJPAConfiguration _conf ; private final Log _log ; private MetaDataRepository _repos = null ; private ClassLoader _envLoader = null ; private boolean _override = false ; private int _mode = MODE_NONE ; private final Map < Package , Integer > _pkgs = new HashMap < Package , Integer > ( ) ; private Class _cls = null ; private File _file = null ; public AnnotationPersistenceMetaDataParser ( OpenJPAConfiguration conf ) { } public OpenJPAConfiguration getConfiguration ( ) { } public Log getLog ( ) { } public MetaDataRepository getRepository ( ) { } public void setRepository ( MetaDataRepository repos ) { } public ClassLoader getEnvClassLoader ( ) { } public void setEnvClassLoader ( ClassLoader loader ) { } public boolean getMappingOverride ( ) { } public void setMappingOverride ( boolean override ) { } public int getMode ( ) { } public void setMode ( int mode , boolean on ) { } public void setMode ( int mode ) { } protected boolean isMetaDataMode ( ) { } protected boolean isQueryMode ( ) { } protected boolean isMappingMode ( ) { } protected boolean isMappingOverrideMode ( ) { } public void clear ( ) { } public void parse ( Class cls ) { } private void updateSourceMode ( ClassMetaData meta ) { } private void parsePackageAnnotations ( ) { } protected void parsePackageMappingAnnotations ( Package pkg ) { } protected boolean handleUnknownPackageAnnotation ( Package pkg , Annotation anno ) { } private int getSourceMode ( Package pkg ) { } private void addSourceMode ( Package pkg , int mode ) { } private ClassMetaData parseClassAnnotations ( ) { } protected void parseClassMappingAnnotations ( ClassMetaData meta ) { } protected boolean handleUnknownClassAnnotation ( ClassMetaData meta , Annotation anno ) { } private ClassMetaData getMetaData ( ) { } protected File getSourceFile ( ) { } private void parseDataStoreId ( ClassMetaData meta , DataStoreId id ) { } private void warnFlushMode ( Object context ) { } private void parseDataCache ( ClassMetaData meta , DataCache cache ) { } private void parseDetachedState ( ClassMetaData meta , DetachedState detached ) { if ( detached != null ) { if ( ! ( detached . enabled ( ) ) ) meta . setDetachedState ( null ) ; else <START_BUG> if ( ! ( StringUtils . isEmpty ( detached . fieldName ( ) ) ) ) <END_BUG> meta . setDetachedState ( SYNTHETIC ) ; else meta . setDetachedState ( detached . fieldName ( ) ) ; } else { Field [ ] fields = ( ( Field [ ] ) ( AccessController . doPrivileged ( J2DoPrivHelper . getDeclaredFieldsAction ( meta . getDescribedType ( ) ) ) ) ) ; for ( int i = 0 ; i < ( fields . length ) ; i ++ ) if ( fields [ i ] . isAnnotationPresent ( DetachedState . class ) ) meta . setDetachedState ( fields [ i ] . getName ( ) ) ; } } private Collection < LifecycleCallbacks > [ ] parseEntityListeners ( ClassMetaData meta , EntityListeners listeners ) { } public static Collection < LifecycleCallbacks > [ ] parseCallbackMethods ( Class cls , Collection < LifecycleCallbacks > [ ] callbacks , boolean sups , boolean listener , MetaDataRepository repos ) { } private void recordCallbacks ( ClassMetaData cls , Collection < LifecycleCallbacks > [ ] callbacks , int [ ] highs , boolean superClass ) { } private void parseFetchGroups ( ClassMetaData meta , FetchGroup ... groups ) { } private void parseFetchAttribute ( ClassMetaData meta , org . apache . openjpa . meta . FetchGroup fg , FetchAttribute attr ) { } private void parseMemberAnnotations ( FieldMetaData fmd ) { } protected void parseMemberMappingAnnotations ( FieldMetaData fmd ) { } protected boolean handleUnknownMemberAnnotation ( FieldMetaData fmd , Annotation anno ) { } private static Class toOverrideType ( Class cls ) { } private void parseReadOnly ( FieldMetaData fmd , ReadOnly ro ) { } private void parseGeneratedValue ( FieldMetaData fmd , GeneratedValue gen ) { } private static int getGeneratedValueStrategy ( Object context , GenerationType strategy , String generator ) { } private void parseBasic ( FieldMetaData fmd , Basic anno , boolean lob ) { } private void parseManyToOne ( FieldMetaData fmd , ManyToOne anno ) { } private void parseOneToOne ( FieldMetaData fmd , OneToOne anno ) { } private void parseEmbedded ( FieldMetaData fmd , Embedded anno ) { } private void parseOneToMany ( FieldMetaData fmd , OneToMany anno ) { } private void parseManyToMany ( FieldMetaData fmd , ManyToMany anno ) { } private void parseMapKey ( FieldMetaData fmd , MapKey anno ) { } protected void parseLobMapping ( FieldMetaData fmd ) { } private void parseOrderBy ( FieldMetaData fmd , OrderBy anno ) { } private void parsePersistent ( FieldMetaData fmd , Persistent anno ) { } private void parsePersistentCollection ( FieldMetaData fmd , PersistentCollection anno ) { } private void parsePersistentMap ( FieldMetaData fmd , PersistentMap anno ) { } private void setCascades ( ValueMetaData vmd , CascadeType [ ] cascades ) { } private void parseSequenceGenerator ( AnnotatedElement el , SequenceGenerator gen ) { } private void parseNamedQueries ( AnnotatedElement el , NamedQuery ... queries ) { } private void parseNamedNativeQueries ( AnnotatedElement el , NamedNativeQuery ... queries ) { } private static class MethodKey { private final Method _method ; public MethodKey ( Method m ) { } public int hashCode ( ) { } public boolean equals ( Object o ) { } } private static class MethodComparator implements Comparator { private static AnnotationPersistenceMetaDataParser . MethodComparator INSTANCE = null ; public static AnnotationPersistenceMetaDataParser . MethodComparator getInstance ( ) { }

Fix:
if ( StringUtils . isEmpty ( detached . fieldName ( ) ) )