Coverage Report - org.owasp.dependencycheck.analyzer.CpeSuppressionAnalyzer
 
Classes in this File Line Coverage Branch Coverage Complexity
CpeSuppressionAnalyzer
66%
6/9
16%
1/6
2.333
 
 1  
 /*
 2  
  * This file is part of dependency-check-core.
 3  
  *
 4  
  * Dependency-check-core is free software: you can redistribute it and/or modify it
 5  
  * under the terms of the GNU General Public License as published by the Free
 6  
  * Software Foundation, either version 3 of the License, or (at your option) any
 7  
  * later version.
 8  
  *
 9  
  * Dependency-check-core is distributed in the hope that it will be useful, but
 10  
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  
  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 12  
  * details.
 13  
  *
 14  
  * You should have received a copy of the GNU General Public License along with
 15  
  * dependency-check-core. If not, see http://www.gnu.org/licenses/.
 16  
  *
 17  
  * Copyright (c) 2013 Jeremy Long. All Rights Reserved.
 18  
  */
 19  
 package org.owasp.dependencycheck.analyzer;
 20  
 
 21  
 import org.owasp.dependencycheck.Engine;
 22  
 import org.owasp.dependencycheck.dependency.Dependency;
 23  
 import org.owasp.dependencycheck.suppression.SuppressionRule;
 24  
 
 25  
 /**
 26  
  * The suppression analyzer processes an externally defined XML document that
 27  
  * complies with the suppressions.xsd schema. Any identified CPE entries within
 28  
  * the dependencies that match will be removed.
 29  
  *
 30  
  * @author Jeremy Long (jeremy.long@owasp.org)
 31  
  */
 32  1
 public class CpeSuppressionAnalyzer extends AbstractSuppressionAnalyzer {
 33  
 
 34  
     //<editor-fold defaultstate="collapsed" desc="All standard implmentation details of Analyzer">
 35  
     /**
 36  
      * The name of the analyzer.
 37  
      */
 38  
     private static final String ANALYZER_NAME = "Cpe Suppression Analyzer";
 39  
     /**
 40  
      * The phase that this analyzer is intended to run in.
 41  
      */
 42  1
     private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.POST_IDENTIFIER_ANALYSIS;
 43  
 
 44  
     /**
 45  
      * Returns the name of the analyzer.
 46  
      *
 47  
      * @return the name of the analyzer.
 48  
      */
 49  
     @Override
 50  
     public String getName() {
 51  9
         return ANALYZER_NAME;
 52  
     }
 53  
 
 54  
     /**
 55  
      * Returns the phase that the analyzer is intended to run in.
 56  
      *
 57  
      * @return the phase that the analyzer is intended to run in.
 58  
      */
 59  
     @Override
 60  
     public AnalysisPhase getAnalysisPhase() {
 61  6
         return ANALYSIS_PHASE;
 62  
     }
 63  
     //</editor-fold>
 64  
 
 65  
     @Override
 66  
     public void analyze(final Dependency dependency, final Engine engine) throws AnalysisException {
 67  
 
 68  9
         if (getRules() == null || getRules().size() <= 0) {
 69  9
             return;
 70  
         }
 71  
 
 72  0
         for (final SuppressionRule rule : getRules()) {
 73  0
             rule.process(dependency);
 74  
         }
 75  0
     }
 76  
 }