/** * Validate the record by checking for null fields and other invalid * conditions * @param path path for exceptions * @param record record to validate. May be null * @throws InvalidRecordException on invalid entries */ public static void validateServiceRecord(String path, ServiceRecord record) throws InvalidRecordException { if (record == null) { throw new InvalidRecordException(path, "Null record"); } if (!ServiceRecord.RECORD_TYPE.equals(record.type)) { throw new InvalidRecordException(path, "invalid record type field: \"" + record.type + "\""); } if (record.external != null) { for (Endpoint endpoint : record.external) { validateEndpoint(path, endpoint); } } if (record.internal != null) { for (Endpoint endpoint : record.internal) { validateEndpoint(path, endpoint); } } }
/** * Validate the record by checking for null fields and other invalid * conditions * @param path path for exceptions * @param record record to validate. May be null * @throws InvalidRecordException on invalid entries */ public static void validateServiceRecord(String path, ServiceRecord record) throws InvalidRecordException { if (record == null) { throw new InvalidRecordException(path, "Null record"); } if (!ServiceRecord.RECORD_TYPE.equals(record.type)) { throw new InvalidRecordException(path, "invalid record type field: \"" + record.type + "\""); } if (record.external != null) { for (Endpoint endpoint : record.external) { validateEndpoint(path, endpoint); } } if (record.internal != null) { for (Endpoint endpoint : record.internal) { validateEndpoint(path, endpoint); } } }