Top Description Fields Constructors Methods
org.apache.tools.ant

public Class BuildException

extends RuntimeException
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.ExitStatusException, org.apache.tools.ant.UnsupportedAttributeException, org.apache.tools.ant.UnsupportedElementException, org.apache.tools.ant.taskdefs.optional.testing.BuildTimeoutException

Signals an error condition during a build

Field Summary

Modifier and TypeField and Description
private Location
location

Location in the build file where the exception occurred

private static final long

Constructor Summary

AccessConstructor and Description
public
BuildException()

Constructs a build exception with no descriptive information.

public
BuildException(String
A description of or information about the exception. Should not be null.
message
)

Constructs an exception with the given descriptive message.

public
BuildException(String
A description of or information about the exception. Should not be null.
pattern
,
Object...
ditto
formatArguments
)

Constructs an exception with the given format pattern and arguments.

public
BuildException(String
A description of or information about the exception. Should not be null unless a cause is specified.
message
,
Throwable
The exception that might have caused this one. May be null.
cause
)

Constructs an exception with the given message and exception as a root cause.

public
BuildException(String
A description of or information about the exception. Should not be null unless a cause is specified.
message
,
Throwable
The exception that might have caused this one. May be null.
cause
,
Location
The location in the project file where the error occurred. Must not be null.
location
)

Constructs an exception with the given message and exception as a root cause and a location in a file.

public
BuildException(Throwable
The exception that might have caused this one. Should not be null.
cause
)

Constructs an exception with the given exception as a root cause.

public
BuildException(String
A description of or information about the exception. Should not be null.
message
,
Location
The location in the project file where the error occurred. Must not be null.
location
)

Constructs an exception with the given descriptive message and a location in a file.

public
BuildException(Throwable
The exception that might have caused this one. Should not be null.
cause
,
Location
The location in the project file where the error occurred. Must not be null.
location
)

Constructs an exception with the given exception as a root cause and a location in a file.

Method Summary

Modifier and TypeMethod and Description
public Throwable

Returns:

the nested exception, or null if no exception is associated with this one
getException
()

Deprecated Use getCause instead.
Returns the nested exception, if any.
public Location

Returns:

the file location where the error occurred.
getLocation
()

Returns the file location where the error occurred.

public static BuildException
of(Throwable t)

Get a BuildException for the specified Throwable.

public void
setLocation(Location
The file location where the error occurred. Must not be null.
location
)

Sets the file location where the error occurred.

public String

Returns:

the location of the error and the error message
toString
()

Overrides java.lang.Throwable.toString.

Returns the location of the error and the error message.

Field Detail

locationback to summary
private Location location

Location in the build file where the exception occurred

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Constructor Detail

BuildExceptionback to summary
public BuildException()

Constructs a build exception with no descriptive information.

BuildExceptionback to summary
public BuildException(String message)

Constructs an exception with the given descriptive message.

Parameters
message:String

A description of or information about the exception. Should not be null.

BuildExceptionback to summary
public BuildException(String pattern, Object... formatArguments)

Constructs an exception with the given format pattern and arguments.

Parameters
pattern:String

A description of or information about the exception. Should not be null.

formatArguments:Object[]

ditto

Since
Ant 1.10.2
See Also
String#format(String, Object...)
BuildExceptionback to summary
public BuildException(String message, Throwable cause)

Constructs an exception with the given message and exception as a root cause.

Parameters
message:String

A description of or information about the exception. Should not be null unless a cause is specified.

cause:Throwable

The exception that might have caused this one. May be null.

BuildExceptionback to summary
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:String

A description of or information about the exception. Should not be null unless a cause is specified.

cause:Throwable

The exception that might have caused this one. May be null.

location:Location

The location in the project file where the error occurred. Must not be null.

BuildExceptionback to summary
public BuildException(Throwable cause)

Constructs an exception with the given exception as a root cause.

Parameters
cause:Throwable

The exception that might have caused this one. Should not be null.

BuildExceptionback to summary
public BuildException(String message, Location location)

Constructs an exception with the given descriptive message and a location in a file.

Parameters
message:String

A description of or information about the exception. Should not be null.

location:Location

The location in the project file where the error occurred. Must not be null.

BuildExceptionback to summary
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:Throwable

The exception that might have caused this one. Should not be null.

location:Location

The location in the project file where the error occurred. Must not be null.

Method Detail

getExceptionback to summary
public Throwable getException()

Deprecated

Use getCause instead.

Returns the nested exception, if any.

Returns:Throwable

the nested exception, or null if no exception is associated with this one

Annotations
@Deprecated
getLocationback to summary
public Location getLocation()

Returns the file location where the error occurred.

Returns:Location

the file location where the error occurred.

ofback to summary
public static BuildException of(Throwable t)

Get a BuildException for the specified Throwable.

Returns:BuildException

BuildException

Since
Ant 1.10.13
setLocationback to summary
public void setLocation(Location location)

Sets the file location where the error occurred.

Parameters
location:Location

The file location where the error occurred. Must not be null.

toStringback to summary
public String toString()

Overrides java.lang.Throwable.toString.

Returns the location of the error and the error message.

Returns:String

the location of the error and the error message