| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AbstractAnalyzer |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * This file is part of dependency-check-core. | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | * | |
| 16 | * Copyright (c) 2012 Jeremy Long. All Rights Reserved. | |
| 17 | */ | |
| 18 | package org.owasp.dependencycheck.analyzer; | |
| 19 | ||
| 20 | import java.util.Collections; | |
| 21 | import java.util.HashSet; | |
| 22 | import java.util.Set; | |
| 23 | ||
| 24 | /** | |
| 25 | * | |
| 26 | * @author Jeremy Long <jeremy.long@owasp.org> | |
| 27 | */ | |
| 28 | public abstract class AbstractAnalyzer implements Analyzer { | |
| 29 | ||
| 30 | /** | |
| 31 | * Utility method to help in the creation of the extensions set. This constructs a new Set that can be used in a | |
| 32 | * final static declaration.<br/><br/> | |
| 33 | * | |
| 34 | * This implementation was copied from | |
| 35 | * http://stackoverflow.com/questions/2041778/initialize-java-hashset-values-by-construction | |
| 36 | * | |
| 37 | * @param strings a list of strings to add to the set. | |
| 38 | * @return a Set of strings. | |
| 39 | */ | |
| 40 | protected static Set<String> newHashSet(String... strings) { | |
| 41 | 10 | final Set<String> set = new HashSet<String>(); |
| 42 | ||
| 43 | 10 | Collections.addAll(set, strings); |
| 44 | 10 | return set; |
| 45 | } | |
| 46 | ||
| 47 | /** | |
| 48 | * The initialize method does nothing for this Analyzer. | |
| 49 | * | |
| 50 | * @throws Exception thrown if there is an exception | |
| 51 | */ | |
| 52 | @Override | |
| 53 | public void initialize() throws Exception { | |
| 54 | //do nothing | |
| 55 | 27 | } |
| 56 | ||
| 57 | /** | |
| 58 | * The close method does nothing for this Analyzer. | |
| 59 | * | |
| 60 | * @throws Exception thrown if there is an exception | |
| 61 | */ | |
| 62 | @Override | |
| 63 | public void close() throws Exception { | |
| 64 | //do nothing | |
| 65 | 33 | } |
| 66 | } |