Class BuildException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BuildTimeoutException, ExitStatusException, UnsupportedAttributeException, UnsupportedElementException

public class BuildException extends RuntimeException
Signals an error condition during a build
See Also:
  • Constructor Details

    • BuildException

      public BuildException()
      Constructs a build exception with no descriptive information.
    • BuildException

      public BuildException(String message)
      Constructs an exception with the given descriptive message.
      Parameters:
      message - A description of or information about the exception. Should not be null.
    • BuildException

      public BuildException(String pattern, Object... formatArguments)
      Constructs an exception with the given format pattern and arguments.
      Parameters:
      pattern - A description of or information about the exception. Should not be null.
      formatArguments - ditto
      Since:
      Ant 1.10.2
      See Also:
    • BuildException

      public BuildException(String message, Throwable cause)
      Constructs an exception with the given message and exception as a root cause.
      Parameters:
      message - A description of or information about the exception. Should not be null unless a cause is specified.
      cause - The exception that might have caused this one. May be null.
    • BuildException

      public BuildException(String message, Throwable cause, Location location)
      Constructs an exception with the given message and exception as a root cause and a location in a file.
      Parameters:
      message - A description of or information about the exception. Should not be null unless a cause is specified.
      cause - The exception that might have caused this one. May be null.
      location - The location in the project file where the error occurred. Must not be null.
    • BuildException

      public BuildException(Throwable cause)
      Constructs an exception with the given exception as a root cause.
      Parameters:
      cause - The exception that might have caused this one. Should not be null.
    • BuildException

      public BuildException(String message, Location location)
      Constructs an exception with the given descriptive message and a location in a file.
      Parameters:
      message - A description of or information about the exception. Should not be null.
      location - The location in the project file where the error occurred. Must not be null.
    • BuildException

      public BuildException(Throwable cause, Location location)
      Constructs an exception with the given exception as a root cause and a location in a file.
      Parameters:
      cause - The exception that might have caused this one. Should not be null.
      location - The location in the project file where the error occurred. Must not be null.
  • Method Details

    • of

      public static BuildException of(Throwable t)
      Get a BuildException for the specified Throwable.
      Parameters:
      t -
      Returns:
      BuildException
      Since:
      Ant 1.10.13
    • getException

      @Deprecated public Throwable getException()
      Deprecated.
      Returns the nested exception, if any.
      Returns:
      the nested exception, or null if no exception is associated with this one
    • toString

      public String toString()
      Returns the location of the error and the error message.
      Overrides:
      toString in class Throwable
      Returns:
      the location of the error and the error message
    • setLocation

      public void setLocation(Location location)
      Sets the file location where the error occurred.
      Parameters:
      location - The file location where the error occurred. Must not be null.
    • getLocation

      public Location getLocation()
      Returns the file location where the error occurred.
      Returns:
      the file location where the error occurred.