Home | History | Annotate | Download | only in ant
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  *
     17  */
     18 package org.apache.tools.ant;
     19 
     20 /**
     21  * Signals an error condition during a build
     22  */
     23 public class BuildException extends RuntimeException {
     24 
     25     private static final long serialVersionUID = 1L;
     26 
     27     /**
     28      * Constructs a build exception with no descriptive information.
     29      */
     30     public BuildException() {
     31         super();
     32     }
     33 
     34     /**
     35      * Constructs an exception with the given descriptive message.
     36      *
     37      * @param message A description of or information about the exception.
     38      *            Should not be <code>null</code>.
     39      */
     40     public BuildException(String message) {
     41         super(message);
     42     }
     43 
     44     /**
     45      * Constructs an exception with the given message and exception as
     46      * a root cause.
     47      *
     48      * @param message A description of or information about the exception.
     49      *            Should not be <code>null</code> unless a cause is specified.
     50      * @param cause The exception that might have caused this one.
     51      *              May be <code>null</code>.
     52      */
     53     public BuildException(String message, Throwable cause) {
     54         super(message);
     55         initCause(cause);
     56     }
     57 
     58     /**
     59      * Constructs an exception with the given exception as a root cause.
     60      *
     61      * @param cause The exception that might have caused this one.
     62      *              Should not be <code>null</code>.
     63      */
     64     public BuildException(Throwable cause) {
     65         super(cause);
     66     }
     67 
     68     /**
     69      * Returns the nested exception, if any.
     70      *
     71      * @return the nested exception, or <code>null</code> if no
     72      *         exception is associated with this one
     73      * @deprecated Use {@link #getCause} instead.
     74      */
     75     @Deprecated
     76     public Throwable getException() {
     77         return getCause();
     78     }
     79 }
     80