Coverage Report - org.owasp.dependencycheck.org.apache.tools.ant.BuildException
 
Classes in this File Line Coverage Branch Coverage Complexity
BuildException
0%
0/23
N/A
1
 
 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.owasp.dependencycheck.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 = -5419014565354664240L;
 26  
 
 27  
     /** Location in the build file where the exception occurred */
 28  0
     private Location location = Location.UNKNOWN_LOCATION;
 29  
 
 30  
     /**
 31  
      * Constructs a build exception with no descriptive information.
 32  
      */
 33  
     public BuildException() {
 34  0
         super();
 35  0
     }
 36  
 
 37  
     /**
 38  
      * Constructs an exception with the given descriptive message.
 39  
      *
 40  
      * @param message A description of or information about the exception.
 41  
      *            Should not be <code>null</code>.
 42  
      */
 43  
     public BuildException(String message) {
 44  0
         super(message);
 45  0
     }
 46  
 
 47  
     /**
 48  
      * Constructs an exception with the given message and exception as
 49  
      * a root cause.
 50  
      *
 51  
      * @param message A description of or information about the exception.
 52  
      *            Should not be <code>null</code> unless a cause is specified.
 53  
      * @param cause The exception that might have caused this one.
 54  
      *              May be <code>null</code>.
 55  
      */
 56  
     public BuildException(String message, Throwable cause) {
 57  0
         super(message, cause);
 58  0
     }
 59  
 
 60  
     /**
 61  
      * Constructs an exception with the given message and exception as
 62  
      * a root cause and a location in a file.
 63  
      *
 64  
      * @param msg A description of or information about the exception.
 65  
      *            Should not be <code>null</code> unless a cause is specified.
 66  
      * @param cause The exception that might have caused this one.
 67  
      *              May be <code>null</code>.
 68  
      * @param location The location in the project file where the error
 69  
      *                 occurred. Must not be <code>null</code>.
 70  
      */
 71  
     public BuildException(String msg, Throwable cause, Location location) {
 72  0
         this(msg, cause);
 73  0
         this.location = location;
 74  0
     }
 75  
 
 76  
     /**
 77  
      * Constructs an exception with the given exception as a root cause.
 78  
      *
 79  
      * @param cause The exception that might have caused this one.
 80  
      *              Should not be <code>null</code>.
 81  
      */
 82  
     public BuildException(Throwable cause) {
 83  0
         super(cause);
 84  0
     }
 85  
 
 86  
     /**
 87  
      * Constructs an exception with the given descriptive message and a
 88  
      * location in a file.
 89  
      *
 90  
      * @param message A description of or information about the exception.
 91  
      *            Should not be <code>null</code>.
 92  
      * @param location The location in the project file where the error
 93  
      *                 occurred. Must not be <code>null</code>.
 94  
      */
 95  
     public BuildException(String message, Location location) {
 96  0
         super(message);
 97  0
         this.location = location;
 98  0
     }
 99  
 
 100  
     /**
 101  
      * Constructs an exception with the given exception as
 102  
      * a root cause and a location in a file.
 103  
      *
 104  
      * @param cause The exception that might have caused this one.
 105  
      *              Should not be <code>null</code>.
 106  
      * @param location The location in the project file where the error
 107  
      *                 occurred. Must not be <code>null</code>.
 108  
      */
 109  
     public BuildException(Throwable cause, Location location) {
 110  0
         this(cause);
 111  0
         this.location = location;
 112  0
     }
 113  
 
 114  
     /**
 115  
      * Returns the nested exception, if any.
 116  
      *
 117  
      * @return the nested exception, or <code>null</code> if no
 118  
      *         exception is associated with this one
 119  
      * @deprecated Use {@link #getCause} instead.
 120  
      */
 121  
     public Throwable getException() {
 122  0
         return getCause();
 123  
     }
 124  
 
 125  
     /**
 126  
      * Returns the location of the error and the error message.
 127  
      *
 128  
      * @return the location of the error and the error message
 129  
      */
 130  
     public String toString() {
 131  0
         return location.toString() + getMessage();
 132  
     }
 133  
 
 134  
     /**
 135  
      * Sets the file location where the error occurred.
 136  
      *
 137  
      * @param location The file location where the error occurred.
 138  
      *                 Must not be <code>null</code>.
 139  
      */
 140  
     public void setLocation(Location location) {
 141  0
         this.location = location;
 142  0
     }
 143  
 
 144  
     /**
 145  
      * Returns the file location where the error occurred.
 146  
      *
 147  
      * @return the file location where the error occurred.
 148  
      */
 149  
     public Location getLocation() {
 150  0
         return location;
 151  
     }
 152  
 
 153  
 }