Buggy code:
private { } @ Override public QueryResult insert ( List < Variant > variants , String studyName , QueryOptions options ) { } @ Override public QueryResult delete ( Query query , QueryOptions options ) { } @ Override public QueryResult deleteSamples ( String studyName , List < String > sampleNames , QueryOptions options ) { } @ Override public QueryResult deleteFile ( String studyName , String fileName , QueryOptions options ) { } @ Override public QueryResult deleteStudy ( String studyName , QueryOptions options ) { } @ Override public QueryResult < Variant > get ( Query query , QueryOptions options ) { } @ Override public List < QueryResult < Variant > > get ( List < Query > queries , QueryOptions options ) { } @ Override public QueryResult < Long > count ( Query query ) { } @ Override public QueryResult distinct ( Query query , String field ) { } @ Override public VariantDBIterator iterator ( ) { } @ Override public VariantDBIterator iterator ( Query query , QueryOptions options ) { } @ Override public void forEach ( Consumer < ? super Variant > action ) { } @ Override public void forEach ( Query query , Consumer < ? super Variant > action , QueryOptions options ) { } @ Override public QueryResult getFrequency ( Query query , Region region , int regionIntervalSize ) { } @ Override public QueryResult rank ( Query query , String field , int numResults , boolean asc ) { } @ Override public QueryResult groupBy ( Query query , String field , QueryOptions options ) { } @ Override public QueryResult groupBy ( Query query , List < String > fields , QueryOptions options ) { } @ Override public QueryResult addStats ( List < VariantStatsWrapper > variantStatsWrappers , String studyName , QueryOptions queryOptions ) { } @ Override public QueryResult updateStats ( List < VariantStatsWrapper > variantStatsWrappers , String studyName , QueryOptions options ) { } @ Override public QueryResult updateStats ( List < VariantStatsWrapper > variantStatsWrappers , StudyConfiguration studyConfiguration , QueryOptions options ) { } @ Override public QueryResult deleteStats ( String studyName , String cohortName , QueryOptions options ) { } @ Override public QueryResult addAnnotations ( List < VariantAnnotation > variantAnnotations , QueryOptions queryOptions ) { } @ Override public QueryResult updateAnnotations ( List < VariantAnnotation > variantAnnotations , QueryOptions queryOptions ) { } @ Override public QueryResult deleteAnnotation ( String annotationId , Query query , QueryOptions queryOptions ) { } @ Override public boolean close ( ) { } private QueryBuilder parseQuery ( Query query , QueryBuilder builder ) { if ( query != null ) { if ( ( ( query . get ( CHROMOSOME . key ( ) ) ) != null ) && ( ! ( query . getString ( CHROMOSOME . key ( ) ) . isEmpty ( ) ) ) ) { List < String > chromosomes = query . getAsStringList ( CHROMOSOME . key ( ) ) ; LinkedList < String > regions = new LinkedList ( query . getAsStringList ( REGION . key ( ) ) ) ; regions . addAll ( chromosomes ) ; query . put ( REGION . key ( ) , regions ) ; } if ( ( ( query . get ( REGION . key ( ) ) ) != null ) && ( ! ( query . getString ( REGION . key ( ) ) . isEmpty ( ) ) ) ) { List < String > stringList = query . getAsStringList ( REGION . key ( ) ) ; List < Region > regions = new ArrayList < > ( stringList . size ( ) ) ; for ( String reg : stringList ) { Region region = Region . parseRegion ( reg ) ; regions . add ( region ) ; } getRegionFilter ( regions , builder ) ; } if ( ( ( query . get ( ID . key ( ) ) ) != null ) && ( ! ( query . getString ( ID . key ( ) ) . isEmpty ( ) ) ) ) { String ids = query . getString ( ID . key ( ) ) ; addQueryStringFilter ( ( ( ( ( ( DBObjectToVariantConverter . ANNOTATION_FIELD ) + "." ) + ( DBObjectToVariantAnnotationConverter . XREFS_FIELD ) ) + "." ) + ( DBObjectToVariantAnnotationConverter . XREF_ID_FIELD ) ) , ids , builder , VariantMongoDBAdaptor . QueryOperation . OR ) ; addQueryStringFilter ( IDS_FIELD , ids , builder , VariantMongoDBAdaptor . QueryOperation . OR ) ; } if ( query . containsKey ( GENE . key ( ) ) ) { String xrefs = query . getString ( GENE . key ( ) ) ; addQueryStringFilter ( ( ( ( ( ( DBObjectToVariantConverter . ANNOTATION_FIELD ) + "." ) + ( DBObjectToVariantAnnotationConverter . XREFS_FIELD ) ) + "." ) + ( DBObjectToVariantAnnotationConverter . XREF_ID_FIELD ) ) , xrefs , builder , VariantMongoDBAdaptor . QueryOperation . OR ) ; } if ( ( query . containsKey ( REFERENCE . key ( ) ) ) && ( ( query . getString ( REFERENCE . key ( ) ) ) != null ) ) { addQueryStringFilter ( REFERENCE_FIELD , query . getString ( REFERENCE . key ( ) ) , builder , VariantMongoDBAdaptor . QueryOperation . AND ) ; } if ( ( query . containsKey ( ALTERNATE . key ( ) ) ) && ( ( query . getString ( ALTERNATE . key ( ) ) ) != null ) ) { addQueryStringFilter ( ALTERNATE_FIELD , query . getString ( ALTERNATE . key ( ) ) , builder , VariantMongoDBAdaptor . QueryOperation . AND ) ; } if ( ( query . containsKey ( TYPE . key ( ) ) ) && ( ! ( query . getString ( TYPE . key ( ) ) . isEmpty ( ) ) ) ) { addQueryStringFilter ( TYPE_FIELD , query . getString ( TYPE . key ( ) ) , builder , VariantMongoDBAdaptor . QueryOperation . AND ) ; } if ( query . containsKey ( ANNOTATION_EXISTS . key ( ) ) ) { builder . and ( ( ( ( DBObjectToVariantConverter . ANNOTATION_FIELD ) + "." ) + ( DBObjectToVariantAnnotationConverter . ANNOT_ID_FIELD ) ) ) ; builder . exists ( query . getBoolean ( ANNOTATION_EXISTS . key ( ) ) ) ; } if ( query . containsKey ( ANNOT_XREF . key ( ) ) ) { <START_BUG> String xrefs = query . getString ( GENE . key ( ) ) ; <END_BUG>

Fix:
String xrefs = query . getString ( ANNOT_XREF . key ( ) ) ;