Buggy code:
public class Stats extends CmdGeneral { private static final Logger log = LoggerFactory . getLogger ( Stats . class ) ; private String hostName ; private String dbName ; private static MongoCollection vocabCollection ; private static MongoCollection langCollection ; private static Jongo jongo ; public static void main ( String ... args ) { } private String configFilePath ; public Stats ( String [ ] args ) { } @ Override protected String getCommandName ( ) { } @ Override protected String getSummary ( ) { } @ Override protected void processModulesAndArgs ( ) { } @ Override protected void exec ( ) { long startTime = System . currentTimeMillis ( ) ; Stats . log . info ( "#######<seq2seq4repair_space><Stats><seq2seq4repair_space>#######" ) ; MongoCursor < Vocabulary > vocabs = Stats . vocabCollection . find ( ) . as ( Vocabulary . class ) ; List < Vocabulary > vocabList = new ArrayList < Vocabulary > ( ) ; for ( Vocabulary vocab : vocabs ) { vocabList . add ( vocab ) ; } MongoCursor < Language > langs = Stats . langCollection . find ( ) . as ( Language . class ) ; List < Language > langList = new ArrayList < Language > ( ) ; for ( Language lang : langs ) { langList . add ( lang ) ; } List < StatVocab > statVocabs = new ArrayList < StatVocab > ( ) ; for ( Vocabulary vocab : vocabList ) { StatVocab statVoc = new StatVocab ( vocab . getUri ( ) , vocab . getNsp ( ) , vocab . getPrefix ( ) ) ; statVocabs . add ( statVoc ) ; } MongoCollection statCollection = DropCreateCollection ( "statvocabularies" , Stats . jongo ) ; statCollection . insert ( statVocabs . toArray ( ) ) ; List < StatTag > statTags = new ArrayList < StatTag > ( ) ; List < StatLang > statLangs = new ArrayList < StatLang > ( ) ; for ( Vocabulary vocab : vocabList ) { StatVocab statVoc = new StatVocab ( vocab . getUri ( ) , vocab . getNsp ( ) , vocab . getPrefix ( ) ) ; if ( ( vocab . getTags ( ) ) != null ) { for ( String tag : vocab . getTags ( ) ) { StatTag statTag = new StatTag ( tag ) ; statTag . addOccurrence ( ) ; <START_BUG> if ( ( statTags . indexOf ( statTag ) ) > 0 ) <END_BUG> statTags . get ( statTags . indexOf ( statTag ) ) . addOccurrence ( ) ; else statTags . add ( statTag ) ; } } VocabularyVersionWrapper lVersion = vocab . getLastVersion ( ) ; if ( lVersion != null ) { statVoc . addOutRelDisjunc ( lVersion . getRelDisjunc ( ) , statCollection ) ; statVoc . addOutRelEquivalent ( lVersion . getRelEquivalent ( ) , statCollection ) ; statVoc . addOutRelExtends ( lVersion . getRelExtends ( ) , statCollection ) ; statVoc . addOutRelGeneralizes ( lVersion . getRelGeneralizes ( ) , statCollection ) ; statVoc . addOutRelImports ( lVersion . getRelImports ( ) , statCollection ) ; statVoc . addOutRelMetadata ( lVersion . getRelMetadata ( ) , statCollection ) ; statVoc . addOutRelSpecializes ( lVersion . getRelSpecializes ( ) , statCollection ) ; if ( ( lVersion . getLanguageIds ( ) ) != null ) { for ( String lang : lVersion . getLanguageIds ( ) ) { StatLang statLang = new StatLang ( lang ) ; statLang . addOccurrence ( ) ; if ( ( statLangs . indexOf ( statLang ) ) > 0 ) statLangs . get ( statLangs . indexOf ( statLang ) ) . addOccurrence ( ) ; else statLangs . add ( statLang ) ; } } } for ( Vocabulary voc : vocabList ) { VocabularyVersionWrapper lastVersion = voc . getLastVersion ( ) ; if ( lastVersion != null ) { if ( ( ( lastVersion . getRelDisjunc ( ) ) != null ) && ( lastVersion . getRelDisjunc ( ) . contains ( statVoc . getNsp ( ) ) ) ) statVoc . addIncomRelDisjunc ( voc . getUri ( ) , statCollection ) ; if ( ( ( lastVersion . getRelEquivalent ( ) ) != null ) && ( lastVersion . getRelEquivalent ( ) . contains ( statVoc . getNsp ( ) ) ) ) statVoc . addIncomRelEquivalent ( voc . getUri ( ) , statCollection ) ; if ( ( ( lastVersion . getRelExtends ( ) ) != null ) && ( lastVersion . getRelExtends ( ) . contains ( statVoc . getNsp ( ) ) ) ) statVoc . addIncomRelExtends ( voc . getUri ( ) , statCollection ) ; if ( ( ( lastVersion . getRelGeneralizes ( ) ) != null ) && ( lastVersion . getRelGeneralizes ( ) . contains ( statVoc . getNsp ( ) ) ) ) statVoc . addIncomRelGeneralizes ( voc . getUri ( ) , statCollection ) ; if ( ( ( lastVersion . getRelImports ( ) ) != null ) && ( lastVersion . getRelImports ( ) . contains ( statVoc . getUri ( ) ) ) ) statVoc . addIncomRelImports ( voc . getUri ( ) , statCollection ) ; if ( ( ( lastVersion . getRelMetadata ( ) ) != null ) && ( lastVersion . getRelMetadata ( ) . contains ( statVoc . getNsp ( ) ) ) ) statVoc . addIncomRelMetadata ( voc . getUri ( ) , statCollection ) ; if ( ( ( lastVersion . getRelSpecializes ( ) ) != null ) && ( lastVersion . getRelSpecializes ( ) . contains ( statVoc . getNsp ( ) ) ) ) statVoc . addIncomRelSpecializes ( voc . getUri ( ) , statCollection ) ; } } statVocabs . add ( statVoc ) ; } for ( StatVocab statVocab : statVocabs ) { statCollection . update ( "{uri:#}" , statVocab . getUri ( ) ) . with ( statVocab ) ; }

Fix:
if ( ( statTags . indexOf ( statTag ) ) > ( - 1 ) )