Java Exceptions Catalog - Part 5: Reflection, XML & Desktop
Comprehensive guide to dynamic metaprogramming (java.lang.reflect & java.lang.invoke), JavaBeans introspection (java.beans), XML/SAX parsing (javax.xml), and desktop GUI faults (java.awt).
1. Reflection & Dynamic Invocation (java.lang.reflect & java.lang.invoke)
java.lang.reflect.InvocationTargetException
A wrapper exception thrown by reflective method calls (`Method.invoke()`) when the underlying target method throws an unhandled exception.
exception.getCause() or getTargetException().java.lang.reflect.UndeclaredThrowableException
Thrown by a Dynamic Proxy instance if the invocation handler's invoke method attempts to throw a checked exception not declared in the proxy interface signature.
java.lang.reflect.MalformedParameterizedTypeException
Thrown when a reflective method encounters a parameterized type that cannot be instantiated or instantiated incorrectly.
java.lang.reflect.MalformedParametersException
Indicates that the reflective parameters metadata stored in a class file is corrupt or malformed.
java.lang.invoke.WrongMethodTypeException
Thrown to indicate that a MethodHandle call was made with an incompatible or mismatched method type signature.
MethodType descriptor exactly or use MethodHandle.asType() to adapt parameters.2. JavaBeans & Introspection (java.beans Package)
java.beans.IntrospectionException
Occurs during JavaBean analysis if an exception occurs while matching getter/setter accessor methods or analyzing property descriptors.
3. XML, SAX & Transformation Exceptions (javax.xml Package)
org.xml.sax.SAXParseException
Encapsulates an XML parsing error or warning encountered while processing an XML document stream (e.g., unclosed tags or invalid syntax).
org.xml.sax.SAXException
General SAX exception wrapping underlying XML parser failures.
javax.xml.parsers.ParserConfigurationException
Indicates a configuration error in a DocumentBuilderFactory or SAXParserFactory instance.
javax.xml.transform.TransformerException
Specifies an exceptional condition that occurred during an XSLT transformation process.
javax.xml.transform.TransformerConfigurationException
Indicates a severe configuration fault while instantiating an XSLT Transformer object.
4. Desktop & GUI Exceptions (java.awt & javax.swing Packages)
java.awt.HeadlessException
Thrown when code that depends on a keyboard, display, or mouse is called in an environment that does not support a display (e.g., headless Linux server/container).
java.awt.headless=true and avoid invoking GUI components on headless cloud servers or containerized microservices.java.awt.AWTException
Signals that an Abstract Window Toolkit exception has occurred.
java.awt.FontFormatException
Thrown by Font.createFont() when a font file specified contains bad or invalid font data.
javax.swing.UndoableEditException
Indicates an UndoableEdit operation cannot be performed or undone.