Buggy code:
} for ( String SoName : SoNames ) { consequenceTypeList . add ( new ConsequenceType ( consequenceTypeTemplate . getGeneName ( ) , consequenceTypeTemplate . getEnsemblGeneId ( ) , consequenceTypeTemplate . getEnsemblTranscriptId ( ) , consequenceTypeTemplate . getStrand ( ) , consequenceTypeTemplate . getBiotype ( ) , consequenceTypeTemplate . getcDnaPosition ( ) , SoName ) ) ; } break ; } } else { for ( String SoName : SoNames ) { consequenceTypeList . add ( new ConsequenceType ( consequenceTypeTemplate . getGeneName ( ) , consequenceTypeTemplate . getEnsemblGeneId ( ) , consequenceTypeTemplate . getEnsemblTranscriptId ( ) , consequenceTypeTemplate . getStrand ( ) , consequenceTypeTemplate . getBiotype ( ) , SoName ) ) ; } } } else { solveTranscriptFlankingRegions ( SoNames , transcriptStart , transcriptEnd , variantStart , variantEnd , "downstream_gene_variant" , "upstream_gene_variant" ) ; if ( regionsOverlap ( transcriptStart , transcriptEnd , variantStart , variantEnd ) ) { switch ( transcriptBiotype ) { case 1 : case 2 : case 3 : case 4 : case 5 : case 6 : case 7 : case 16 : case 20 : case 21 : case 23 : case 24 : case 35 : case 36 : case 51 : solveCodingNegativeTranscript ( variant , SoNames , transcriptInfo , transcriptStart , transcriptEnd , variantStart , variantEnd , consequenceTypeTemplate ) ; for ( String SoName : SoNames ) { consequenceTypeList . add ( new ConsequenceType ( consequenceTypeTemplate . getGeneName ( ) , consequenceTypeTemplate . getEnsemblGeneId ( ) , consequenceTypeTemplate . getEnsemblTranscriptId ( ) , consequenceTypeTemplate . getStrand ( ) , consequenceTypeTemplate . getBiotype ( ) , consequenceTypeTemplate . getcDnaPosition ( ) , consequenceTypeTemplate . getCdsPosition ( ) , consequenceTypeTemplate . getaPosition ( ) , consequenceTypeTemplate . getaChange ( ) , consequenceTypeTemplate . getCodon ( ) , SoName ) ) ; } break ; case 30 : SoNames . add ( "NMD_transcript_variant" ) ; case 0 : case 17 : case 18 : case 19 : case 22 : case 25 : case 26 : case 27 : case 28 : case 29 : case 31 : case 32 : case 37 : case 33 : case 34 : case 38 : case 39 : case 40 : case 41 : case 42 : case 43 : case 44 : case 45 : case 46 : case 47 : case 48 : case 49 : case 50 : SoNames . add ( "non_coding_transcript_variant" ) ; exonVariant = solveNonCodingNegativeTranscript ( variant , SoNames , transcriptInfo , transcriptStart , transcriptEnd , variantStart , variantEnd , consequenceTypeTemplate ) ; if ( ( transcriptBiotype == 18 ) && exonVariant ) { SoNames . add ( "mature_miRNA_variant" ) ; } for ( String SoName : SoNames ) { consequenceTypeList . add ( new ConsequenceType ( consequenceTypeTemplate . getGeneName ( ) , consequenceTypeTemplate . getEnsemblGeneId ( ) , consequenceTypeTemplate . getEnsemblTranscriptId ( ) , consequenceTypeTemplate . getStrand ( ) , consequenceTypeTemplate . getBiotype ( ) , consequenceTypeTemplate . getcDnaPosition ( ) , SoName ) ) ; } break ; } } else { for ( String SoName : SoNames ) { consequenceTypeList . add ( new ConsequenceType ( consequenceTypeTemplate . getGeneName ( ) , consequenceTypeTemplate . getEnsemblGeneId ( ) , consequenceTypeTemplate . getEnsemblTranscriptId ( ) , consequenceTypeTemplate . getStrand ( ) , consequenceTypeTemplate . getBiotype ( ) , SoName ) ) ; } } } } } BasicDBList regulatoryInfoList = ( ( BasicDBList ) ( regulatoryQueryResult . getResult ( ) ) ) ; if ( ! ( regulatoryInfoList . isEmpty ( ) ) ) { consequenceTypeList . add ( new ConsequenceType ( "regulatory_region_variant" ) ) ; i = 0 ; do { regulatoryInfo = ( ( BasicDBObject ) ( regulatoryInfoList . get ( i ) ) ) ; regulatoryType = ( ( String ) ( regulatoryInfo . get ( "featureType" ) ) ) ; TFBSFound = ( regulatoryType . equals ( "TF_binding_site" ) ) || ( regulatoryType . equals ( "TF_binding_site_motif" ) ) ; i ++ ; } while ( ( i < ( regulatoryInfoList . size ( ) ) ) && ( ! TFBSFound ) ) ; if ( TFBSFound ) { consequenceTypeList . add ( new ConsequenceType ( "TF_binding_site_variant" ) ) ; } } else { int b ; b = 1 ; } if ( ( consequenceTypeList . size ( ) ) == 0 ) { consequenceTypeList . add ( new ConsequenceType ( "intergenic_variant" ) ) ; } queryResult . setId ( variant . toString ( ) ) ; queryResult . setDBTime ( ( dbTimeEnd - dbTimeStart ) ) ; <START_BUG> queryResult . setNumResults ( SoNames . size ( ) ) ; <END_BUG> queryResult . setResult ( consequenceTypeList ) ; return queryResult ; } private void solveTranscriptFlankingRegions ( HashSet < String > SoNames , Integer transcriptStart , Integer transcriptEnd , Integer variantStart , Integer variantEnd , String leftRegionTag , String rightRegionTag ) { } private void solveCodingPositiveTranscript ( GenomicVariant variant , HashSet < String > SoNames , BasicDBObject transcriptInfo , Integer transcriptStart , Integer transcriptEnd , Integer variantStart , Integer variantEnd , ConsequenceType consequenceTypeTemplate ) { } private void solveCodingNegativeTranscript ( GenomicVariant variant , HashSet < String > SoNames , BasicDBObject transcriptInfo , Integer transcriptStart , Integer transcriptEnd , Integer variantStart , Integer variantEnd , ConsequenceType consequenceTypeTemplate ) { } private Boolean solveNonCodingPositiveTranscript ( GenomicVariant variant , HashSet < String > SoNames , BasicDBObject transcriptInfo , Integer transcriptStart , Integer transcriptEnd , Integer variantStart , Integer variantEnd , ConsequenceType consequenceTypeTemplate ) { } private Boolean solveNonCodingNegativeTranscript ( GenomicVariant variant , HashSet < String > SoNames , BasicDBObject transcriptInfo , Integer transcriptStart , Integer transcriptEnd , Integer variantStart , Integer variantEnd , ConsequenceType consequenceTypeTemplate ) { } @ Override public List < QueryResult > getAllConsequenceTypesByVariantList ( List < GenomicVariant > variants , QueryOptions options ) { } @ Override public QueryResult getAllEffectsByVariant ( GenomicVariant variant , QueryOptions options ) { } @ Override public List < QueryResult > getAllEffectsByVariantList ( List < GenomicVariant > variants , QueryOptions options ) { } }

Fix:
queryResult . setNumResults ( consequenceTypeList . size ( ) ) ;