Class StaleMetadataException

All Implemented Interfaces:
Serializable

@Experimental public class StaleMetadataException extends IOException

Raised when the footer a MetadataSource supplied does not describe the file being read.

The file itself is intact. Evicting the footer the source served for the file and opening a new reader, so that the source reads the footer afresh, is the remedy. For a cache keyed on the file's name and the identity its footer was read with:

try {
    read(path);
}
catch (StaleMetadataException e) {
    e.sourceIdentity().ifPresent(id -> cache.remove(new FooterKey(e.fileName(), id)));
    read(path);
}

The reader raises it before reading any data of the file.

See Also: