Package com.luciad.model
Class TLcdModelDecodeException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.luciad.model.TLcdModelDecodeException
- All Implemented Interfaces:
Serializable
An
IOException subclass that provides structured information about
why an ILcdModelDecoder.decode(String) call failed.
The category allows callers to distinguish between
different types of failures (e.g. unsupported version vs. malformed content) and
respond appropriately.
Decoder implementations may throw this exception, but are not
required to — throwing a plain IOException remains valid.
Usage example
ILcdModelDecoder decoder = ...;
try {
ILcdModel model = decoder.decode(sourceName);
} catch (TLcdModelDecodeException e) {
switch (e.getCategory()) {
case SOURCE_NOT_AVAILABLE:
showError("Cannot open " + sourceName + ": " + e.getMessage());
break;
case UNSUPPORTED_FORMAT:
showError("Unrecognized file format: " + e.getMessage());
break;
case UNSUPPORTED_VERSION:
showError("Unsupported format version: " + e.getMessage());
break;
case MALFORMED_CONTENT:
case INVALID_CONTENT:
showError("Cannot decode file contents: " + e.getMessage());
break;
default:
showError("Decode failed: " + e.getMessage());
break;
}
} catch (IOException e) {
// Fallback for decoders that do not throw TLcdModelDecodeException.
showError("Decode failed: " + e.getMessage());
}
- Since:
- 2026.0.11
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumA coarse, format-agnostic classification of the decode failure. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new exception with the given category and no detail message.TLcdModelDecodeException(TLcdModelDecodeException.Category aCategory, String aMessage) Creates a new exception with the given category and detail message.TLcdModelDecodeException(TLcdModelDecodeException.Category aCategory, String aMessage, Throwable aCause) Creates a new exception with the given category, detail message, and cause.TLcdModelDecodeException(TLcdModelDecodeException.Category aCategory, Throwable aCause) Creates a new exception with the given category and cause. -
Method Summary
Modifier and TypeMethodDescriptionReturns the category that classifies this decode failure.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
TLcdModelDecodeException
Creates a new exception with the given category and no detail message.- Parameters:
aCategory- the failure category, must not benull.
-
TLcdModelDecodeException
Creates a new exception with the given category and detail message.- Parameters:
aCategory- the failure category, must not benull.aMessage- a human-readable description of the failure, ornull.
-
TLcdModelDecodeException
public TLcdModelDecodeException(TLcdModelDecodeException.Category aCategory, String aMessage, Throwable aCause) Creates a new exception with the given category, detail message, and cause.- Parameters:
aCategory- the failure category, must not benull.aMessage- a human-readable description of the failure, ornull.aCause- the underlying cause, ornullif unknown.
-
TLcdModelDecodeException
Creates a new exception with the given category and cause. The detail message is derived from the cause.- Parameters:
aCategory- the failure category, must not benull.aCause- the underlying cause, ornullif unknown.
-
-
Method Details
-
getCategory
Returns the category that classifies this decode failure.- Returns:
- the failure category, never
null.
-
getMessage
- Overrides:
getMessagein classThrowable
-