Class VilException

  • All Implemented Interfaces:
    java.io.Serializable, IIdentifiable

    public class VilException
    extends AbstractException
    Defines a specific exception issued when building up the model fails for some reason.
    Author:
    Holger Eichelberger
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      VilException​(java.lang.String message, int id)
      Creates a buildlang exception based on a given message.
      VilException​(java.lang.String message, java.lang.Throwable cause, int id)
      Creates a buildlang exception from a message and an optional cause.
      VilException​(java.lang.Throwable throwable, int id)
      Creates an exception from a throwable.
      VilException​(java.util.List<VilException> causes)
      Creates a new exception.
      VilException​(AbstractException cause)
      Creates an exception from a known exception as cause.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static VilException getFirstCause​(java.util.List<VilException> causes)
      Returns the first cause in case of multiple causes.
      private static int getFirstId​(java.util.List<VilException> causes)
      Returns the first cause in case of multiple causes.
      private static java.lang.String getFirstMessage​(java.util.List<VilException> causes)
      Returns the first message in case of multiple causes.
      void printStackTrace​(java.io.PrintStream stream)  
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ID_NOT_FOUND

        public static final int ID_NOT_FOUND
        Defines an identifier if something cannot be found.
        See Also:
        Constant Field Values
      • ID_IO

        public static final int ID_IO
        Defines an identifier if something with I/O goes wrong.
        See Also:
        Constant Field Values
      • ID_IS_CONSTANT

        public static final int ID_IS_CONSTANT
        Defines an identifier if something is constant.
        See Also:
        Constant Field Values
      • ID_RUNTIME_STARTRULE

        public static final int ID_RUNTIME_STARTRULE
        Defines an identifier if something is wrong with the start rule.
        See Also:
        Constant Field Values
      • ID_RUNTIME_PARAMETER

        public static final int ID_RUNTIME_PARAMETER
        Defines an identifier if something is wrong with the runtime parameter.
        See Also:
        Constant Field Values
      • ID_CANNOT_RESOLVE_JAVA_EXTENSION

        public static final int ID_CANNOT_RESOLVE_JAVA_EXTENSION
        Defines an identifier if a Java extension class cannot be resolved.
        See Also:
        Constant Field Values
      • ID_RUNTIME_CYCLE

        public static final int ID_RUNTIME_CYCLE
        Defines an identifier if something goes into cycles while runtime.
        See Also:
        Constant Field Values
      • ID_RUNTIME_RULE_FAILED

        public static final int ID_RUNTIME_RULE_FAILED
        Defines an identifier if rules failed at runtime.
        See Also:
        Constant Field Values
      • ID_RUNTIME_TYPE

        public static final int ID_RUNTIME_TYPE
        Defines an identifier if something is wrong a value to type assignment at runtime.
        See Also:
        Constant Field Values
      • ID_RUNTIME_NOT_RESOLVED

        public static final int ID_RUNTIME_NOT_RESOLVED
        Defines an identifier if something is wrong with a resolvable element, such as a missing import (whyever).
        See Also:
        Constant Field Values
      • ID_SYSTEM_EXEC

        public static final int ID_SYSTEM_EXEC
        Defines an identifier if something does not work properly during a system execution call.
        See Also:
        Constant Field Values
      • ID_RUNTIME

        public static final int ID_RUNTIME
        Defines an identifier if something does not work properly during runtime.
        See Also:
        Constant Field Values
      • ID_CANNOT_INSTANTIATE

        public static final int ID_CANNOT_INSTANTIATE
        Defines an identifier if a type cannot be instantiated.
        See Also:
        Constant Field Values
      • ID_NULL_VALUE

        public static final int ID_NULL_VALUE
        Defines an identifier if a null value occurs at runtime.
        See Also:
        Constant Field Values
      • ID_ALREADY_REGISTERED

        public static final int ID_ALREADY_REGISTERED
        In case that an artifact type is already registered.
        See Also:
        Constant Field Values
      • ID_TYPE_INCOMPATIBILITY

        public static final int ID_TYPE_INCOMPATIBILITY
        In case that registering an artifact type fails due to incompatibilities with existing types.
        See Also:
        Constant Field Values
      • ID_OP_NOT_FOUND

        public static final int ID_OP_NOT_FOUND
        In case that registering an artifact operation was not found.
        See Also:
        Constant Field Values
      • ID_NO_RESULT

        public static final int ID_NO_RESULT
        In case that an operation returns no result.
        See Also:
        Constant Field Values
      • ID_EXECUTION_ERROR

        public static final int ID_EXECUTION_ERROR
        In case that an operation execution fails.
        See Also:
        Constant Field Values
      • ID_SECURITY_ERROR

        public static final int ID_SECURITY_ERROR
        In case that an operation execution fails due to security reasons.
        See Also:
        Constant Field Values
      • ID_MISSING_DATA

        public static final int ID_MISSING_DATA
        In case that relevant data is missing.
        See Also:
        Constant Field Values
      • ID_INVALID_DATA

        public static final int ID_INVALID_DATA
        In case that relevant data is invalid.
        See Also:
        Constant Field Values
      • ID_INVALID_INSTANTIATOR

        public static final int ID_INVALID_INSTANTIATOR
        In case that the class structure of an instantiator is invalid.
        See Also:
        Constant Field Values
      • ID_STATIC

        public static final int ID_STATIC
        In case that a static access cannot be handled.
        See Also:
        Constant Field Values
      • ID_UNKNOWN

        public static final int ID_UNKNOWN
        The actual kind of problem is not known (may only appear in case of multiple but empty causes).
        See Also:
        Constant Field Values
      • ID_SECURITY

        public static final int ID_SECURITY
        Some kind of security / access problem.
        See Also:
        Constant Field Values
      • ID_PATTERN

        public static final int ID_PATTERN
        Some kind of (matching) pattern syntax problem.
        See Also:
        Constant Field Values
      • ID_INVALID

        public static final int ID_INVALID
        Use of an invalid (deleted) object.
        See Also:
        Constant Field Values
      • ID_NO_ARTIFACT_CREATOR

        public static final int ID_NO_ARTIFACT_CREATOR
        No artifact creator is registered to handle a real (underlying) artifact.
        See Also:
        Constant Field Values
      • ID_IS_NULL

        public static final int ID_IS_NULL
        An unexpected null value.
        See Also:
        Constant Field Values
      • ID_INVALID_TYPE

        public static final int ID_INVALID_TYPE
        Use of an invalid type.
        See Also:
        Constant Field Values
      • ID_INVALID_CHARACTER

        public static final int ID_INVALID_CHARACTER
        Use of an invalid character.
        See Also:
        Constant Field Values
      • ID_INSUFFICIENT_ARGUMENT

        public static final int ID_INSUFFICIENT_ARGUMENT
        Use of an insufficient argument.
        See Also:
        Constant Field Values
      • ID_INVALID_PATTERN

        public static final int ID_INVALID_PATTERN
        Use of an invalid pattern.
        See Also:
        Constant Field Values
      • ID_WHILE_INSTANTIATION

        public static final int ID_WHILE_INSTANTIATION
        Happened during instantiation.
        See Also:
        Constant Field Values
      • ID_RUNTIME_ITERATOR

        public static final int ID_RUNTIME_ITERATOR
        Defines an identifier if something about an iterator does not work properly during runtime.
        See Also:
        Constant Field Values
      • ID_RUNTIME_EXECUTION

        public static final int ID_RUNTIME_EXECUTION
        Defines an identifier if something during runtime execution for creating an artifact or a set of artifacts fails.
        See Also:
        Constant Field Values
      • ID_RUNTIME_RESOURCE

        public static final int ID_RUNTIME_RESOURCE
        Defines an identifier if something during runtime execution for creating an artifact or a set of artifacts fails.
        See Also:
        Constant Field Values
      • ID_INVALID_VERSION

        public static final int ID_INVALID_VERSION
        Defines an identifier if a version string is illegally formatted.
        See Also:
        Constant Field Values
      • ID_ARTIFACT_INTERNAL

        public static final int ID_ARTIFACT_INTERNAL
        Defines an identifier if something (unspecified) is wrong in an artifact, e.g., its syntax or semantic.
        See Also:
        Constant Field Values
      • ID_RUNTIME_READ_WRITE

        public static final int ID_RUNTIME_READ_WRITE
        Defines an identifier if access to a field fails due to read/write restrictions.
        See Also:
        Constant Field Values
      • ID_INVALID_ITERATOR

        public static final int ID_INVALID_ITERATOR
        Use of an invalid iterator combination.
        See Also:
        Constant Field Values
      • ID_NOT_VISIBLE

        public static final int ID_NOT_VISIBLE
        If an element is not visible.
        See Also:
        Constant Field Values
      • serialVersionUID

        private static final long serialVersionUID
        For serialization.
        See Also:
        Constant Field Values
      • additionalCauses

        private VilException[] additionalCauses
        Optional additional causes.
    • Constructor Detail

      • VilException

        public VilException​(java.lang.String message,
                            int id)
        Creates a buildlang exception based on a given message.
        Parameters:
        message - the message of the exception
        id - the identifier (see constants above)
      • VilException

        public VilException​(java.lang.String message,
                            java.lang.Throwable cause,
                            int id)
        Creates a buildlang exception from a message and an optional cause.
        Parameters:
        message - the message of the exception
        cause - the originally causing exception
        id - the identifier (see constants above)
      • VilException

        public VilException​(AbstractException cause)
        Creates an exception from a known exception as cause. Note that the identification from cause is taken over as identification.
        Parameters:
        cause - the causing exception
      • VilException

        public VilException​(java.lang.Throwable throwable,
                            int id)
        Creates an exception from a throwable.
        Parameters:
        throwable - the throwable representing cause and message
        id - the identifier (see constants above)
      • VilException

        public VilException​(java.util.List<VilException> causes)
        Creates a new exception.
        Parameters:
        causes - the multiple causes causing this exception
    • Method Detail

      • getFirstMessage

        private static java.lang.String getFirstMessage​(java.util.List<VilException> causes)
        Returns the first message in case of multiple causes.
        Parameters:
        causes - the causes
        Returns:
        the first message or an empty string
      • getFirstCause

        private static VilException getFirstCause​(java.util.List<VilException> causes)
        Returns the first cause in case of multiple causes.
        Parameters:
        causes - the causes
        Returns:
        the first cause or null
      • getFirstId

        private static int getFirstId​(java.util.List<VilException> causes)
        Returns the first cause in case of multiple causes.
        Parameters:
        causes - the causes
        Returns:
        the first cause or ID_UNKNOWN
      • printStackTrace

        public void printStackTrace​(java.io.PrintStream stream)
        Overrides:
        printStackTrace in class java.lang.Throwable