#vulnerable code 
                                @Override
    public void printStackTrace(PrintWriter writer) {
        if (borrowedBy != null) {
            borrowedBy.printStackTrace(writer);
        }
        if (usedBy != null) {
            usedBy.printStackTrace(writer);
        }
    } 
                            #location 4 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                @Override
    public void printStackTrace(PrintWriter writer) {
        Exception borrowedBy = this.borrowedBy;
        if (borrowedBy != null) {
            borrowedBy.printStackTrace(writer);
        }
        Exception usedBy = this.usedBy;
        if (usedBy != null) {
            usedBy.printStackTrace(writer);
        }
    }