Coverage Report - org.owasp.dependencycheck.org.apache.tools.ant.ProjectComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
ProjectComponent
0%
0/8
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  
  * Base class for components of a project, including tasks and data types. Provides common facilities.
 22  
  *
 23  
  */
 24  
 public abstract class ProjectComponent implements Cloneable {
 25  
 
 26  
 //    // CheckStyle:VisibilityModifier OFF - bc
 27  
 //    /**
 28  
 //     * Project object of this component.
 29  
 //     * @deprecated since 1.6.x.
 30  
 //     *             You should not be directly accessing this variable directly.
 31  
 //     *             You should access project object via the getProject()
 32  
 //     *             or setProject() accessor/mutators.
 33  
 //     */
 34  
 //    protected Project project;
 35  
     /**
 36  
      * Location within the build file of this task definition.
 37  
      *
 38  
      * @deprecated since 1.6.x. You should not be accessing this variable directly. Please use the
 39  
      * {@link #getLocation()} method.
 40  
      */
 41  0
     protected Location location = Location.UNKNOWN_LOCATION;
 42  
 
 43  
     /**
 44  
      * Description of this component, if any.
 45  
      *
 46  
      * @deprecated since 1.6.x. You should not be accessing this variable directly.
 47  
      */
 48  
     protected String description;
 49  
     // CheckStyle:VisibilityModifier ON
 50  
 
 51  
     /**
 52  
      * Sole constructor.
 53  
      */
 54  0
     public ProjectComponent() {
 55  0
     }
 56  
 
 57  
 //    /**
 58  
 //     * Sets the project object of this component. This method is used by
 59  
 //     * Project when a component is added to it so that the component has
 60  
 //     * access to the functions of the project. It should not be used
 61  
 //     * for any other purpose.
 62  
 //     *
 63  
 //     * @param project Project in whose scope this component belongs.
 64  
 //     *                Must not be <code>null</code>.
 65  
 //     */
 66  
 //    public void setProject(Project project) {
 67  
 //        this.project = project;
 68  
 //    }
 69  
 //
 70  
 //    /**
 71  
 //     * Returns the project to which this component belongs.
 72  
 //     *
 73  
 //     * @return the components's project.
 74  
 //     */
 75  
 //    public Project getProject() {
 76  
 //        return project;
 77  
 //    }
 78  
     /**
 79  
      * Returns the file/location where this task was defined.
 80  
      *
 81  
      * @return the file/location where this task was defined. Should not return <code>null</code>.
 82  
      * Location.UNKNOWN_LOCATION is used for unknown locations.
 83  
      *
 84  
      * @see Location#UNKNOWN_LOCATION
 85  
      */
 86  
     public Location getLocation() {
 87  
         return location;
 88  
     }
 89  
 
 90  
     /**
 91  
      * Sets the file/location where this task was defined.
 92  
      *
 93  
      * @param location The file/location where this task was defined. Should not be <code>null</code>--use
 94  
      * Location.UNKNOWN_LOCATION if the location isn't known.
 95  
      *
 96  
      * @see Location#UNKNOWN_LOCATION
 97  
      */
 98  
     public void setLocation(Location location) {
 99  
         this.location = location;
 100  
     }
 101  
 
 102  
     /**
 103  
      * Sets a description of the current action. This may be used for logging purposes.
 104  
      *
 105  
      * @param desc Description of the current action. May be <code>null</code>, indicating that no description is
 106  
      * available.
 107  
      *
 108  
      */
 109  
     public void setDescription(String desc) {
 110  
         description = desc;
 111  
     }
 112  
 
 113  
     /**
 114  
      * Returns the description of the current action.
 115  
      *
 116  
      * @return the description of the current action, or <code>null</code> if no description is available.
 117  
      */
 118  
     public String getDescription() {
 119  
         return description;
 120  
     }
 121  
 
 122  
     /**
 123  
      * Logs a message with the default (INFO) priority.
 124  
      *
 125  
      * @param msg The message to be logged. Should not be <code>null</code>.
 126  
      */
 127  
     public void log(String msg) {
 128  
 //        log(msg, Project.MSG_INFO);
 129  0
     }
 130  
 
 131  
     /**
 132  
      * Logs a message with the given priority.
 133  
      *
 134  
      * @param msg The message to be logged. Should not be <code>null</code>.
 135  
      * @param msgLevel the message priority at which this message is to be logged.
 136  
      */
 137  
     public void log(String msg, int msgLevel) {
 138  
 //        if (getProject() != null) {
 139  
 //            getProject().log(msg, msgLevel);
 140  
 //        } else {
 141  
 //            // 'reasonable' default, if the component is used without
 142  
 //            // a Project ( for example as a standalone Bean ).
 143  
 //            // Most ant components can be used this way.
 144  
 //            if (msgLevel <= Project.MSG_INFO) {
 145  
 //                System.err.println(msg);
 146  
 //            }
 147  
 //        }
 148  0
     }
 149  
 
 150  
     /**
 151  
      * @since Ant 1.7
 152  
      * @return a shallow copy of this projectcomponent.
 153  
      * @throws CloneNotSupportedException does not happen, but is declared to allow subclasses to do so.
 154  
      */
 155  
     public Object clone() throws CloneNotSupportedException {
 156  0
         ProjectComponent pc = (ProjectComponent) super.clone();
 157  0
         pc.setLocation(getLocation());
 158  
         //pc.setProject(getProject());
 159  0
         return pc;
 160  
     }
 161  
 }