Listing E: Simple exception example

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;

public class ExceptionTask extends Task {
  public void execute() throws BuildException {
        throw new BuildException("Build Exception!");
  }
}