Class StaleMetadataException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
dev.hardwood.reader.StaleMetadataException
- All Implemented Interfaces:
Serializable
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe check the supplied footer failed. -
Constructor Summary
ConstructorsConstructorDescriptionStaleMetadataException(String fileName, StaleMetadataException.Check check, Optional<String> sourceIdentity, Optional<String> fileIdentity, String detail) -
Method Summary
Modifier and TypeMethodDescriptioncheck()The check the supplied footer failed.The identity of the file being read; empty when it has none.fileName()TheInputFile.name()of the file being read.The identity of the file the supplied footer was read from; empty when it had none.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
StaleMetadataException
public StaleMetadataException(String fileName, StaleMetadataException.Check check, Optional<String> sourceIdentity, Optional<String> fileIdentity, String detail) - Parameters:
fileName- theInputFile.name()of the file being readcheck- the check the footer failedsourceIdentity- the footer'sParsedFooter.sourceIdentity()fileIdentity- the file'sInputFile.identity()detail- what the check found
-
-
Method Details
-
fileName
TheInputFile.name()of the file being read. -
check
The check the supplied footer failed. -
sourceIdentity
-
fileIdentity
-