#vulnerable code 
                                @Override
    public String validateRecord(Record record) {

        String error = super.validateRecord(record);
        if (error.length() == 0){//no errors after applying declared validators on each field => all fields are valid

            //add custom validation : field 2 content must starts with field 1 content
            final String content1 = record.getFieldContentByIndex(1);
            final String content2 = record.getFieldContentByIndex(2);
            if (!content2.startsWith(content1))
                return "field 2 content [" + content2 + "] must start with field 1 content [" + content1 + "]";
        }
        return "";
    } 
                            #location 5 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Override
    public String validateRecord(Record record) {

        String error = super.validateRecord(record);
        if (error == null){//no errors after applying declared validators on each field => all fields are valid

            //add custom validation : field 2 content must start with field's 1 content
            final String content1 = record.getFieldContentByIndex(1);
            final String content2 = record.getFieldContentByIndex(2);
            if (!content2.startsWith(content1))
                return "field 2 content [" + content2 + "] must start with field's 1 content [" + content1 + "]";
        }
        return null;
    }