Source:
<code>public void checkReferencesAndUniqueness(String keyValue, int lineNumber, Field field, String string, JdbcGtfsLoader.ReferenceTracker referenceTracker) { String keyField = getKeyFieldName(); String orderField = getOrderFieldName(); String uniqueKeyField = orderField != null ? orderField : keyField; String transitId = String.join(":", keyField, keyValue); if (!field.isRequired() && "".equals(string)) return; boolean isOrderField = field.name.equals(orderField); if (field.isForeignReference()) { String referenceField = field.referenceTable.getKeyFieldName(); String referenceTransitId = String.join(":", referenceField, string); if (!referenceTracker.transitIds.contains(referenceTransitId)) { NewGTFSError referentialIntegrityError = NewGTFSError.forLine(this, lineNumber, REFERENTIAL_INTEGRITY, referenceTransitId) .setEntityId(keyValue); if (isOrderField) { referentialIntegrityError.setSequence(string); } referenceTracker.errorStorage.storeError(referentialIntegrityError); } } Set<String> listOfUniqueIds = referenceTracker.transitIds; String uniqueId = transitId; if (field.isForeignReference()) return; if (field.name.equals(uniqueKeyField)) { if (isOrderField) { listOfUniqueIds = referenceTracker.transitIdsWithSequence; uniqueId = String.join(":", field.name, keyValue, string); } boolean valueAlreadyExists = !listOfUniqueIds.add(uniqueId); <START> if (!this.name.equals("calendar_dates") && valueAlreadyExists) { <END> NewGTFSError duplicateIdError = NewGTFSError.forLine(this, lineNumber, DUPLICATE_ID, uniqueId) .setEntityId(keyValue); if (isOrderField) { duplicateIdError.setSequence(string); } referenceTracker.errorStorage.storeError(duplicateIdError); } } else { listOfUniqueIds.add(uniqueId); } }</code><technical_language>strange a hard coded single exception here. This code is a conditional field.name.equals(uniqueKeyField). Do need flag this field "unique key field" in calendar_dates unique? Is a good idea do so</technical_language>

Target:
public void checkReferencesAndUniqueness(String keyValue, int lineNumber, Field field, String string, JdbcGtfsLoader.ReferenceTracker referenceTracker) { String keyField = getKeyFieldName(); String orderField = getOrderFieldName(); String uniqueKeyField = !hasUniqueKeyField ? null : orderField != null ? orderField : keyField; String transitId = String.join(":", keyField, keyValue); if (!field.isRequired() && "".equals(string)) return; boolean isOrderField = field.name.equals(orderField); if (field.isForeignReference()) { String referenceField = field.referenceTable.getKeyFieldName(); String referenceTransitId = String.join(":", referenceField, string); if (!referenceTracker.transitIds.contains(referenceTransitId)) { NewGTFSError referentialIntegrityError = NewGTFSError.forLine( this, lineNumber, REFERENTIAL_INTEGRITY, referenceTransitId) .setEntityId(keyValue); if (isOrderField) { referentialIntegrityError.setSequence(string); } referenceTracker.errorStorage.storeError(referentialIntegrityError); } } Set<String> listOfUniqueIds = referenceTracker.transitIds; String uniqueId = transitId; if (field.isForeignReference()) return; if (field.name.equals(uniqueKeyField)) { if (isOrderField) { listOfUniqueIds = referenceTracker.transitIdsWithSequence; uniqueId = String.join(":", field.name, keyValue, string); } boolean valueAlreadyExists = !listOfUniqueIds.add(uniqueId); if (valueAlreadyExists) { NewGTFSError duplicateIdError = NewGTFSError.forLine(this, lineNumber, DUPLICATE_ID, uniqueId) .setEntityId(keyValue); if (isOrderField) { duplicateIdError.setSequence(string); } referenceTracker.errorStorage.storeError(duplicateIdError); } } else { listOfUniqueIds.add(uniqueId); } }