Class JavaModelException

  • All Implemented Interfaces:
    Serializable

    public class JavaModelException
    extends CoreException
    A checked exception representing a failure in the Java model. Java model exceptions contain a Java-specific status object describing the cause of the exception.

    Instances of this class are automatically created by the Java model when problems arise, so there is generally no need for clients to create instances.

    See Also:
    IJavaModelStatus, IJavaModelStatusConstants, Serialized Form
    Restriction:
    This class is not intended to be subclassed by clients.
    • Constructor Detail

      • JavaModelException

        public JavaModelException​(Throwable e,
                                  int code)
        Creates a Java model exception that wrappers the given Throwable. The exception contains a Java-specific status object with severity IStatus.ERROR and the given status code.
        Parameters:
        e - the Throwable
        code - one of the Java-specific status codes declared in IJavaModelStatusConstants
        See Also:
        IJavaModelStatusConstants, IStatus.ERROR
      • JavaModelException

        public JavaModelException​(CoreException exception)
        Creates a Java model exception for the given CoreException. Equivalent to JavaModelException(exception,IJavaModelStatusConstants.CORE_EXCEPTION.
        Parameters:
        exception - the CoreException
      • JavaModelException

        public JavaModelException​(IJavaModelStatus status)
        Creates a Java model exception for the given Java-specific status object.
        Parameters:
        status - the Java-specific status object
      • JavaModelException

        public JavaModelException​(IStatus status)
        Creates a Java model exception for the given status object.
        Since:
        3.14
    • Method Detail

      • getException

        public Throwable getException()
        Returns the underlying Throwable that caused the failure.
        Returns:
        the wrapped Throwable, or null if the direct case of the failure was at the Java model layer
      • getJavaModelStatus

        public IJavaModelStatus getJavaModelStatus()
        Returns the Java model status object for this exception. Equivalent to (IJavaModelStatus) getStatus().
        Returns:
        a status object
      • printStackTrace

        public void printStackTrace​(PrintStream output)
        Prints this exception's stack trace to the given print stream.
        Overrides:
        printStackTrace in class CoreException
        Parameters:
        output - the print stream
        Since:
        3.0
      • printStackTrace

        public void printStackTrace​(PrintWriter output)
        Prints this exception's stack trace to the given print writer.
        Overrides:
        printStackTrace in class CoreException
        Parameters:
        output - the print writer
        Since:
        3.0