#vulnerable code 
                                public void update(Guild guild) {
        if (!this.guilds.contains(guild.getRank())) {
            this.guilds.add(guild.getRank());
        } else {
            synchronized (guilds) {
                Collections.sort(guilds);
            }

            for (int i = 0; i < guilds.size(); i++) {
                Rank rank = guilds.get(i);
                rank.setPosition(i + 1);
            }
        }
    } 
                            #location 11 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public void update(Guild guild) {
        if (! this.guilds.contains(guild.getRank())) {
            this.guilds.add(guild.getRank());
        }

        Collections.sort(guilds);

        for (int i = 0; i < guilds.size(); i++) {
            Rank rank = guilds.get(i);
            rank.setPosition(i + 1);
        }
    }