15716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet/*
25716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  Licensed to the Apache Software Foundation (ASF) under one or more
35716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  contributor license agreements.  See the NOTICE file distributed with
45716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  this work for additional information regarding copyright ownership.
55716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  The ASF licenses this file to You under the Apache License, Version 2.0
65716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  (the "License"); you may not use this file except in compliance with
75716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  the License.  You may obtain a copy of the License at
85716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *
95716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *      http://www.apache.org/licenses/LICENSE-2.0
105716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *
115716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  Unless required by applicable law or agreed to in writing, software
125716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  distributed under the License is distributed on an "AS IS" BASIS,
135716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
145716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  See the License for the specific language governing permissions and
155716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *  limitations under the License.
165716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet *
175716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet */
185716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohetpackage org.apache.tools.ant;
195716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet
205716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet/**
215716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet * Signals an error condition during a build
225716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet */
235716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohetpublic class BuildException extends RuntimeException {
245716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet
255716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    private static final long serialVersionUID = 1L;
265716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet
275716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    /**
285716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * Constructs a build exception with no descriptive information.
295716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     */
305716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    public BuildException() {
315716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet        super();
325716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    }
335716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet
345716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    /**
355716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * Constructs an exception with the given descriptive message.
365716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     *
375716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * @param message A description of or information about the exception.
385716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     *            Should not be <code>null</code>.
395716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     */
405716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    public BuildException(String message) {
415716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet        super(message);
425716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    }
435716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet
445716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    /**
455716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * Constructs an exception with the given message and exception as
465716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * a root cause.
475716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     *
485716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * @param message A description of or information about the exception.
495716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     *            Should not be <code>null</code> unless a cause is specified.
505716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * @param cause The exception that might have caused this one.
515716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     *              May be <code>null</code>.
525716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     */
535716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    public BuildException(String message, Throwable cause) {
545716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet        super(message);
555716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet        initCause(cause);
565716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    }
575716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet
585716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    /**
595716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * Constructs an exception with the given exception as a root cause.
605716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     *
615716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * @param cause The exception that might have caused this one.
625716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     *              Should not be <code>null</code>.
635716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     */
645716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    public BuildException(Throwable cause) {
655716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet        super(cause);
665716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    }
675716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet
685716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    /**
695716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * Returns the nested exception, if any.
705716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     *
715716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * @return the nested exception, or <code>null</code> if no
725716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     *         exception is associated with this one
735716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     * @deprecated Use {@link #getCause} instead.
745716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet     */
755716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    @Deprecated
765716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    public Throwable getException() {
775716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet        return getCause();
785716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet    }
795716c15248acdb7dba42d951cf8273ee87cc6846Xavier Ducrohet}
80