Buggy code:
public abstract class AbstractExpressionBuilder { protected static final int EX_USER = 0 ; protected static final int EX_FATAL = 1 ; protected static final int EX_UNSUPPORTED = 2 ; public static final Class < Object > TYPE_OBJECT = Object . class ; public static final Class < String > TYPE_STRING = String . class ; public static final Class < Character > TYPE_CHAR_OBJ = Character . class ; public static final Class < Number > TYPE_NUMBER = Number . class ; public static final Class < Collection > TYPE_COLLECTION = Collection . class ; public static final Class < Map > TYPE_MAP = Map . class ; public static final int CONTAINS_TYPE_ELEMENT = 1 ; public static final int CONTAINS_TYPE_KEY = 2 ; public static final int CONTAINS_TYPE_VALUE = 3 ; private static final Localizer _loc = Localizer . forPackage ( AbstractExpressionBuilder . class ) ; protected final Resolver resolver ; protected ExpressionFactory factory ; private final Set < ClassMetaData > _accessPath = new HashSet < ClassMetaData > ( ) ; private Map < String , Value > _seenVars = null ; private Set < Value > _boundVars = null ; public AbstractExpressionBuilder ( ExpressionFactory factory , Resolver resolver ) { } protected abstract ClassLoader getClassLoader ( ) { } protected OpenJPAException parseException ( int e , String token , Object [ ] args , Exception nest ) { } protected ClassMetaData addAccessPath ( ClassMetaData meta ) { } protected ClassMetaData [ ] getAccessPath ( ) { } protected boolean isBound ( Value var ) { } protected void bind ( Value var ) { } protected Value getVariable ( String id , boolean bind ) { } protected Value createVariable ( String id , boolean bind ) { } protected void assertUnboundVariablesValid ( ) { } protected abstract boolean isDeclaredVariable ( String id ) { } protected boolean isSeenVariable ( String id ) { } protected ClassMetaData getMetaData ( Class < ? > c , boolean required ) { } protected ClassMetaData getMetaData ( Class < ? > c , boolean required , ClassLoader loader ) { } protected Value traversePath ( Path path , String field ) { } protected Value traverseXPath ( Path path , String field ) { } protected Value traversePath ( Path path , String field , boolean pcOnly , boolean allowNull ) { ClassMetaData meta = path . getMetaData ( ) ; if ( meta == null ) throw parseException ( AbstractExpressionBuilder . EX_USER , "path-no-meta" , new Object [ ] { field , path . getType ( ) } , null ) ; FieldMetaData fmd = meta . getField ( field ) ; if ( fmd == null ) { Object val = traverseStaticField ( meta . getDescribedType ( ) , field ) ; if ( val == null ) { if ( isMultiValuedTraversalAttempt ( path , field ) ) { throw parseException ( AbstractExpressionBuilder . EX_USER , "multi-valued-travesal" , new Object [ ] { field , path . last ( ) } , null ) ; } String [ ] all = meta . getFieldNames ( ) ; Class < ? > cls = meta . getDescribedType ( ) ; throw parseException ( AbstractExpressionBuilder . EX_USER , "no-field" , new Object [ ] { field , cls . getSimpleName ( ) , StringDistance . getClosestLevenshteinDistance ( field , all ) , cls . getName ( ) , Arrays . toString ( all ) } , null ) ; } return factory . newLiteral ( val , TYPE_UNKNOWN ) ; } if ( fmd . isEmbedded ( ) ) meta = fmd . getEmbeddedMetaData ( ) ; else meta = fmd . getDeclaredTypeMetaData ( ) ; if ( meta != null ) { addAccessPath ( meta ) ; path . setMetaData ( meta ) ; } else { <START_BUG> XMLMetaData xmlmeta = fmd . getRepository ( ) . getXMLMetaData ( fmd ) ; <END_BUG> if ( xmlmeta != null ) { path . get ( fmd , xmlmeta ) ; return path ; } } if ( ( meta != null ) || ( ! pcOnly ) ) path . get ( fmd , allowNull ) ; return path ; } protected Object traverseStaticField ( Class < ? > cls , String field ) { } private boolean isMultiValuedTraversalAttempt ( Path path , String field ) { } protected abstract Class < ? > getDeclaredVariableType ( String name ) { } protected void setImplicitTypes ( Value val1 , Value val2 , Class < ? > expected ) { } protected static void setImplicitTypes ( Value val1 , Value val2 , Class < ? > expected , Resolver resolver ) { } public static void convertTypes ( Value val1 , Value val2 ) { } public static void convertTypesQuotedNumbers ( Value val1 , Value val2 ) { } public static boolean isNumeric ( Class < ? > type ) { } protected void setImplicitContainsTypes ( Value val1 , Value val2 , int op ) { } protected static void setImplicitType ( Value val , Class < ? > expected ) { } protected abstract Localizer getLocalizer ( ) { } protected abstract String currentQuery ( ) { } protected abstract void addSchemaToContext ( String alias , ClassMetaData meta ) { } protected abstract void addVariableToContext ( String id , Value var ) { } protected abstract Value getVariable ( String id ) { } }

Fix:
XMLMetaData xmlmeta = fmd . getRepository ( ) . getXMLMetaData ( fmd . getDeclaredType ( ) ) ;