apache/hadoop · error · InvalidRecordException
Null endpoint
Error message
Null endpoint
What it means
RegistryTypeUtils.retrieveAddressURLs converts a URI-typed endpoint's addresses into java.net.URL objects. Unlike retrieveAddressesUriType — which returns null for a null endpoint — this method deliberately rejects null and throws InvalidRecordException ('Null endpoint', with an empty path).
Source
Thrown at hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java:233
String val = address.get(field);
if (val == null) {
throw new InvalidRecordException("", "Missing address field: " + field);
}
return val;
}
/**
* Get the address URLs. Guranteed to return at least one address.
* @param epr endpoint
* @return the address as a URL
* @throws InvalidRecordException if the type is wrong, there are no addresses
* or the payload ill-formatted
* @throws MalformedURLException address can't be turned into a URL
*/
public static List<URL> retrieveAddressURLs(Endpoint epr)
throws InvalidRecordException, MalformedURLException {
if (epr == null) {
throw new InvalidRecordException("", "Null endpoint");
}
List<String> addresses = retrieveAddressesUriType(epr);
List<URL> results = new ArrayList<URL>(addresses.size());
for (String address : addresses) {
results.add(new URL(address));
}
return results;
}
/**
* 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 {View on GitHub (pinned to 2add963021)
Solutions
- Null-check the endpoint before calling: if (epr == null) skip or handle the absent case
- Filter null endpoints out of record.external/internal lists before processing
- Use retrieveAddressesUriType when a null-tolerant read (returns null) fits the control flow better
Example fix
// before
List<URL> urls = RegistryTypeUtils.retrieveAddressURLs(firstExternal(record)); // may be null
// after
Endpoint epr = firstExternal(record);
if (epr != null && AddressTypes.ADDRESS_URI.equals(epr.addressType)
&& epr.addresses != null && !epr.addresses.isEmpty()) {
List<URL> urls = RegistryTypeUtils.retrieveAddressURLs(epr);
} Defensive patterns
Strategy: type-guard
Validate before calling
if (epr == null) {
return Collections.emptyList(); // no endpoint -> no URLs
}
return RegistryTypeUtils.retrieveAddressURLs(epr); Type guard
static boolean isRetrievableEndpoint(Endpoint epr) {
return epr != null
&& AddressTypes.ADDRESS_URI.equals(epr.addressType)
&& epr.addresses != null && !epr.addresses.isEmpty();
} Try / catch
try {
urls = RegistryTypeUtils.retrieveAddressURLs(epr);
} catch (InvalidRecordException e) {
if ("Null endpoint".equals(e.getMessage())) {
return Collections.emptyList();
}
throw e;
} Prevention
- Null-check every element of record.external/internal before passing it to Registry accessors
- Remember retrieveAddressURLs rejects null while retrieveAddressesUriType returns null — pick deliberately
- Filter null endpoints out of lists right after deserialization
When it happens
Trigger: Passing a null Endpoint: taken from an empty external/internal list lookup, record.external.get(i) where the list contains nulls, or code assuming the null-tolerant behavior of retrieveAddressesUriType.
Common situations: Iterating ServiceRecord.external/internal without per-element null checks; endpoints cleared after record mutation; chaining accessors without intermediate validation.
Related errors
- Address type of %s does not match required type of %s
- No addresses in endpoint
- Null record
- null component type not allowed
- null value not allowed
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/6fb093658a18567c.
Report an issue: GitHub.