Java Exception Hierarchy
Introduction
Section titled “Introduction”Exception handling allows problems detection within a Java application.
The main goals of exception handling are:
- separate business logic from error handling logic,
- log application issues in a clear way,
- recover of shutdown in a gracefull way.
JVM stands for Java Virtual Machine.
The Hierarchy
Section titled “The Hierarchy”At the root there is Throwable, which branches into:
Exception: recoverable conditions,Error: serious issues beyond program control.
Moreover, exceptions can be:
- checked: must be declared or caught (like
IOException), - unchecked: do not need explicit handling (like
NullPointerException).
As of Java 21, Exception and Error subclassea are:
DirectoryThrowable
DirectoryException
- AbsentInformationException line number or variable info not available
- AgentInitializationException agent failed to initialize
- AgentLoadException agent cannot be loaded into the target JVM
- AlreadyBoundException try to bind an object to a name already associated
- AttachNotSupportedException
- AWTException
- BackingStoreException
- BadAttributeValueExpException
- BadBinaryOpValueExpException
- BadLocationException
- BadStringOperationException
- BrokenBarrierException
- CardException
- CertificateException
- ClassNotLoadedException
- CloneNotSupportedException
- DataFormatException
- DatatypeConfigurationException
- DestroyFailedException
- ExecutionControl.ExecutionControlException
- ExecutionException
- ExpandVetoException
- FontFormatException
- GeneralSecurityException
- GSSException
- IllegalClassFormatException
- IllegalConnectorArgumentsException
- IncompatibleThreadStateException
- InterruptedException an occupied thread is interrupted
- IntrospectionException
- InvalidApplicationException
- InvalidMidiDataException
- InvalidPreferencesFormatException
- InvalidTargetObjectTypeException
- InvalidTypeException
- InvocationException
- IOException an I/O exception of some sort has occurred
- JMException
- JShellException
- KeySelectorException
- LambdaConversionException
- LineUnavailableException
- MarshalException
- MidiUnavailableException
- MimeTypeParseException
- NamingException
- NoninvertibleTransformException
- NotBoundException
- ParseException
- ParserConfigurationException
- PrinterException
- PrintException
- PrivilegedActionException
- PropertyVetoException
- ReflectiveOperationException
- RefreshFailedException
- RuntimeException can be thrown during JVM operation
- SAXException
- ScriptException
- ServerNotActiveException
- SQLException
- StringConcatException
- TimeoutException
- TooManyListenersException
- TransformerException
- TransformException
- UnmodifiableClassException
- UnsupportedAudioFileException
- UnsupportedCallbackException
- UnsupportedFlavorException
- UnsupportedLookAndFeelException
- URIReferenceException
- URISyntaxException
- VMStartException
- XAException
- XMLParseException
- XMLSignatureException
- XMLStreamException
- XPathException
DirectoryError
- AnnotationFormatError
- AssertionError
- AWTError
- CoderMalfunctionError
- FactoryConfigurationError
- FactoryConfigurationError
- IOError
- LinkageError
- SchemaFactoryConfigurationError
- ServiceConfigurationError
- ThreadDeath
- TransformerFactoryConfigurationError
DirectoryVirtualMachineError the JVM is broken
- InternalError unexpected internal error
- OutOfMemoryError JVM cannot allocate an object
- StackOverflowError an app recurses too deeply
- UnknownError unknown but serious exception
Conclusion
Section titled “Conclusion”Some link for reference: