#vulnerable code 
                                public void rollbackHeaderDigest(String hash) {
        for (int i = 0; i < headerDigestList.size(); i++) {
            HeaderDigest headerDigest = headerDigestList.get(i);
            if (headerDigest.getHash().equals(hash)) {
                headerDigestList.remove(headerDigest);
                for (int x = i + 1; x < headerDigestList.size(); x++) {
                    headerDigestList.remove(x);
                }
                this.lastHd = null;
                break;
            }
        }
    } 
                            #location 9 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public void rollbackHeaderDigest(String hash) {
        for (int i = 0; i < headerDigestList.size(); i++) {
            HeaderDigest headerDigest = headerDigestList.get(i);
            if (headerDigest.getHash().equals(hash)) {
                headerDigestList.remove(headerDigest);
                for (int x = i + 1; x < headerDigestList.size(); x++) {
                    headerDigestList.remove(x);
                }
                break;
            }
        }
    }