From 0df0073a906f71705fbc58c2dea4e6ba8251e402 Mon Sep 17 00:00:00 2001 From: jeremylong Date: Sat, 29 Sep 2012 15:48:55 -0400 Subject: [PATCH] general cleanup/enhancement Former-commit-id: 6320ac1c59644bcb83ecf171f0d00e7f96b8c7ff --- pom.xml | 22 +------------------ .../codesecure/dependencycheck/Engine.java | 15 +++++++------ .../dependencycheck/data/cpe/CPEAnalyzer.java | 16 +++++++------- src/main/resources/templates/HtmlReport.vsl | 21 ++++++++++++++---- 4 files changed, 34 insertions(+), 40 deletions(-) diff --git a/pom.xml b/pom.xml index 6249a0aa7..65b83d897 100644 --- a/pom.xml +++ b/pom.xml @@ -317,24 +317,10 @@ along with DependencyCheck. If not, see . commons-cli 1.2 - - commons-cli - commons-cli - 1.2 - javadoc - provided - - - commons-cli - commons-cli - 1.2 - sources - provided - junit junit - 4.8.2 + 4.10 test jar @@ -397,11 +383,5 @@ along with DependencyCheck. If not, see . - diff --git a/src/main/java/org/codesecure/dependencycheck/Engine.java b/src/main/java/org/codesecure/dependencycheck/Engine.java index b621cef8d..551634ace 100644 --- a/src/main/java/org/codesecure/dependencycheck/Engine.java +++ b/src/main/java/org/codesecure/dependencycheck/Engine.java @@ -38,8 +38,8 @@ import org.codesecure.dependencycheck.utils.FileUtils; /** * Scans files, directories, etc. for Dependencies. Analyzers are loaded and - * used to process the files found by the scan, if a file is encountered and - * an Analyzer is associated with the file type then the file is turned into a + * used to process the files found by the scan, if a file is encountered and an + * Analyzer is associated with the file type then the file is turned into a * dependency. * * @author Jeremy Long (jeremy.long@gmail.com) @@ -68,7 +68,8 @@ public class Engine { } /** - * Loads the analyzers specified in the configuration file (or system properties). + * Loads the analyzers specified in the configuration file (or system + * properties). */ private void loadAnalyzers() { @@ -108,8 +109,8 @@ public class Engine { /** * Scans a given file or directory. If a directory is specified, it will be - * scanned recursively. - * Any dependencies identified are added to the dependency collection. + * scanned recursively. Any dependencies identified are added to the + * dependency collection. * * @param path the path to a file or directory to be analyzed. */ @@ -125,8 +126,8 @@ public class Engine { } /** - * Recursively scans files and directories. - * Any dependencies identified are added to the dependency collection. + * Recursively scans files and directories. Any dependencies identified are + * added to the dependency collection. * * @param dir the directory to scan. */ diff --git a/src/main/java/org/codesecure/dependencycheck/data/cpe/CPEAnalyzer.java b/src/main/java/org/codesecure/dependencycheck/data/cpe/CPEAnalyzer.java index 888f8ea11..1724d42d5 100644 --- a/src/main/java/org/codesecure/dependencycheck/data/cpe/CPEAnalyzer.java +++ b/src/main/java/org/codesecure/dependencycheck/data/cpe/CPEAnalyzer.java @@ -215,7 +215,7 @@ public class CPEAnalyzer implements org.codesecure.dependencycheck.analyzer.Anal } /** - * Returns the text created by concatonating the text and the values from the + * Returns the text created by concatenating the text and the values from the * EvidenceCollection (filtered for a specific confidence). This attempts to * prevent duplicate terms from being added.
* Note, if the evidence is longer then 200 characters it will be truncated. @@ -241,11 +241,11 @@ public class CPEAnalyzer implements org.codesecure.dependencycheck.analyzer.Anal value = value.substring(8).replaceAll("\\.", " "); } if (sb.indexOf(value) < 0) { - if (value.length() > 200) { - sb.append(value.substring(0, 200)).append(' '); - } else { +// if (value.length() > 200) { +// sb.append(value.substring(0, 200)).append(' '); +// } else { sb.append(value).append(' '); - } +// } } } return sb.toString(); @@ -361,14 +361,14 @@ public class CPEAnalyzer implements org.codesecure.dependencycheck.analyzer.Anal if (sb.indexOf("^") > 0) { //if we have a weighting on something else, reduce the weighting on the version a lot for (String v : version.split(" ")) { - LuceneUtils.appendEscapedLuceneQuery(sb, v); + LuceneUtils.appendEscapedLuceneQuery(sb, cleanseText(v)); sb.append("^0.2 "); } } else { //LuceneUtils.appendEscapedLuceneQuery(sb, version); //if we have a weighting on something else, reduce the weighting on the version a lot for (String v : version.split(" ")) { - LuceneUtils.appendEscapedLuceneQuery(sb, v); + LuceneUtils.appendEscapedLuceneQuery(sb, cleanseText(v)); sb.append("^0.7 "); } } @@ -442,7 +442,7 @@ public class CPEAnalyzer implements org.codesecure.dependencycheck.analyzer.Anal * * @param l string one to compare. * @param r string two to compare. - * @return whether or not the two strings are similiar. + * @return whether or not the two strings are similar. */ private boolean equalsIgnoreCaseAndNonAlpha(String l, String r) { if (l == null || r == null) { diff --git a/src/main/resources/templates/HtmlReport.vsl b/src/main/resources/templates/HtmlReport.vsl index 6950e54ec..5dfd4b8a5 100644 --- a/src/main/resources/templates/HtmlReport.vsl +++ b/src/main/resources/templates/HtmlReport.vsl @@ -307,14 +307,27 @@ Copyright (c) 2012 Jeremy Long. All Rights Reserved. #if ( $dependency.analysisExceptions.size() != 0 ) #set($cnt=$cnt+1) -

Analysis Exceptions

-
+

Exceptions Occured During Analysis

+