FileDocCategorySizeDatePackage
BuildException.javaAPI DocApache Ant 1.706689Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant

BuildException

public class BuildException extends RuntimeException
Signals an error condition during a build

Fields Summary
private Throwable
cause
Exception that might have caused this one.
private Location
location
Location in the build file where the exception occurred
Constructors Summary
public BuildException()
Constructs a build exception with no descriptive information.


                 
      
        super();
    
public BuildException(String message)
Constructs an exception with the given descriptive message.

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

        super(message);
    
public BuildException(String message, Throwable cause)
Constructs an exception with the given message and exception as a root cause.

param
message A description of or information about the exception. Should not be null unless a cause is specified.
param
cause The exception that might have caused this one. May be null.

        super(message);
        this.cause = cause;
    
public BuildException(String msg, Throwable cause, Location location)
Constructs an exception with the given message and exception as a root cause and a location in a file.

param
msg A description of or information about the exception. Should not be null unless a cause is specified.
param
cause The exception that might have caused this one. May be null.
param
location The location in the project file where the error occurred. Must not be null.

        this(msg, cause);
        this.location = location;
    
public BuildException(Throwable cause)
Constructs an exception with the given exception as a root cause.

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

        super(cause.toString());
        this.cause = cause;
    
public BuildException(String message, Location location)
Constructs an exception with the given descriptive message and a location in a file.

param
message A description of or information about the exception. Should not be null.
param
location The location in the project file where the error occurred. Must not be null.

        super(message);
        this.location = location;
    
public BuildException(Throwable cause, Location location)
Constructs an exception with the given exception as a root cause and a location in a file.

param
cause The exception that might have caused this one. Should not be null.
param
location The location in the project file where the error occurred. Must not be null.

        this(cause);
        this.location = location;
    
Methods Summary
public java.lang.ThrowablegetCause()
Returns the nested exception, if any.

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

        return getException();
    
public java.lang.ThrowablegetException()
Returns the nested exception, if any.

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

        return cause;
    
public LocationgetLocation()
Returns the file location where the error occurred.

return
the file location where the error occurred.

        return location;
    
public voidprintStackTrace()
Prints the stack trace for this exception and any nested exception to System.err.

        printStackTrace(System.err);
    
public voidprintStackTrace(java.io.PrintStream ps)
Prints the stack trace of this exception and any nested exception to the specified PrintStream.

param
ps The PrintStream to print the stack trace to. Must not be null.

        synchronized (ps) {
            super.printStackTrace(ps);
            if (cause != null) {
                ps.println("--- Nested Exception ---");
                cause.printStackTrace(ps);
            }
        }
    
public voidprintStackTrace(java.io.PrintWriter pw)
Prints the stack trace of this exception and any nested exception to the specified PrintWriter.

param
pw The PrintWriter to print the stack trace to. Must not be null.

        synchronized (pw) {
            super.printStackTrace(pw);
            if (cause != null) {
                pw.println("--- Nested Exception ---");
                cause.printStackTrace(pw);
            }
        }
    
public voidsetLocation(Location location)
Sets the file location where the error occurred.

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

        this.location = location;
    
public java.lang.StringtoString()
Returns the location of the error and the error message.

return
the location of the error and the error message

        return location.toString() + getMessage();