File: 197,
- Errors: 7,
+ File: 203,
+ Errors: 6,
Warnings: 0,
Infos: 0
@@ -127,6 +127,20 @@ under the License.
0
+
+
+
+ dependency-check-ant/target/generated-classes/cobertura/cobertura.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -186,7 +200,7 @@ under the License.
- org/owasp/dependencycheck/utils/LogUtils.java
+ dependency-check-ant/target/generated-classes/cobertura/task.properties
0
@@ -239,20 +253,6 @@ under the License.
0
-
-
-
- org/owasp/dependencycheck/utils/URLConnectionFactory.java
-
-
- 0
-
-
- 0
-
-
- 0
-
@@ -323,6 +323,20 @@ under the License.
0
+
+
+
+ dependency-check-maven/target/generated-classes/cobertura/log.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -351,20 +365,6 @@ under the License.
0
-
-
-
- org/owasp/dependencycheck/utils/DownloadFailedException.java
-
-
- 0
-
-
- 0
-
-
- 0
-
@@ -449,6 +449,20 @@ under the License.
0
+
+
+
+ dependency-check-ant/target/generated-classes/cobertura/taskdefs.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -687,6 +701,20 @@ under the License.
0
+
+
+
+ org/owasp/dependencycheck/data/update/task/DownloadTask.java
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -701,6 +729,20 @@ under the License.
0
+
+
+
+ dependency-check-utils/src/test/resources/dependencycheck.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -729,6 +771,20 @@ under the License.
0
+
+
+
+ dependency-check-cli/target/generated-classes/cobertura/log.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -813,34 +869,6 @@ under the License.
2
-
-
-
- org/owasp/dependencycheck/utils/InvalidSettingException.java
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
- org/owasp/dependencycheck/utils/Downloader.java
-
-
- 0
-
-
- 0
-
-
- 0
-
@@ -925,20 +953,6 @@ under the License.
0
-
-
-
- org/owasp/dependencycheck/utils/LogFilter.java
-
-
- 0
-
-
- 0
-
-
- 0
-
@@ -995,6 +1009,34 @@ under the License.
0
+
+
+
+ dependency-check-utils/src/test/resources/test.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ dependency-check-maven/target/generated-classes/cobertura/cobertura.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -1065,6 +1107,20 @@ under the License.
0
+
+
+
+ org/owasp/dependencycheck/utils/ExtractionUtil.java
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -1124,7 +1180,7 @@ under the License.
- org/owasp/dependencycheck/utils/URLConnectionFailureException.java
+ org/owasp/dependencycheck/jaxb/pom/generated/Organization.java
0
@@ -1138,7 +1194,21 @@ under the License.
- org/owasp/dependencycheck/jaxb/pom/generated/Organization.java
+ dependency-check-cli/target/generated-classes/cobertura/cobertura.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ dependency-check-ant/target/generated-classes/cobertura/log.properties
0
@@ -1359,20 +1429,6 @@ under the License.
0
-
-
-
- org/owasp/dependencycheck/utils/ExtractionException.java
-
-
- 0
-
-
- 0
-
-
- 0
-
@@ -1457,20 +1513,6 @@ under the License.
0
-
-
-
- dependency-check-maven/target/classes/log.properties
-
-
- 0
-
-
- 0
-
-
- 0
-
@@ -1499,6 +1541,34 @@ under the License.
0
+
+
+
+ dependency-check-maven/target/classes/log.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ dependency-check-maven/target/generated-classes/cobertura/mojo.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -1555,20 +1625,6 @@ under the License.
0
-
-
-
- org/owasp/dependencycheck/utils/FileUtils.java
-
-
- 0
-
-
- 0
-
-
- 0
-
@@ -1637,7 +1693,7 @@ under the License.
0
- 1
+ 0
@@ -1653,20 +1709,6 @@ under the License.
0
-
-
-
- org/owasp/dependencycheck/data/update/task/CallableDownloadTask.java
-
-
- 0
-
-
- 0
-
-
- 0
-
@@ -1695,20 +1737,6 @@ under the License.
0
-
-
-
- org/owasp/dependencycheck/utils/Settings.java
-
-
- 0
-
-
- 0
-
-
- 0
-
@@ -2003,6 +2031,20 @@ under the License.
0
+
+
+
+ dependency-check-utils/target/test-classes/dependencycheck.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -2017,6 +2059,34 @@ under the License.
0
+
+
+
+ dependency-check-utils/target/generated-classes/cobertura/cobertura.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ dependency-check-utils/target/maven-archiver/pom.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
@@ -2479,6 +2549,20 @@ under the License.
0
+
+
+
+ dependency-check-utils/target/test-classes/test.properties
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
diff --git a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.analyzer.html b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.analyzer.html
index 94fbbf88c..df594246b 100644
--- a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.analyzer.html
+++ b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.analyzer.html
@@ -21,7 +21,7 @@ org.owasp.dependencycheck.analyzer
AbstractFileTypeAnalyzer (74%)
-AbstractSuppressionAnalyzer (84%)
+AbstractSuppressionAnalyzer (82%)
AnalysisPhase (100%)
@@ -36,19 +36,19 @@ org.owasp.dependencycheck.analyzer
ArchiveAnalyzer (31%)
-AssemblyAnalyzer (68%)
+AssemblyAnalyzer (66%)
-CPEAnalyzer (81%)
+CPEAnalyzer (80%)
-CpeSuppressionAnalyzer (55%)
+CpeSuppressionAnalyzer (88%)
DependencyBundlingAnalyzer (34%)
-FalsePositiveAnalyzer (48%)
+FalsePositiveAnalyzer (50%)
FileNameAnalyzer (85%)
@@ -60,13 +60,13 @@ org.owasp.dependencycheck.analyzer
HintAnalyzer (76%)
-JarAnalyzer (53%)
+JarAnalyzer (60%)
JavaScriptAnalyzer (26%)
-NexusAnalyzer (15%)
+NexusAnalyzer (12%)
NuspecAnalyzer (20%)
@@ -75,7 +75,7 @@ org.owasp.dependencycheck.analyzer
NvdCveAnalyzer (67%)
-VulnerabilitySuppressionAnalyzer (55%)
+VulnerabilitySuppressionAnalyzer (88%)
diff --git a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.data.update.task.html b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.data.update.task.html
index b704f741e..9eb9b4e89 100644
--- a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.data.update.task.html
+++ b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.data.update.task.html
@@ -15,7 +15,7 @@ org.owasp.dependencycheck.data.update.task
-CallableDownloadTask (0%)
+DownloadTask (0%)
ProcessTask (0%)
diff --git a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.dependency.html b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.dependency.html
index 2bf789717..914d4ea05 100644
--- a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.dependency.html
+++ b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.dependency.html
@@ -18,7 +18,7 @@ org.owasp.dependencycheck.dependency
Confidence (100%)
-Dependency (57%)
+Dependency (61%)
Evidence (66%)
diff --git a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.suppression.html b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.suppression.html
index 7128330e8..f5bb0e2af 100644
--- a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.suppression.html
+++ b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.suppression.html
@@ -30,7 +30,7 @@ org.owasp.dependencycheck.suppression
SuppressionParser (68%)
-SuppressionRule (95%)
+SuppressionRule (70%)
diff --git a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.utils.html b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.utils.html
index d1219b86d..7008b586b 100644
--- a/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.utils.html
+++ b/dependency-check-core/cobertura/frame-sourcefiles-org.owasp.dependencycheck.utils.html
@@ -27,45 +27,18 @@ org.owasp.dependencycheck.utils
DependencyVersionUtil (95%)
-DownloadFailedException (N/A)
-
-
-Downloader (19%)
-
-
-ExtractionException (N/A)
-
-
-FileUtils (16%)
+ExtractionUtil (0%)
Filter (91%)
-InvalidSettingException (N/A)
-
-
-LogFilter (0%)
-
-
-LogUtils (12%)
-
-
NonClosingStream (100%)
Pair (28%)
-Settings (52%)
-
-
-URLConnectionFactory (18%)
-
-
-URLConnectionFailureException (N/A)
-
-
UrlStringUtils (95%)
diff --git a/dependency-check-core/cobertura/frame-sourcefiles.html b/dependency-check-core/cobertura/frame-sourcefiles.html
index bb422e3c5..2b23ef089 100644
--- a/dependency-check-core/cobertura/frame-sourcefiles.html
+++ b/dependency-check-core/cobertura/frame-sourcefiles.html
@@ -21,7 +21,7 @@ All Packages
AbstractFileTypeAnalyzer (74%)
-AbstractSuppressionAnalyzer (84%)
+AbstractSuppressionAnalyzer (82%)
AbstractTokenizingFilter (100%)
@@ -60,7 +60,7 @@ All Packages
ArchiveExtractionException (N/A)
-AssemblyAnalyzer (68%)
+AssemblyAnalyzer (66%)
Build (0%)
@@ -69,15 +69,12 @@ All Packages
BuildBase (0%)
-CPEAnalyzer (81%)
+CPEAnalyzer (80%)
CachedWebDataSource (N/A)
-CallableDownloadTask (0%)
-
-
Checksum (88%)
@@ -99,7 +96,7 @@ All Packages
CpeMemoryIndex (73%)
-CpeSuppressionAnalyzer (55%)
+CpeSuppressionAnalyzer (88%)
CweDB (54%)
@@ -117,7 +114,7 @@ All Packages
DatabaseProperties (21%)
-Dependency (57%)
+Dependency (61%)
Dependency (0%)
@@ -150,10 +147,7 @@ All Packages
DistributionManagement (N/A)
-DownloadFailedException (N/A)
-
-
-Downloader (19%)
+DownloadTask (0%)
DriverLoadException (N/A)
@@ -183,10 +177,10 @@ All Packages
Extension (N/A)
-ExtractionException (N/A)
+ExtractionUtil (0%)
-FalsePositiveAnalyzer (48%)
+FalsePositiveAnalyzer (50%)
FieldAnalyzer (100%)
@@ -201,9 +195,6 @@ All Packages
FileTypeAnalyzer (N/A)
-FileUtils (16%)
-
-
Filter (91%)
@@ -222,13 +213,10 @@ All Packages
InvalidDataException (N/A)
-InvalidSettingException (N/A)
-
-
IssueManagement (N/A)
-JarAnalyzer (53%)
+JarAnalyzer (60%)
JavaScriptAnalyzer (26%)
@@ -237,12 +225,6 @@ All Packages
License (N/A)
-LogFilter (0%)
-
-
-LogUtils (12%)
-
-
LuceneUtils (100%)
@@ -258,7 +240,7 @@ All Packages
Model (0%)
-NexusAnalyzer (15%)
+NexusAnalyzer (12%)
NexusSearch (70%)
@@ -372,9 +354,6 @@ All Packages
SearchVersionAnalyzer (0%)
-Settings (52%)
-
-
Site (N/A)
@@ -393,18 +372,12 @@ All Packages
SuppressionParser (68%)
-SuppressionRule (95%)
+SuppressionRule (70%)
TokenPairConcatenatingFilter (100%)
-URLConnectionFactory (18%)
-
-
-URLConnectionFailureException (N/A)
-
-
UpdateException (N/A)
@@ -435,7 +408,7 @@ All Packages
VulnerabilityComparator (100%)
-VulnerabilitySuppressionAnalyzer (55%)
+VulnerabilitySuppressionAnalyzer (88%)
VulnerableSoftware (75%)
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.agent.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.agent.html
index 1e271cb39..b8933b2db 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.agent.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.agent.html
@@ -16,7 +16,7 @@
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.analyzer.exception.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.analyzer.exception.html
index 5b03013c1..fcb005bf5 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.analyzer.exception.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.analyzer.exception.html
@@ -39,6 +39,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.analyzer.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.analyzer.html
index 64b0716fa..f56272d9b 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.analyzer.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.analyzer.html
@@ -16,7 +16,7 @@
@@ -33,7 +33,7 @@ packageTable.sort(0);
AbstractFileTypeAnalyzer 1.6153846153846154; 1.615
- AbstractSuppressionAnalyzer 3.6666666666666665; 3.667
+ AbstractSuppressionAnalyzer 3.8333333333333335; 3.833
AnalysisPhase 0.0; 0
@@ -43,17 +43,17 @@ packageTable.sort(0);
ArchiveAnalyzer 6.916666666666667; 6.917
- AssemblyAnalyzer 6.875; 6.875
+ AssemblyAnalyzer 6.875; 6.875
- CPEAnalyzer 4.428571428571429; 4.429
+ CPEAnalyzer 4.428571428571429; 4.429
CPEAnalyzer$IdentifierConfidence 4.428571428571429; 4.429
CPEAnalyzer$IdentifierMatch 4.428571428571429; 4.429
- CpeSuppressionAnalyzer 2.3333333333333335; 2.333
+ CpeSuppressionAnalyzer 2.3333333333333335; 2.333
DependencyBundlingAnalyzer 9.090909090909092; 9.091
- FalsePositiveAnalyzer 8.75; 8.75
+ FalsePositiveAnalyzer 9.5; 9.5
FileNameAnalyzer 2.6666666666666665; 2.667
@@ -61,18 +61,18 @@ packageTable.sort(0);
HintAnalyzer 3.3333333333333335; 3.333
- JarAnalyzer 7.428571428571429; 7.429
- JarAnalyzer$ClassNameInformation 7.428571428571429; 7.429
+ JarAnalyzer 7.411764705882353; 7.412
+ JarAnalyzer$ClassNameInformation 7.411764705882353; 7.412
JavaScriptAnalyzer 2.0; 2
- NexusAnalyzer 3.3333333333333335; 3.333
+ NexusAnalyzer 4.0; 4
NuspecAnalyzer 2.6666666666666665; 2.667
NvdCveAnalyzer 2.125; 2.125
- VulnerabilitySuppressionAnalyzer 2.3333333333333335; 2.333
+ VulnerabilitySuppressionAnalyzer 2.3333333333333335; 2.333
@@ -81,6 +81,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.cpe.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.cpe.html
index 4aaa4d919..d53b793fb 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.cpe.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.cpe.html
@@ -43,6 +43,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.cwe.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.cwe.html
index b8c08935c..928b04dd0 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.cwe.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.cwe.html
@@ -39,6 +39,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.lucene.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.lucene.html
index 40772fd65..103bfc491 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.lucene.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.lucene.html
@@ -57,6 +57,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nexus.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nexus.html
index 7d5e801f0..12893ce4c 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nexus.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nexus.html
@@ -39,6 +39,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nuget.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nuget.html
index 94e98db86..86675d65d 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nuget.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nuget.html
@@ -43,6 +43,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nvdcve.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nvdcve.html
index f9e26dbc6..843e58c6e 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nvdcve.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.nvdcve.html
@@ -50,6 +50,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.exception.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.exception.html
index 7b9c40ced..2c5a89956 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.exception.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.exception.html
@@ -39,6 +39,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.html
index 49bfeff41..3e8342d7c 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.html
@@ -50,6 +50,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.task.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.task.html
index 033236023..24a6b2f8b 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.task.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.task.html
@@ -28,7 +28,7 @@ packageTable.sort(0);
Classes in this Package Line Coverage Branch Coverage Complexity
- CallableDownloadTask 2.4545454545454546; 2.455
+ DownloadTask 2.4545454545454546; 2.455
ProcessTask 3.5; 3.5
@@ -39,6 +39,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.xml.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.xml.html
index 74d7a5760..033c858c3 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.xml.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.data.update.xml.html
@@ -41,6 +41,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.dependency.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.dependency.html
index a30885060..65f4929ea 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.dependency.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.dependency.html
@@ -16,7 +16,7 @@
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.exception.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.exception.html
index 1f7927c83..379063ca1 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.exception.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.exception.html
@@ -39,6 +39,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.html
index 2bb951574..c830c3009 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.html
@@ -17,8 +17,8 @@
Package # Classes Line Coverage Branch Coverage Complexity
org.owasp.dependencycheck 1 3.1818181818181817; 3.182
- org.owasp.dependencycheck.agent 1 1.90625; 1.906
- org.owasp.dependencycheck.analyzer 24 5.069364161849711; 5.069
+ org.owasp.dependencycheck.agent 1 1.878787878787879; 1.879
+ org.owasp.dependencycheck.analyzer 24 5.133720930232558; 5.134
org.owasp.dependencycheck.analyzer.exception 2 1.0; 1
org.owasp.dependencycheck.data.cpe 4 2.5; 2.5
org.owasp.dependencycheck.data.cwe 2 2.8; 2.8
@@ -30,13 +30,13 @@
org.owasp.dependencycheck.data.update.exception 2 1.0; 1
org.owasp.dependencycheck.data.update.task 2 2.823529411764706; 2.824
org.owasp.dependencycheck.data.update.xml 4 2.914285714285714; 2.914
- org.owasp.dependencycheck.dependency 14 2.4431818181818183; 2.443
+ org.owasp.dependencycheck.dependency 14 2.4431818181818183; 2.443
org.owasp.dependencycheck.exception 2 1.0; 1
org.owasp.dependencycheck.jaxb.pom 1 1.25; 1.25
org.owasp.dependencycheck.jaxb.pom.generated 87 1.0907407407407408; 1.091
org.owasp.dependencycheck.reporting 4 3.7142857142857144; 3.714
- org.owasp.dependencycheck.suppression 6 2.7916666666666665; 2.792
- org.owasp.dependencycheck.utils 22 3.018867924528302; 3.019
+ org.owasp.dependencycheck.suppression 6 3.0384615384615383; 3.038
+ org.owasp.dependencycheck.utils 11 3.4583333333333335; 3.458
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.jaxb.pom.generated.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.jaxb.pom.generated.html
index 88610f70d..c5b491708 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.jaxb.pom.generated.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.jaxb.pom.generated.html
@@ -160,6 +160,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.jaxb.pom.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.jaxb.pom.html
index ae363336c..e0640f80e 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.jaxb.pom.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.jaxb.pom.html
@@ -38,6 +38,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.reporting.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.reporting.html
index 0a62d8be9..6f196a1e5 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.reporting.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.reporting.html
@@ -42,6 +42,6 @@ var classTable = new SortableTable(document.getElementById("classResults"),
["String", "Percentage", "Percentage", "FormattedNumber"]);
classTable.sort(0);
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.suppression.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.suppression.html
index 6315d1499..7865aa33f 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.suppression.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.suppression.html
@@ -16,7 +16,7 @@
-
+
diff --git a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.utils.html b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.utils.html
index 56de0d88c..95d804d10 100644
--- a/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.utils.html
+++ b/dependency-check-core/cobertura/frame-summary-org.owasp.dependencycheck.utils.html
@@ -16,7 +16,7 @@
-
+
diff --git a/dependency-check-core/cobertura/frame-summary.html b/dependency-check-core/cobertura/frame-summary.html
index a3cbe5662..f38b67846 100644
--- a/dependency-check-core/cobertura/frame-summary.html
+++ b/dependency-check-core/cobertura/frame-summary.html
@@ -16,10 +16,10 @@
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.Engine.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.Engine.html
index 5397497cc..925b195cb 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.Engine.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.Engine.html
@@ -167,7 +167,7 @@
75
- 76 1 private static final Logger LOGGER = Logger.getLogger(Engine.class .getName());
+ 76 2 private static final Logger LOGGER = Logger.getLogger(Engine.class .getName());
77
78
@@ -182,8 +182,8 @@
83
public Engine() throws DatabaseException {
- 84 1 this (Thread.currentThread().getContextClassLoader());
- 85 1 }
+ 84 2 this (Thread.currentThread().getContextClassLoader());
+ 85 2 }
86
87
@@ -198,29 +198,29 @@
92
- 93 1 public Engine(ClassLoader serviceClassLoader) throws DatabaseException {
- 94 1 this .dependencies = new ArrayList<Dependency>();
- 95 1 this .analyzers = new EnumMap<AnalysisPhase, List<Analyzer>>(AnalysisPhase.class );
- 96 1 this .fileTypeAnalyzers = new HashSet<FileTypeAnalyzer>();
- 97 1 this .serviceClassLoader = serviceClassLoader;
+ 93 2 public Engine(ClassLoader serviceClassLoader) throws DatabaseException {
+ 94 2 this .dependencies = new ArrayList<Dependency>();
+ 95 2 this .analyzers = new EnumMap<AnalysisPhase, List<Analyzer>>(AnalysisPhase.class );
+ 96 2 this .fileTypeAnalyzers = new HashSet<FileTypeAnalyzer>();
+ 97 2 this .serviceClassLoader = serviceClassLoader;
98
- 99 1 ConnectionFactory.initialize();
+ 99 2 ConnectionFactory.initialize();
100
- 101 1 boolean autoUpdate = true ;
+ 101 2 boolean autoUpdate = true ;
102
try {
- 103 1 autoUpdate = Settings.getBoolean(Settings.KEYS.AUTO_UPDATE);
+ 103 2 autoUpdate = Settings.getBoolean(Settings.KEYS.AUTO_UPDATE);
104 0 } catch (InvalidSettingException ex) {
105 0 LOGGER.log(Level.FINE, "Invalid setting for auto-update; using true." );
- 106 1 }
- 107 1 if (autoUpdate) {
+ 106 2 }
+ 107 2 if (autoUpdate) {
108 0 doUpdates();
109
}
- 110 1 loadAnalyzers();
- 111 1 }
+ 110 2 loadAnalyzers();
+ 111 2 }
112
113
@@ -245,23 +245,23 @@
private void loadAnalyzers() {
124
- 125 10 for (AnalysisPhase phase : AnalysisPhase.values()) {
- 126 9 analyzers.put(phase, new ArrayList<Analyzer>());
+ 125 20 for (AnalysisPhase phase : AnalysisPhase.values()) {
+ 126 18 analyzers.put(phase, new ArrayList<Analyzer>());
127
}
128
- 129 1 final AnalyzerService service = new AnalyzerService(serviceClassLoader);
- 130 1 final Iterator<Analyzer> iterator = service.getAnalyzers();
- 131 14 while (iterator.hasNext()) {
- 132 13 final Analyzer a = iterator.next();
- 133 13 analyzers.get(a.getAnalysisPhase()).add(a);
- 134 13 if (a instanceof FileTypeAnalyzer) {
- 135 5 this .fileTypeAnalyzers.add((FileTypeAnalyzer) a);
+ 129 2 final AnalyzerService service = new AnalyzerService(serviceClassLoader);
+ 130 2 final Iterator<Analyzer> iterator = service.getAnalyzers();
+ 131 28 while (iterator.hasNext()) {
+ 132 26 final Analyzer a = iterator.next();
+ 133 26 analyzers.get(a.getAnalysisPhase()).add(a);
+ 134 26 if (a instanceof FileTypeAnalyzer) {
+ 135 10 this .fileTypeAnalyzers.add((FileTypeAnalyzer) a);
136
}
- 137 13 }
- 138 1 }
+ 137 26 }
+ 138 2 }
139
140
@@ -466,17 +466,17 @@
255
public void scan(File file) {
- 256 4 if (file.exists()) {
- 257 4 if (file.isDirectory()) {
- 258 2 scanDirectory(file);
+ 256 8 if (file.exists()) {
+ 257 8 if (file.isDirectory()) {
+ 258 4 scanDirectory(file);
259
} else {
- 260 2 scanFile(file);
+ 260 4 scanFile(file);
261
}
262
}
- 263 4 }
+ 263 8 }
264
265
@@ -491,11 +491,11 @@
270
protected void scanDirectory(File dir) {
- 271 38 final File[] files = dir.listFiles();
- 272 38 if (files != null ) {
- 273 74 for (File f : files) {
- 274 36 if (f.isDirectory()) {
- 275 36 scanDirectory(f);
+ 271 76 final File[] files = dir.listFiles();
+ 272 76 if (files != null ) {
+ 273 148 for (File f : files) {
+ 274 72 if (f.isDirectory()) {
+ 275 72 scanDirectory(f);
276
} else {
277 0 scanFile(f);
@@ -505,7 +505,7 @@
}
280
}
- 281 38 }
+ 281 76 }
282
283
@@ -520,19 +520,19 @@
288
protected void scanFile(File file) {
- 289 2 if (!file.isFile()) {
+ 289 4 if (!file.isFile()) {
290 0 final String msg = String.format("Path passed to scanFile(File) is not a file: %s. Skipping the file." , file.toString());
291 0 LOGGER.log(Level.FINE, msg);
292 0 return ;
293
}
- 294 2 final String fileName = file.getName();
- 295 2 final String extension = FileUtils.getFileExtension(fileName);
- 296 2 if (extension != null ) {
- 297 2 if (supportsExtension(extension)) {
- 298 2 final Dependency dependency = new Dependency(file);
- 299 2 dependencies.add(dependency);
- 300 2 }
+ 294 4 final String fileName = file.getName();
+ 295 4 final String extension = FileUtils.getFileExtension(fileName);
+ 296 4 if (extension != null ) {
+ 297 4 if (supportsExtension(extension)) {
+ 298 4 final Dependency dependency = new Dependency(file);
+ 299 4 dependencies.add(dependency);
+ 300 4 }
301
} else {
302 0 final String msg = String.format("No file extension found on file '%s'. The file was not analyzed." ,
@@ -541,7 +541,7 @@
304 0 LOGGER.log(Level.FINEST, msg);
305
}
- 306 2 }
+ 306 4 }
307
308
@@ -556,7 +556,7 @@
313
try {
- 314 1 ensureDataExists();
+ 314 2 ensureDataExists();
315 0 } catch (NoDataException ex) {
316 0 final String msg = String.format("%s%n%nUnable to continue dependency-check analysis." , ex.getMessage());
317 0 LOGGER.log(Level.SEVERE, msg);
@@ -569,28 +569,28 @@
324 0 return ;
325
- 326 1 }
+ 326 2 }
327
- 328 1 final String logHeader = String.format("%n"
+ 328 2 final String logHeader = String.format("%n"
329
+ "----------------------------------------------------%n"
330
+ "BEGIN ANALYSIS%n"
331
+ "----------------------------------------------------" );
- 332 1 LOGGER.log(Level.FINE, logHeader);
- 333 1 LOGGER.log(Level.INFO, "Analysis Starting" );
+ 332 2 LOGGER.log(Level.FINE, logHeader);
+ 333 2 LOGGER.log(Level.INFO, "Analysis Starting" );
334
335
- 336 10 for (AnalysisPhase phase : AnalysisPhase.values()) {
- 337 9 final List<Analyzer> analyzerList = analyzers.get(phase);
+ 336 20 for (AnalysisPhase phase : AnalysisPhase.values()) {
+ 337 18 final List<Analyzer> analyzerList = analyzers.get(phase);
338
- 339 9 for (Analyzer a : analyzerList) {
- 340 13 initializeAnalyzer(a);
+ 339 18 for (Analyzer a : analyzerList) {
+ 340 26 initializeAnalyzer(a);
341
342
@@ -601,23 +601,23 @@
345
- 346 13 final String msg = String.format("Begin Analyzer '%s'" , a.getName());
- 347 13 LOGGER.log(Level.FINE, msg);
- 348 13 final Set<Dependency> dependencySet = new HashSet<Dependency>();
- 349 13 dependencySet.addAll(dependencies);
- 350 13 for (Dependency d : dependencySet) {
- 351 26 boolean shouldAnalyze = true ;
- 352 26 if (a instanceof FileTypeAnalyzer) {
- 353 10 final FileTypeAnalyzer fAnalyzer = (FileTypeAnalyzer) a;
- 354 10 shouldAnalyze = fAnalyzer.supportsExtension(d.getFileExtension());
+ 346 26 final String msg = String.format("Begin Analyzer '%s'" , a.getName());
+ 347 26 LOGGER.log(Level.FINE, msg);
+ 348 26 final Set<Dependency> dependencySet = new HashSet<Dependency>();
+ 349 26 dependencySet.addAll(dependencies);
+ 350 26 for (Dependency d : dependencySet) {
+ 351 52 boolean shouldAnalyze = true ;
+ 352 52 if (a instanceof FileTypeAnalyzer) {
+ 353 20 final FileTypeAnalyzer fAnalyzer = (FileTypeAnalyzer) a;
+ 354 20 shouldAnalyze = fAnalyzer.supportsExtension(d.getFileExtension());
355
}
- 356 26 if (shouldAnalyze) {
- 357 20 final String msgFile = String.format("Begin Analysis of '%s'" , d.getActualFilePath());
- 358 20 LOGGER.log(Level.FINE, msgFile);
+ 356 52 if (shouldAnalyze) {
+ 357 40 final String msgFile = String.format("Begin Analysis of '%s'" , d.getActualFilePath());
+ 358 40 LOGGER.log(Level.FINE, msgFile);
359
try {
- 360 20 a.analyze(d, this );
+ 360 40 a.analyze(d, this );
361 0 } catch (AnalysisException ex) {
362 0 final String exMsg = String.format("An error occurred while analyzing '%s'." , d.getActualFilePath());
363 0 LOGGER.log(Level.WARNING, exMsg);
@@ -628,34 +628,34 @@
368 0 LOGGER.log(Level.WARNING, axMsg);
369 0 LOGGER.log(Level.FINE, "" , ex);
- 370 20 }
+ 370 40 }
371
}
- 372 26 }
- 373 13 }
+ 372 52 }
+ 373 26 }
374
}
- 375 10 for (AnalysisPhase phase : AnalysisPhase.values()) {
- 376 9 final List<Analyzer> analyzerList = analyzers.get(phase);
+ 375 20 for (AnalysisPhase phase : AnalysisPhase.values()) {
+ 376 18 final List<Analyzer> analyzerList = analyzers.get(phase);
377
- 378 9 for (Analyzer a : analyzerList) {
- 379 13 closeAnalyzer(a);
- 380 13 }
+ 378 18 for (Analyzer a : analyzerList) {
+ 379 26 closeAnalyzer(a);
+ 380 26 }
381
}
382
- 383 1 final String logFooter = String.format("%n"
+ 383 2 final String logFooter = String.format("%n"
384
+ "----------------------------------------------------%n"
385
+ "END ANALYSIS%n"
386
+ "----------------------------------------------------" );
- 387 1 LOGGER.log(Level.FINE, logFooter);
- 388 1 LOGGER.log(Level.INFO, "Analysis Complete" );
- 389 1 }
+ 387 2 LOGGER.log(Level.FINE, logFooter);
+ 388 2 LOGGER.log(Level.INFO, "Analysis Complete" );
+ 389 2 }
390
391
@@ -672,9 +672,9 @@
private void initializeAnalyzer(Analyzer analyzer) {
397
try {
- 398 13 final String msg = String.format("Initializing %s" , analyzer.getName());
- 399 13 LOGGER.log(Level.FINE, msg);
- 400 13 analyzer.initialize();
+ 398 26 final String msg = String.format("Initializing %s" , analyzer.getName());
+ 399 26 LOGGER.log(Level.FINE, msg);
+ 400 26 analyzer.initialize();
401 0 } catch (Throwable ex) {
402 0 final String msg = String.format("Exception occurred initializing %s." , analyzer.getName());
403 0 LOGGER.log(Level.SEVERE, msg);
@@ -685,8 +685,8 @@
407 0 } catch (Throwable ex1) {
408 0 LOGGER.log(Level.FINEST, null , ex1);
409 0 }
- 410 13 }
- 411 13 }
+ 410 26 }
+ 411 26 }
412
413
@@ -701,15 +701,15 @@
418
private void closeAnalyzer(Analyzer analyzer) {
- 419 13 final String msg = String.format("Closing Analyzer '%s'" , analyzer.getName());
- 420 13 LOGGER.log(Level.FINE, msg);
+ 419 26 final String msg = String.format("Closing Analyzer '%s'" , analyzer.getName());
+ 420 26 LOGGER.log(Level.FINE, msg);
421
try {
- 422 13 analyzer.close();
+ 422 26 analyzer.close();
423 0 } catch (Throwable ex) {
424 0 LOGGER.log(Level.FINEST, null , ex);
- 425 13 }
- 426 13 }
+ 425 26 }
+ 426 26 }
427
428
@@ -776,19 +776,19 @@
467
public boolean supportsExtension(String ext) {
- 468 851 if (ext == null ) {
- 469 3 return false ;
+ 468 1702 if (ext == null ) {
+ 469 6 return false ;
470
}
- 471 848 boolean scan = false ;
- 472 848 for (FileTypeAnalyzer a : this .fileTypeAnalyzers) {
+ 471 1696 boolean scan = false ;
+ 472 1696 for (FileTypeAnalyzer a : this .fileTypeAnalyzers) {
473
474
- 475 4240 scan |= a.supportsExtension(ext);
- 476 4240 }
- 477 848 return scan;
+ 475 8480 scan |= a.supportsExtension(ext);
+ 476 8480 }
+ 477 1696 return scan;
478
}
479
@@ -807,32 +807,32 @@
486
private void ensureDataExists() throws NoDataException, DatabaseException {
- 487 1 final CpeMemoryIndex cpe = CpeMemoryIndex.getInstance();
- 488 1 final CveDB cve = new CveDB();
+ 487 2 final CpeMemoryIndex cpe = CpeMemoryIndex.getInstance();
+ 488 2 final CveDB cve = new CveDB();
489
490
try {
- 491 1 cve.open();
- 492 1 cpe.open(cve);
+ 491 2 cve.open();
+ 492 2 cpe.open(cve);
493 0 } catch (IndexException ex) {
494 0 throw new NoDataException(ex.getMessage(), ex);
495 0 } catch (DatabaseException ex) {
496 0 throw new NoDataException(ex.getMessage(), ex);
497
} finally {
- 498 1 cve.close();
- 499 1 }
- 500 1 if (cpe.numDocs() <= 0) {
+ 498 2 cve.close();
+ 499 2 }
+ 500 2 if (cpe.numDocs() <= 0) {
501 0 cpe.close();
502 0 throw new NoDataException("No documents exist" );
503
}
- 504 1 }
+ 504 2 }
505
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.agent.DependencyCheckScanAgent.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.agent.DependencyCheckScanAgent.html
index 35b748678..ac606eb9e 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.agent.DependencyCheckScanAgent.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.agent.DependencyCheckScanAgent.html
@@ -12,7 +12,7 @@
@@ -48,7 +48,7 @@
15
16
-
+
17
18
@@ -482,27 +482,27 @@
236
237
-
+
238
239
- private String proxyUrl;
+ private String proxyServer;
240
241
242
-
+
243
244
-
+
245
246
- public String getProxyUrl() {
+ public String getProxyServer() {
247
- return proxyUrl;
+ return proxyServer;
248
}
249
@@ -510,17 +510,17 @@
250
251
-
+
252
253
-
+
254
255
- public void setProxyUrl(String proxyUrl) {
+ public void setProxyServer(String proxyServer) {
256
- this .proxyUrl = proxyUrl;
+ this .proxyServer = proxyServer;
257
}
258
@@ -528,45 +528,45 @@
259
260
-
+
261
-
+
262
- private String proxyPort;
+
263
-
+
264
-
+
265
-
+ @Deprecated
266
-
+ public String getProxyUrl() {
267
-
+ return proxyServer;
268
-
- 269
- public String getProxyPort() {
- 270
- return proxyPort;
- 271
}
- 272
+ 269
- 273
+ 270
- 274
-
- 275
+ 271
+
+ 272
+ 273
+
+ 274
+
+ 275
+
276
-
- 277
+ 277
+ @Deprecated
278
- public void setProxyPort(String proxyPort) {
+ public void setProxyUrl(String proxyUrl) {
279
- this .proxyPort = proxyPort;
+ this .proxyServer = proxyUrl;
280
}
281
@@ -574,27 +574,27 @@
282
283
-
+
284
285
- private String proxyUsername;
+ private String proxyPort;
286
287
288
-
+
289
290
-
+
291
292
- public String getProxyUsername() {
+ public String getProxyPort() {
293
- return proxyUsername;
+ return proxyPort;
294
}
295
@@ -602,17 +602,17 @@
296
297
-
+
298
299
-
+
300
301
- public void setProxyUsername(String proxyUsername) {
+ public void setProxyPort(String proxyPort) {
302
- this .proxyUsername = proxyUsername;
+ this .proxyPort = proxyPort;
303
}
304
@@ -620,27 +620,27 @@
305
306
-
+
307
308
- private String proxyPassword;
+ private String proxyUsername;
309
310
311
-
+
312
313
-
+
314
315
- public String getProxyPassword() {
+ public String getProxyUsername() {
316
- return proxyPassword;
+ return proxyUsername;
317
}
318
@@ -648,17 +648,17 @@
319
320
-
+
321
322
-
+
323
324
- public void setProxyPassword(String proxyPassword) {
+ public void setProxyUsername(String proxyUsername) {
325
- this .proxyPassword = proxyPassword;
+ this .proxyUsername = proxyUsername;
326
}
327
@@ -666,27 +666,27 @@
328
329
-
+
330
331
- private String connectionTimeout;
+ private String proxyPassword;
332
333
334
-
+
335
336
-
+
337
338
- public String getConnectionTimeout() {
+ public String getProxyPassword() {
339
- return connectionTimeout;
+ return proxyPassword;
340
}
341
@@ -694,17 +694,17 @@
342
343
-
+
344
345
-
+
346
347
- public void setConnectionTimeout(String connectionTimeout) {
+ public void setProxyPassword(String proxyPassword) {
348
- this .connectionTimeout = connectionTimeout;
+ this .proxyPassword = proxyPassword;
349
}
350
@@ -712,26 +712,27 @@
351
352
-
+
353
- 354 0 private String logFile = null ;
+ 354
+ private String connectionTimeout;
355
356
357
-
+
358
359
-
+
360
361
- public String getLogFile() {
+ public String getConnectionTimeout() {
362
- return logFile;
+ return connectionTimeout;
363
}
364
@@ -739,17 +740,17 @@
365
366
-
+
367
368
-
+
369
370
- public void setLogFile(String logFile) {
+ public void setConnectionTimeout(String connectionTimeout) {
371
- this .logFile = logFile;
+ this .connectionTimeout = connectionTimeout;
372
}
373
@@ -757,27 +758,26 @@
374
375
-
+
376
- 377
- private String suppressionFile;
+ 377 0 private String logFile = null ;
378
379
380
-
+
381
382
-
+
383
384
- public String getSuppressionFile() {
+ public String getLogFile() {
385
- return suppressionFile;
+ return logFile;
386
}
387
@@ -785,17 +785,17 @@
388
389
-
+
390
391
-
+
392
393
- public void setSuppressionFile(String suppressionFile) {
+ public void setLogFile(String logFile) {
394
- this .suppressionFile = suppressionFile;
+ this .logFile = logFile;
395
}
396
@@ -803,26 +803,27 @@
397
398
-
+
399
- 400 0 private boolean showSummary = true ;
+ 400
+ private String suppressionFile;
401
402
403
-
+
404
405
-
+
406
407
- public boolean isShowSummary() {
+ public String getSuppressionFile() {
408
- return showSummary;
+ return suppressionFile;
409
}
410
@@ -830,17 +831,17 @@
411
412
-
+
413
414
-
+
415
416
- public void setShowSummary(boolean showSummary) {
+ public void setSuppressionFile(String suppressionFile) {
417
- this .showSummary = showSummary;
+ this .suppressionFile = suppressionFile;
418
}
419
@@ -848,26 +849,26 @@
420
421
-
+
422
- 423 0 private boolean nexusAnalyzerEnabled = true ;
+ 423 0 private boolean showSummary = true ;
424
425
426
-
+
427
428
-
+
429
430
- public boolean isNexusAnalyzerEnabled() {
+ public boolean isShowSummary() {
431
- return nexusAnalyzerEnabled;
+ return showSummary;
432
}
433
@@ -875,17 +876,17 @@
434
435
-
+
436
437
-
+
438
439
- public void setNexusAnalyzerEnabled(boolean nexusAnalyzerEnabled) {
+ public void setShowSummary(boolean showSummary) {
440
- this .nexusAnalyzerEnabled = nexusAnalyzerEnabled;
+ this .showSummary = showSummary;
441
}
442
@@ -893,27 +894,26 @@
443
444
-
+
445
- 446
- private String nexusUrl;
+ 446 0 private boolean nexusAnalyzerEnabled = true ;
447
448
449
-
+
450
451
-
+
452
453
- public String getNexusUrl() {
+ public boolean isNexusAnalyzerEnabled() {
454
- return nexusUrl;
+ return nexusAnalyzerEnabled;
455
}
456
@@ -921,17 +921,17 @@
457
458
-
+
459
460
-
+
461
462
- public void setNexusUrl(String nexusUrl) {
+ public void setNexusAnalyzerEnabled(boolean nexusAnalyzerEnabled) {
463
- this .nexusUrl = nexusUrl;
+ this .nexusAnalyzerEnabled = nexusAnalyzerEnabled;
464
}
465
@@ -939,26 +939,27 @@
466
467
-
+
468
- 469 0 private boolean nexusUsesProxy = true ;
+ 469
+ private String nexusUrl;
470
471
472
-
+
473
474
-
+
475
476
- public boolean isNexusUsesProxy() {
+ public String getNexusUrl() {
477
- return nexusUsesProxy;
+ return nexusUrl;
478
}
479
@@ -966,17 +967,17 @@
480
481
-
+
482
483
-
+
484
485
- public void setNexusUsesProxy(boolean nexusUsesProxy) {
+ public void setNexusUrl(String nexusUrl) {
486
- this .nexusUsesProxy = nexusUsesProxy;
+ this .nexusUrl = nexusUrl;
487
}
488
@@ -984,27 +985,26 @@
489
490
-
+
491
- 492
- private String databaseDriverName;
+ 492 0 private boolean nexusUsesProxy = true ;
493
494
495
-
+
496
497
-
+
498
499
- public String getDatabaseDriverName() {
+ public boolean isNexusUsesProxy() {
500
- return databaseDriverName;
+ return nexusUsesProxy;
501
}
502
@@ -1012,17 +1012,17 @@
503
504
-
+
505
506
-
+
507
508
- public void setDatabaseDriverName(String databaseDriverName) {
+ public void setNexusUsesProxy(boolean nexusUsesProxy) {
509
- this .databaseDriverName = databaseDriverName;
+ this .nexusUsesProxy = nexusUsesProxy;
510
}
511
@@ -1030,27 +1030,27 @@
512
513
-
+
514
515
- private String databaseDriverPath;
+ private String databaseDriverName;
516
517
518
-
+
519
520
-
+
521
522
- public String getDatabaseDriverPath() {
+ public String getDatabaseDriverName() {
523
- return databaseDriverPath;
+ return databaseDriverName;
524
}
525
@@ -1058,17 +1058,17 @@
526
527
-
+
528
529
-
+
530
531
- public void setDatabaseDriverPath(String databaseDriverPath) {
+ public void setDatabaseDriverName(String databaseDriverName) {
532
- this .databaseDriverPath = databaseDriverPath;
+ this .databaseDriverName = databaseDriverName;
533
}
534
@@ -1076,27 +1076,27 @@
535
536
-
+
537
538
- private String connectionString;
+ private String databaseDriverPath;
539
540
541
-
+
542
543
-
+
544
545
- public String getConnectionString() {
+ public String getDatabaseDriverPath() {
546
- return connectionString;
+ return databaseDriverPath;
547
}
548
@@ -1104,17 +1104,17 @@
549
550
-
+
551
552
-
+
553
554
- public void setConnectionString(String connectionString) {
+ public void setDatabaseDriverPath(String databaseDriverPath) {
555
- this .connectionString = connectionString;
+ this .databaseDriverPath = databaseDriverPath;
556
}
557
@@ -1122,27 +1122,27 @@
558
559
-
+
560
561
- private String databaseUser;
+ private String connectionString;
562
563
564
-
+
565
566
-
+
567
568
- public String getDatabaseUser() {
+ public String getConnectionString() {
569
- return databaseUser;
+ return connectionString;
570
}
571
@@ -1150,17 +1150,17 @@
572
573
-
+
574
575
-
+
576
577
- public void setDatabaseUser(String databaseUser) {
+ public void setConnectionString(String connectionString) {
578
- this .databaseUser = databaseUser;
+ this .connectionString = connectionString;
579
}
580
@@ -1168,27 +1168,27 @@
581
582
-
+
583
584
- private String databasePassword;
+ private String databaseUser;
585
586
587
-
+
588
589
-
+
590
591
- public String getDatabasePassword() {
+ public String getDatabaseUser() {
592
- return databasePassword;
+ return databaseUser;
593
}
594
@@ -1196,17 +1196,17 @@
595
596
-
+
597
598
-
+
599
600
- public void setDatabasePassword(String databasePassword) {
+ public void setDatabaseUser(String databaseUser) {
601
- this .databasePassword = databasePassword;
+ this .databaseUser = databaseUser;
602
}
603
@@ -1214,75 +1214,75 @@
604
605
-
+
606
-
+
607
-
+ private String databasePassword;
608
- private String zipExtensions;
+
609
-
+
610
-
+
611
-
+
612
-
+
613
-
+
614
-
+ public String getDatabasePassword() {
615
- public String getZipExtensions() {
+ return databasePassword;
616
- return zipExtensions;
+ }
617
- }
+
618
-
+
619
-
+
620
-
- 621
+ 621
+
622
-
- 623
+ 623
+ public void setDatabasePassword(String databasePassword) {
624
- public void setZipExtensions(String zipExtensions) {
+ this .databasePassword = databasePassword;
625
- this .zipExtensions = zipExtensions;
- 626
}
- 627
+ 626
- 628
+ 627
+ 628
+
629
-
+
630
631
- private String cveUrl12Modified;
+ private String zipExtensions;
632
633
634
-
+
635
636
-
+
637
638
- public String getCveUrl12Modified() {
+ public String getZipExtensions() {
639
- return cveUrl12Modified;
+ return zipExtensions;
640
}
641
@@ -1290,17 +1290,17 @@
642
643
-
+
644
645
-
+
646
647
- public void setCveUrl12Modified(String cveUrl12Modified) {
+ public void setZipExtensions(String zipExtensions) {
648
- this .cveUrl12Modified = cveUrl12Modified;
+ this .zipExtensions = zipExtensions;
649
}
650
@@ -1308,27 +1308,27 @@
651
652
-
+
653
654
- private String cveUrl20Modified;
+ private String cveUrl12Modified;
655
656
657
-
+
658
659
-
+
660
661
- public String getCveUrl20Modified() {
+ public String getCveUrl12Modified() {
662
- return cveUrl20Modified;
+ return cveUrl12Modified;
663
}
664
@@ -1336,17 +1336,17 @@
665
666
-
+
667
668
-
+
669
670
- public void setCveUrl20Modified(String cveUrl20Modified) {
+ public void setCveUrl12Modified(String cveUrl12Modified) {
671
- this .cveUrl20Modified = cveUrl20Modified;
+ this .cveUrl12Modified = cveUrl12Modified;
672
}
673
@@ -1354,27 +1354,27 @@
674
675
-
+
676
677
- private String cveUrl12Base;
+ private String cveUrl20Modified;
678
679
680
-
+
681
682
-
+
683
684
- public String getCveUrl12Base() {
+ public String getCveUrl20Modified() {
685
- return cveUrl12Base;
+ return cveUrl20Modified;
686
}
687
@@ -1382,17 +1382,17 @@
688
689
-
+
690
691
-
+
692
693
- public void setCveUrl12Base(String cveUrl12Base) {
+ public void setCveUrl20Modified(String cveUrl20Modified) {
694
- this .cveUrl12Base = cveUrl12Base;
+ this .cveUrl20Modified = cveUrl20Modified;
695
}
696
@@ -1400,27 +1400,27 @@
697
698
-
+
699
700
- private String cveUrl20Base;
+ private String cveUrl12Base;
701
702
703
-
+
704
705
-
+
706
707
- public String getCveUrl20Base() {
+ public String getCveUrl12Base() {
708
- return cveUrl20Base;
+ return cveUrl12Base;
709
}
710
@@ -1428,17 +1428,17 @@
711
712
-
+
713
714
-
+
715
716
- public void setCveUrl20Base(String cveUrl20Base) {
+ public void setCveUrl12Base(String cveUrl12Base) {
717
- this .cveUrl20Base = cveUrl20Base;
+ this .cveUrl12Base = cveUrl12Base;
718
}
719
@@ -1446,27 +1446,27 @@
720
721
-
+
722
723
- private String pathToMono;
+ private String cveUrl20Base;
724
725
726
-
+
727
728
-
+
729
730
- public String getPathToMono() {
+ public String getCveUrl20Base() {
731
- return pathToMono;
+ return cveUrl20Base;
732
}
733
@@ -1474,17 +1474,17 @@
734
735
-
+
736
737
-
+
738
739
- public void setPathToMono(String pathToMono) {
+ public void setCveUrl20Base(String cveUrl20Base) {
740
- this .pathToMono = pathToMono;
+ this .cveUrl20Base = cveUrl20Base;
741
}
742
@@ -1492,335 +1492,381 @@
743
744
-
+
745
-
+
746
-
+ private String pathToMono;
747
-
+
748
-
+
749
-
+
750
- private Engine executeDependencyCheck() throws DatabaseException {
- 751 0 populateSettings();
- 752 0 Engine engine = null ;
- 753 0 engine = new Engine();
- 754 0 engine.setDependencies(this .dependencies);
- 755 0 engine.analyzeDependencies();
- 756 0 return engine;
- 757
- }
- 758
-
- 759
-
- 760
-
- 761
- 762
-
- 763
-
- 764
+ 751
+
+ 752
- 765
- private void generateExternalReports(Engine engine, File outDirectory) {
- 766 0 DatabaseProperties prop = null ;
- 767 0 CveDB cve = null ;
- 768
- try {
- 769 0 cve = new CveDB();
- 770 0 cve.open();
- 771 0 prop = cve.getDatabaseProperties();
- 772 0 } catch (DatabaseException ex) {
- 773 0 LOGGER.log(Level.FINE, "Unable to retrieve DB Properties" , ex);
- 774
- } finally {
- 775 0 if (cve != null ) {
- 776 0 cve.close();
- 777
- }
- 778
- }
- 779 0 final ReportGenerator r = new ReportGenerator(this .applicationName, engine.getDependencies(), engine.getAnalyzers(), prop);
- 780
- try {
- 781 0 r.generateReports(outDirectory.getCanonicalPath(), this .reportFormat.name());
- 782 0 } catch (IOException ex) {
- 783 0 LOGGER.log(Level.SEVERE,
- 784
- "Unexpected exception occurred during analysis; please see the verbose error log for more details." );
- 785 0 LOGGER.log(Level.FINE, null , ex);
- 786 0 } catch (Throwable ex) {
- 787 0 LOGGER.log(Level.SEVERE,
- 788
- "Unexpected exception occurred during analysis; please see the verbose error log for more details." );
- 789 0 LOGGER.log(Level.FINE, null , ex);
- 790 0 }
- 791 0 }
- 792
+ 753
+ public String getPathToMono() {
+ 754
+ return pathToMono;
+ 755
+ }
+ 756
- 793
+ 757
- 794
-
- 795
-
- 796
+ 758
+
+ 759
+
+ 760
+
+ 761
+ 762
+ public void setPathToMono(String pathToMono) {
+ 763
+ this .pathToMono = pathToMono;
+ 764
+ }
+ 765
+
+ 766
+
+ 767
+
+ 768
+
+ 769
+
+ 770
+
+ 771
+
+ 772
+
+ 773
+ private Engine executeDependencyCheck() throws DatabaseException {
+ 774 0 populateSettings();
+ 775 0 Engine engine = null ;
+ 776 0 engine = new Engine();
+ 777 0 engine.setDependencies(this .dependencies);
+ 778 0 engine.analyzeDependencies();
+ 779 0 return engine;
+ 780
+ }
+ 781
+
+ 782
+
+ 783
+
+ 784
+
+ 785
+
+ 786
+
+ 787
+
+ 788
+ private void generateExternalReports(Engine engine, File outDirectory) {
+ 789 0 DatabaseProperties prop = null ;
+ 790 0 CveDB cve = null ;
+ 791
+ try {
+ 792 0 cve = new CveDB();
+ 793 0 cve.open();
+ 794 0 prop = cve.getDatabaseProperties();
+ 795 0 } catch (DatabaseException ex) {
+ 796 0 LOGGER.log(Level.FINE, "Unable to retrieve DB Properties" , ex);
797
- private void populateSettings() {
- 798 0 Settings.initialize();
- 799 0 if (dataDirectory != null ) {
- 800 0 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory);
+ } finally {
+ 798 0 if (cve != null ) {
+ 799 0 cve.close();
+ 800
+ }
801
- } else {
- 802 0 final File jarPath = new File(DependencyCheckScanAgent.class .getProtectionDomain().getCodeSource().getLocation().getPath());
- 803 0 final File base = jarPath.getParentFile();
- 804 0 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY);
- 805 0 final File dataDir = new File(base, sub);
- 806 0 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
+ }
+ 802 0 final ReportGenerator r = new ReportGenerator(this .applicationName, engine.getDependencies(), engine.getAnalyzers(), prop);
+ 803
+ try {
+ 804 0 r.generateReports(outDirectory.getCanonicalPath(), this .reportFormat.name());
+ 805 0 } catch (IOException ex) {
+ 806 0 LOGGER.log(Level.SEVERE,
807
- }
- 808
+ "Unexpected exception occurred during analysis; please see the verbose error log for more details." );
+ 808 0 LOGGER.log(Level.FINE, null , ex);
+ 809 0 } catch (Throwable ex) {
+ 810 0 LOGGER.log(Level.SEVERE,
+ 811
+ "Unexpected exception occurred during analysis; please see the verbose error log for more details." );
+ 812 0 LOGGER.log(Level.FINE, null , ex);
+ 813 0 }
+ 814 0 }
+ 815
- 809 0 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate);
- 810
-
- 811 0 if (proxyUrl != null && !proxyUrl.isEmpty()) {
- 812 0 Settings.setString(Settings.KEYS.PROXY_URL, proxyUrl);
- 813
- }
- 814 0 if (proxyPort != null && !proxyPort.isEmpty()) {
- 815 0 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort);
816
- }
- 817 0 if (proxyUsername != null && !proxyUsername.isEmpty()) {
- 818 0 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUsername);
+
+ 817
+
+ 818
+
819
+
+ 820
+ private void populateSettings() {
+ 821 0 Settings.initialize();
+ 822 0 if (dataDirectory != null ) {
+ 823 0 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory);
+ 824
+ } else {
+ 825 0 final File jarPath = new File(DependencyCheckScanAgent.class .getProtectionDomain().getCodeSource().getLocation().getPath());
+ 826 0 final File base = jarPath.getParentFile();
+ 827 0 final String sub = Settings.getString(Settings.KEYS.DATA_DIRECTORY);
+ 828 0 final File dataDir = new File(base, sub);
+ 829 0 Settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
+ 830
}
- 820 0 if (proxyPassword != null && !proxyPassword.isEmpty()) {
- 821 0 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPassword);
- 822
- }
- 823 0 if (connectionTimeout != null && !connectionTimeout.isEmpty()) {
- 824 0 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout);
- 825
- }
- 826 0 if (suppressionFile != null && !suppressionFile.isEmpty()) {
- 827 0 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
- 828
- }
- 829 0 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled);
- 830 0 if (nexusUrl != null && !nexusUrl.isEmpty()) {
- 831 0 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
- 832
- }
- 833 0 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy);
- 834 0 if (databaseDriverName != null && !databaseDriverName.isEmpty()) {
- 835 0 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
+ 831
+
+ 832 0 Settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate);
+ 833
+
+ 834 0 if (proxyServer != null && !proxyServer.isEmpty()) {
+ 835 0 Settings.setString(Settings.KEYS.PROXY_SERVER, proxyServer);
836
}
- 837 0 if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) {
- 838 0 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath);
+ 837 0 if (proxyPort != null && !proxyPort.isEmpty()) {
+ 838 0 Settings.setString(Settings.KEYS.PROXY_PORT, proxyPort);
839
}
- 840 0 if (connectionString != null && !connectionString.isEmpty()) {
- 841 0 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString);
+ 840 0 if (proxyUsername != null && !proxyUsername.isEmpty()) {
+ 841 0 Settings.setString(Settings.KEYS.PROXY_USERNAME, proxyUsername);
842
}
- 843 0 if (databaseUser != null && !databaseUser.isEmpty()) {
- 844 0 Settings.setString(Settings.KEYS.DB_USER, databaseUser);
+ 843 0 if (proxyPassword != null && !proxyPassword.isEmpty()) {
+ 844 0 Settings.setString(Settings.KEYS.PROXY_PASSWORD, proxyPassword);
845
}
- 846 0 if (databasePassword != null && !databasePassword.isEmpty()) {
- 847 0 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword);
+ 846 0 if (connectionTimeout != null && !connectionTimeout.isEmpty()) {
+ 847 0 Settings.setString(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout);
848
}
- 849 0 if (zipExtensions != null && !zipExtensions.isEmpty()) {
- 850 0 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions);
+ 849 0 if (suppressionFile != null && !suppressionFile.isEmpty()) {
+ 850 0 Settings.setString(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
851
}
- 852 0 if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) {
- 853 0 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified);
- 854
+ 852 0 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled);
+ 853 0 if (nexusUrl != null && !nexusUrl.isEmpty()) {
+ 854 0 Settings.setString(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl);
+ 855
}
- 855 0 if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) {
- 856 0 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified);
- 857
+ 856 0 Settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY, nexusUsesProxy);
+ 857 0 if (databaseDriverName != null && !databaseDriverName.isEmpty()) {
+ 858 0 Settings.setString(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName);
+ 859
}
- 858 0 if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) {
- 859 0 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base);
- 860
+ 860 0 if (databaseDriverPath != null && !databaseDriverPath.isEmpty()) {
+ 861 0 Settings.setString(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath);
+ 862
}
- 861 0 if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) {
- 862 0 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base);
- 863
+ 863 0 if (connectionString != null && !connectionString.isEmpty()) {
+ 864 0 Settings.setString(Settings.KEYS.DB_CONNECTION_STRING, connectionString);
+ 865
}
- 864 0 if (pathToMono != null && !pathToMono.isEmpty()) {
- 865 0 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono);
- 866
- }
- 867 0 }
+ 866 0 if (databaseUser != null && !databaseUser.isEmpty()) {
+ 867 0 Settings.setString(Settings.KEYS.DB_USER, databaseUser);
868
-
- 869
-
- 870
-
+ }
+ 869 0 if (databasePassword != null && !databasePassword.isEmpty()) {
+ 870 0 Settings.setString(Settings.KEYS.DB_PASSWORD, databasePassword);
871
-
- 872
-
- 873
-
+ }
+ 872 0 if (zipExtensions != null && !zipExtensions.isEmpty()) {
+ 873 0 Settings.setString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions);
874
-
- 875
- public void execute() throws ScanAgentException {
- 876 0 Engine engine = null ;
+ }
+ 875 0 if (cveUrl12Modified != null && !cveUrl12Modified.isEmpty()) {
+ 876 0 Settings.setString(Settings.KEYS.CVE_MODIFIED_12_URL, cveUrl12Modified);
877
- try {
- 878 0 engine = executeDependencyCheck();
- 879 0 generateExternalReports(engine, new File(this .reportOutputDirectory));
- 880 0 if (this .showSummary) {
- 881 0 showSummary(engine.getDependencies());
- 882
- }
- 883 0 if (this .failBuildOnCVSS <= 10) {
- 884 0 checkForFailure(engine.getDependencies());
- 885
- }
- 886 0 } catch (DatabaseException ex) {
- 887 0 LOGGER.log(Level.SEVERE,
- 888
- "Unable to connect to the dependency-check database; analysis has stopped" );
- 889 0 LOGGER.log(Level.FINE, "" , ex);
- 890
- } finally {
- 891 0 Settings.cleanup(true );
- 892 0 if (engine != null ) {
- 893 0 engine.cleanup();
+ }
+ 878 0 if (cveUrl20Modified != null && !cveUrl20Modified.isEmpty()) {
+ 879 0 Settings.setString(Settings.KEYS.CVE_MODIFIED_20_URL, cveUrl20Modified);
+ 880
+ }
+ 881 0 if (cveUrl12Base != null && !cveUrl12Base.isEmpty()) {
+ 882 0 Settings.setString(Settings.KEYS.CVE_SCHEMA_1_2, cveUrl12Base);
+ 883
+ }
+ 884 0 if (cveUrl20Base != null && !cveUrl20Base.isEmpty()) {
+ 885 0 Settings.setString(Settings.KEYS.CVE_SCHEMA_2_0, cveUrl20Base);
+ 886
+ }
+ 887 0 if (pathToMono != null && !pathToMono.isEmpty()) {
+ 888 0 Settings.setString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH, pathToMono);
+ 889
+ }
+ 890 0 }
+ 891
+
+ 892
+
+ 893
+
894
- }
+
895
- }
- 896 0 }
- 897
-
- 898
-
- 899
-
- 900
-
- 901
-
- 902
-
- 903
- 904
+ 896
+ 897
+
+ 898
+ public void execute() throws ScanAgentException {
+ 899 0 Engine engine = null ;
+ 900
+ try {
+ 901 0 engine = executeDependencyCheck();
+ 902 0 generateExternalReports(engine, new File(this .reportOutputDirectory));
+ 903 0 if (this .showSummary) {
+ 904 0 showSummary(engine.getDependencies());
905
-
- 906
- private void checkForFailure(List<Dependency> dependencies) throws ScanAgentException {
- 907 0 final StringBuilder ids = new StringBuilder();
- 908 0 for (Dependency d : dependencies) {
- 909 0 boolean addName = true ;
- 910 0 for (Vulnerability v : d.getVulnerabilities()) {
- 911 0 if (v.getCvssScore() >= failBuildOnCVSS) {
- 912 0 if (addName) {
- 913 0 addName = false ;
- 914 0 ids.append(NEW_LINE).append(d.getFileName()).append(": " );
- 915 0 ids.append(v.getName());
- 916
- } else {
- 917 0 ids.append(", " ).append(v.getName());
- 918
- }
- 919
- }
- 920 0 }
- 921 0 }
- 922 0 if (ids.length() > 0) {
- 923 0 final String msg = String.format("%n%nDependency-Check Failure:%n"
- 924
- + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n"
- 925
- + "See the dependency-check report for more details.%n%n" , failBuildOnCVSS, ids.toString());
- 926
-
- 927 0 throw new ScanAgentException(msg);
- 928
- }
- 929 0 }
- 930
-
- 931
-
- 932
-
- 933
-
- 934
-
- 935
-
- 936
- private void showSummary(List<Dependency> dependencies) {
- 937 0 final StringBuilder summary = new StringBuilder();
- 938 0 for (Dependency d : dependencies) {
- 939 0 boolean firstEntry = true ;
- 940 0 final StringBuilder ids = new StringBuilder();
- 941 0 for (Vulnerability v : d.getVulnerabilities()) {
- 942 0 if (firstEntry) {
- 943 0 firstEntry = false ;
- 944
- } else {
- 945 0 ids.append(", " );
- 946
- }
- 947 0 ids.append(v.getName());
- 948 0 }
- 949 0 if (ids.length() > 0) {
- 950 0 summary.append(d.getFileName()).append(" (" );
- 951 0 firstEntry = true ;
- 952 0 for (Identifier id : d.getIdentifiers()) {
- 953 0 if (firstEntry) {
- 954 0 firstEntry = false ;
- 955
- } else {
- 956 0 summary.append(", " );
- 957
- }
- 958 0 summary.append(id.getValue());
- 959 0 }
- 960 0 summary.append(") : " ).append(ids).append(NEW_LINE);
- 961
}
- 962 0 }
- 963 0 if (summary.length() > 0) {
- 964 0 final String msg = String.format("%n%n"
- 965
- + "One or more dependencies were identified with known vulnerabilities:%n%n%s"
- 966
- + "%n%nSee the dependency-check report for more details.%n%n" , summary.toString());
- 967 0 LOGGER.log(Level.WARNING, msg);
- 968
+ 906 0 if (this .failBuildOnCVSS <= 10) {
+ 907 0 checkForFailure(engine.getDependencies());
+ 908
+ }
+ 909 0 } catch (DatabaseException ex) {
+ 910 0 LOGGER.log(Level.SEVERE,
+ 911
+ "Unable to connect to the dependency-check database; analysis has stopped" );
+ 912 0 LOGGER.log(Level.FINE, "" , ex);
+ 913
+ } finally {
+ 914 0 Settings.cleanup(true );
+ 915 0 if (engine != null ) {
+ 916 0 engine.cleanup();
+ 917
+ }
+ 918
}
- 969 0 }
- 970
+ 919 0 }
+ 920
- 971
+ 921
+
+ 922
+
+ 923
+
+ 924
+
+ 925
+
+ 926
+
+ 927
+
+ 928
+
+ 929
+ private void checkForFailure(List<Dependency> dependencies) throws ScanAgentException {
+ 930 0 final StringBuilder ids = new StringBuilder();
+ 931 0 for (Dependency d : dependencies) {
+ 932 0 boolean addName = true ;
+ 933 0 for (Vulnerability v : d.getVulnerabilities()) {
+ 934 0 if (v.getCvssScore() >= failBuildOnCVSS) {
+ 935 0 if (addName) {
+ 936 0 addName = false ;
+ 937 0 ids.append(NEW_LINE).append(d.getFileName()).append(": " );
+ 938 0 ids.append(v.getName());
+ 939
+ } else {
+ 940 0 ids.append(", " ).append(v.getName());
+ 941
+ }
+ 942
+ }
+ 943 0 }
+ 944 0 }
+ 945 0 if (ids.length() > 0) {
+ 946 0 final String msg = String.format("%n%nDependency-Check Failure:%n"
+ 947
+ + "One or more dependencies were identified with vulnerabilities that have a CVSS score greater then '%.1f': %s%n"
+ 948
+ + "See the dependency-check report for more details.%n%n" , failBuildOnCVSS, ids.toString());
+ 949
+
+ 950 0 throw new ScanAgentException(msg);
+ 951
+ }
+ 952 0 }
+ 953
+
+ 954
+
+ 955
+
+ 956
+
+ 957
+
+ 958
+
+ 959
+ private void showSummary(List<Dependency> dependencies) {
+ 960 0 final StringBuilder summary = new StringBuilder();
+ 961 0 for (Dependency d : dependencies) {
+ 962 0 boolean firstEntry = true ;
+ 963 0 final StringBuilder ids = new StringBuilder();
+ 964 0 for (Vulnerability v : d.getVulnerabilities()) {
+ 965 0 if (firstEntry) {
+ 966 0 firstEntry = false ;
+ 967
+ } else {
+ 968 0 ids.append(", " );
+ 969
+ }
+ 970 0 ids.append(v.getName());
+ 971 0 }
+ 972 0 if (ids.length() > 0) {
+ 973 0 summary.append(d.getFileName()).append(" (" );
+ 974 0 firstEntry = true ;
+ 975 0 for (Identifier id : d.getIdentifiers()) {
+ 976 0 if (firstEntry) {
+ 977 0 firstEntry = false ;
+ 978
+ } else {
+ 979 0 summary.append(", " );
+ 980
+ }
+ 981 0 summary.append(id.getValue());
+ 982 0 }
+ 983 0 summary.append(") : " ).append(ids).append(NEW_LINE);
+ 984
+ }
+ 985 0 }
+ 986 0 if (summary.length() > 0) {
+ 987 0 final String msg = String.format("%n%n"
+ 988
+ + "One or more dependencies were identified with known vulnerabilities:%n%n%s"
+ 989
+ + "%n%nSee the dependency-check report for more details.%n%n" , summary.toString());
+ 990 0 LOGGER.log(Level.WARNING, msg);
+ 991
+ }
+ 992 0 }
+ 993
+
+ 994
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractAnalyzer.html
index 19dfa4e87..0b5dcc9e3 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractAnalyzer.html
@@ -83,7 +83,7 @@
public void initialize() throws Exception {
33
- 34 10 }
+ 34 20 }
35
36
@@ -102,11 +102,11 @@
public void close() throws Exception {
43
- 44 15 }
+ 44 30 }
45
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer.html
index edc674cc3..6f96557fa 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer.html
@@ -101,19 +101,19 @@
42
- 43 29 public AbstractFileTypeAnalyzer() {
- 44 29 final String key = getAnalyzerEnabledSettingKey();
+ 43 58 public AbstractFileTypeAnalyzer() {
+ 44 58 final String key = getAnalyzerEnabledSettingKey();
45
try {
- 46 29 enabled = Settings.getBoolean(key, true );
+ 46 58 enabled = Settings.getBoolean(key, true );
47 0 } catch (InvalidSettingException ex) {
48 0 String msg = String.format("Invalid setting for property '%s'" , key);
49 0 LOGGER.log(Level.WARNING, msg);
50 0 LOGGER.log(Level.FINE, "" , ex);
51 0 msg = String.format("%s has been disabled" , getName());
52 0 LOGGER.log(Level.WARNING, msg);
- 53 29 }
- 54 29 }
+ 53 58 }
+ 54 58 }
55
56
@@ -126,14 +126,14 @@
60
- 61 1 private static final Logger LOGGER = Logger.getLogger(AbstractFileTypeAnalyzer.class .getName());
+ 61 2 private static final Logger LOGGER = Logger.getLogger(AbstractFileTypeAnalyzer.class .getName());
62
63
64
- 65 29 private boolean filesMatched = false ;
+ 65 58 private boolean filesMatched = false ;
66
67
@@ -178,7 +178,7 @@
87
- 88 29 private boolean enabled = true ;
+ 88 58 private boolean enabled = true ;
89
90
@@ -321,14 +321,14 @@
@Override
159
public final void initialize() throws Exception {
- 160 10 if (filesMatched) {
- 161 7 initializeFileTypeAnalyzer();
+ 160 20 if (filesMatched) {
+ 161 14 initializeFileTypeAnalyzer();
162
} else {
- 163 3 enabled = false ;
+ 163 6 enabled = false ;
164
}
- 165 10 }
+ 165 20 }
166
167
@@ -351,11 +351,11 @@
@Override
176
public final void analyze(Dependency dependency, Engine engine) throws AnalysisException {
- 177 10 if (enabled) {
- 178 10 analyzeFileType(dependency, engine);
+ 177 20 if (enabled) {
+ 178 20 analyzeFileType(dependency, engine);
179
}
- 180 9 }
+ 180 18 }
181
182
@@ -374,12 +374,12 @@
@Override
189
public final boolean supportsExtension(String extension) {
- 190 4259 if (!enabled) {
- 191 854 return false ;
+ 190 8518 if (!enabled) {
+ 191 1708 return false ;
192
}
- 193 3405 final Set<String> ext = getSupportedExtensions();
- 194 3405 if (ext == null ) {
+ 193 6810 final Set<String> ext = getSupportedExtensions();
+ 194 6810 if (ext == null ) {
195 0 final String msg = String.format("The '%s' analyzer is misconfigured and does not have any file extensions;"
196
+ " it will be disabled" , getName());
@@ -387,12 +387,12 @@
198 0 return false ;
199
} else {
- 200 3405 final boolean match = ext.contains(extension);
- 201 3405 if (match) {
- 202 16 filesMatched = match;
+ 200 6810 final boolean match = ext.contains(extension);
+ 201 6810 if (match) {
+ 202 32 filesMatched = match;
203
}
- 204 3405 return match;
+ 204 6810 return match;
205
}
206
@@ -429,11 +429,11 @@
222
protected static Set<String> newHashSet(String... strings) {
- 223 11 final Set<String> set = new HashSet<String>();
+ 223 22 final Set<String> set = new HashSet<String>();
224
- 225 11 Collections.addAll(set, strings);
- 226 11 return set;
+ 225 22 Collections.addAll(set, strings);
+ 226 22 return set;
227
}
228
@@ -442,6 +442,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractSuppressionAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractSuppressionAnalyzer.html
index 9ada7efd9..5441b75a2 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractSuppressionAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AbstractSuppressionAnalyzer.html
@@ -12,7 +12,7 @@
@@ -111,7 +111,7 @@
47
- 48 1 private static final Logger LOGGER = Logger.getLogger(AbstractSuppressionAnalyzer.class .getName());
+ 48 2 private static final Logger LOGGER = Logger.getLogger(AbstractSuppressionAnalyzer.class .getName());
49
50
@@ -150,9 +150,9 @@
@Override
67
public void initialize() throws Exception {
- 68 5 super .initialize();
- 69 5 loadSuppressionData();
- 70 4 }
+ 68 10 super .initialize();
+ 69 10 loadSuppressionData();
+ 70 8 }
71
72
@@ -213,104 +213,113 @@
100
private void loadSuppressionData() throws SuppressionParseException {
- 101 5 final String suppressionFilePath = Settings.getString(Settings.KEYS.SUPPRESSION_FILE);
- 102 5 if (suppressionFilePath == null ) {
- 103 2 return ;
+ 101 10 final SuppressionParser parser = new SuppressionParser();
+ 102 10 File file = null ;
+ 103 10 file = new File(this .getClass().getClassLoader().getResource("dependencycheck-base-suppression.xml" ).getPath());
104
- }
- 105 3 File file = null ;
- 106 3 boolean deleteTempFile = false ;
- 107
try {
- 108 3 final Pattern uriRx = Pattern.compile("^(https?|file)\\:.*" , Pattern.CASE_INSENSITIVE);
- 109 3 if (uriRx.matcher(suppressionFilePath).matches()) {
- 110 1 deleteTempFile = true ;
- 111 1 file = FileUtils.getTempFile("suppression" , "xml" );
- 112 1 final URL url = new URL(suppressionFilePath);
- 113
- try {
- 114 1 Downloader.fetchFile(url, file, false );
- 115 0 } catch (DownloadFailedException ex) {
- 116 0 Downloader.fetchFile(url, file, true );
- 117 1 }
- 118 1 } else {
- 119 2 file = new File(suppressionFilePath);
- 120 2 if (!file.exists()) {
- 121 2 final InputStream suppressionsFromClasspath = this .getClass().getClassLoader().getResourceAsStream(suppressionFilePath);
- 122 2 if (suppressionsFromClasspath != null ) {
- 123 1 deleteTempFile = true ;
- 124 1 file = FileUtils.getTempFile("suppression" , "xml" );
- 125
- try {
- 126 1 org.apache.commons.io.FileUtils.copyInputStreamToFile(suppressionsFromClasspath, file);
- 127 0 } catch (IOException ex) {
- 128 0 throwSuppressionParseException("Unable to locate suppressions file in classpath" , ex);
- 129 1 }
- 130
- }
- 131
- }
- 132
- }
- 133
-
- 134 3 if (file != null ) {
- 135 3 final SuppressionParser parser = new SuppressionParser();
- 136
- try {
- 137 3 rules = parser.parseSuppressionRules(file);
- 138 2 LOGGER.log(Level.FINE, rules.size() + " suppression rules were loaded." );
- 139 1 } catch (SuppressionParseException ex) {
- 140 1 final String msg = String.format("Unable to parse suppression xml file '%s'" , file.getPath());
- 141 1 LOGGER.log(Level.WARNING, msg);
- 142 1 LOGGER.log(Level.WARNING, ex.getMessage());
- 143 1 LOGGER.log(Level.FINE, "" , ex);
- 144 1 throw ex;
- 145 2 }
- 146
- }
- 147 0 } catch (DownloadFailedException ex) {
- 148 0 throwSuppressionParseException("Unable to fetch the configured suppression file" , ex);
- 149 0 } catch (MalformedURLException ex) {
- 150 0 throwSuppressionParseException("Configured suppression file has an invalid URL" , ex);
- 151 1 } catch (IOException ex) {
- 152 1 throwSuppressionParseException("Unable to create temp file for suppressions" , ex);
- 153
- } finally {
- 154 3 if (deleteTempFile && file != null ) {
- 155 2 FileUtils.delete(file);
- 156
- }
- 157
+ 105 10 rules = parser.parseSuppressionRules(file);
+ 106 0 } catch (SuppressionParseException ex) {
+ 107 0 LOGGER.log(Level.FINE, "Unable to parse the base suppression data file" , ex);
+ 108 10 }
+ 109 10 final String suppressionFilePath = Settings.getString(Settings.KEYS.SUPPRESSION_FILE);
+ 110 10 if (suppressionFilePath == null ) {
+ 111 4 return ;
+ 112
}
- 158 2 }
- 159
+ 113 6 boolean deleteTempFile = false ;
+ 114
+ try {
+ 115 6 final Pattern uriRx = Pattern.compile("^(https?|file)\\:.*" , Pattern.CASE_INSENSITIVE);
+ 116 6 if (uriRx.matcher(suppressionFilePath).matches()) {
+ 117 2 deleteTempFile = true ;
+ 118 2 file = FileUtils.getTempFile("suppression" , "xml" );
+ 119 2 final URL url = new URL(suppressionFilePath);
+ 120
+ try {
+ 121 2 Downloader.fetchFile(url, file, false );
+ 122 0 } catch (DownloadFailedException ex) {
+ 123 0 Downloader.fetchFile(url, file, true );
+ 124 2 }
+ 125 2 } else {
+ 126 4 file = new File(suppressionFilePath);
+ 127 4 if (!file.exists()) {
+ 128 4 final InputStream suppressionsFromClasspath = this .getClass().getClassLoader().getResourceAsStream(suppressionFilePath);
+ 129 4 if (suppressionsFromClasspath != null ) {
+ 130 2 deleteTempFile = true ;
+ 131 2 file = FileUtils.getTempFile("suppression" , "xml" );
+ 132
+ try {
+ 133 2 org.apache.commons.io.FileUtils.copyInputStreamToFile(suppressionsFromClasspath, file);
+ 134 0 } catch (IOException ex) {
+ 135 0 throwSuppressionParseException("Unable to locate suppressions file in classpath" , ex);
+ 136 2 }
+ 137
+ }
+ 138
+ }
+ 139
+ }
+ 140
+ 141 6 if (file != null ) {
+ 142
+ try {
+ 143
+
+ 144 6 rules.addAll(parser.parseSuppressionRules(file));
+ 145 4 LOGGER.log(Level.FINE, rules.size() + " suppression rules were loaded." );
+ 146 2 } catch (SuppressionParseException ex) {
+ 147 2 final String msg = String.format("Unable to parse suppression xml file '%s'" , file.getPath());
+ 148 2 LOGGER.log(Level.WARNING, msg);
+ 149 2 LOGGER.log(Level.WARNING, ex.getMessage());
+ 150 2 LOGGER.log(Level.FINE, "" , ex);
+ 151 2 throw ex;
+ 152 4 }
+ 153
+ }
+ 154 0 } catch (DownloadFailedException ex) {
+ 155 0 throwSuppressionParseException("Unable to fetch the configured suppression file" , ex);
+ 156 0 } catch (MalformedURLException ex) {
+ 157 0 throwSuppressionParseException("Configured suppression file has an invalid URL" , ex);
+ 158 2 } catch (IOException ex) {
+ 159 2 throwSuppressionParseException("Unable to create temp file for suppressions" , ex);
160
-
- 161
-
- 162
-
+ } finally {
+ 161 6 if (deleteTempFile && file != null ) {
+ 162 4 FileUtils.delete(file);
163
-
+ }
164
-
- 165
-
+ }
+ 165 4 }
166
-
+
167
- private void throwSuppressionParseException(String message, Exception exception) throws SuppressionParseException {
- 168 1 LOGGER.log(Level.WARNING, message);
- 169 1 LOGGER.log(Level.FINE, "" , exception);
- 170 1 throw new SuppressionParseException(message, exception);
+
+ 168
+
+ 169
+
+ 170
+
171
- }
+
172
+
+ 173
+
+ 174
+ private void throwSuppressionParseException(String message, Exception exception) throws SuppressionParseException {
+ 175 2 LOGGER.log(Level.WARNING, message);
+ 176 2 LOGGER.log(Level.FINE, "" , exception);
+ 177 2 throw new SuppressionParseException(message, exception);
+ 178
+ }
+ 179
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AnalysisPhase.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AnalysisPhase.html
index d56222010..651c29bcb 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AnalysisPhase.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AnalysisPhase.html
@@ -65,7 +65,7 @@
24
- 25 5 public enum AnalysisPhase {
+ 25 10 public enum AnalysisPhase {
26
27
@@ -74,67 +74,67 @@
29
- 30 1 INITIAL,
+ 30 2 INITIAL,
31
32
33
- 34 1 INFORMATION_COLLECTION,
+ 34 2 INFORMATION_COLLECTION,
35
36
37
- 38 1 PRE_IDENTIFIER_ANALYSIS,
+ 38 2 PRE_IDENTIFIER_ANALYSIS,
39
40
41
- 42 1 IDENTIFIER_ANALYSIS,
+ 42 2 IDENTIFIER_ANALYSIS,
43
44
45
- 46 1 POST_IDENTIFIER_ANALYSIS,
+ 46 2 POST_IDENTIFIER_ANALYSIS,
47
48
49
- 50 1 PRE_FINDING_ANALYSIS,
+ 50 2 PRE_FINDING_ANALYSIS,
51
52
53
- 54 1 FINDING_ANALYSIS,
+ 54 2 FINDING_ANALYSIS,
55
56
57
- 58 1 POST_FINDING_ANALYSIS,
+ 58 2 POST_FINDING_ANALYSIS,
59
60
61
- 62 1 FINAL
+ 62 2 FINAL
63
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.Analyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.Analyzer.html
index 837684047..2229f539b 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.Analyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.Analyzer.html
@@ -161,6 +161,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AnalyzerService.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AnalyzerService.html
index 73831a5e6..831084125 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AnalyzerService.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AnalyzerService.html
@@ -97,9 +97,9 @@
40
- 41 2 public AnalyzerService(ClassLoader classLoader) {
- 42 2 loader = ServiceLoader.load(Analyzer.class , classLoader);
- 43 2 }
+ 41 4 public AnalyzerService(ClassLoader classLoader) {
+ 42 4 loader = ServiceLoader.load(Analyzer.class , classLoader);
+ 43 4 }
44
45
@@ -114,13 +114,13 @@
50
public Iterator<Analyzer> getAnalyzers() {
- 51 2 return loader.iterator();
+ 51 4 return loader.iterator();
52
}
53
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.ArchiveAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.ArchiveAnalyzer.html
index 6871564c6..c8a0450e5 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.ArchiveAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.ArchiveAnalyzer.html
@@ -143,7 +143,7 @@
63
- 64 1 private static final Logger LOGGER = Logger.getLogger(ArchiveAnalyzer.class .getName());
+ 64 2 private static final Logger LOGGER = Logger.getLogger(ArchiveAnalyzer.class .getName());
65
66
@@ -158,7 +158,7 @@
71
- 72 1 private static int dirCount = 0;
+ 72 2 private static int dirCount = 0;
73
74
@@ -173,7 +173,7 @@
79
- 80 1 private static final int MAX_SCAN_DEPTH = Settings.getInt("archive.scan.depth" , 3);
+ 80 2 private static final int MAX_SCAN_DEPTH = Settings.getInt("archive.scan.depth" , 3);
81
82
@@ -200,14 +200,14 @@
93
- 94 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INITIAL;
+ 94 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INITIAL;
95
96
97
- 98 1 private static final Set<String> ZIPPABLES = newHashSet("zip" , "ear" , "war" , "jar" , "sar" , "apk" , "nupkg" );
+ 98 2 private static final Set<String> ZIPPABLES = newHashSet("zip" , "ear" , "war" , "jar" , "sar" , "apk" , "nupkg" );
99
100
@@ -216,7 +216,7 @@
102
- 103 1 private static final Set<String> EXTENSIONS = newHashSet("tar" , "gz" , "tgz" );
+ 103 2 private static final Set<String> EXTENSIONS = newHashSet("tar" , "gz" , "tgz" );
104
105
@@ -225,19 +225,19 @@
107
- 108 1 private static final Set<String> REMOVE_FROM_ANALYSIS = newHashSet("zip" , "tar" , "gz" , "tgz" );
+ 108 2 private static final Set<String> REMOVE_FROM_ANALYSIS = newHashSet("zip" , "tar" , "gz" , "tgz" );
109
110
static {
- 111 1 final String additionalZipExt = Settings.getString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS);
- 112 1 if (additionalZipExt != null ) {
+ 111 2 final String additionalZipExt = Settings.getString(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS);
+ 112 2 if (additionalZipExt != null ) {
113 0 final HashSet ext = new HashSet<String>(Arrays.asList(additionalZipExt));
114 0 ZIPPABLES.addAll(ext);
115
}
- 116 1 EXTENSIONS.addAll(ZIPPABLES);
- 117 1 }
+ 116 2 EXTENSIONS.addAll(ZIPPABLES);
+ 117 2 }
118
119
@@ -254,7 +254,7 @@
@Override
125
public Set<String> getSupportedExtensions() {
- 126 850 return EXTENSIONS;
+ 126 1700 return EXTENSIONS;
127
}
128
@@ -273,7 +273,7 @@
@Override
135
public String getName() {
- 136 4 return ANALYZER_NAME;
+ 136 8 return ANALYZER_NAME;
137
}
138
@@ -292,7 +292,7 @@
@Override
145
public AnalysisPhase getAnalysisPhase() {
- 146 1 return ANALYSIS_PHASE;
+ 146 2 return ANALYSIS_PHASE;
147
}
148
@@ -313,7 +313,7 @@
@Override
156
protected String getAnalyzerEnabledSettingKey() {
- 157 2 return Settings.KEYS.ANALYZER_ARCHIVE_ENABLED;
+ 157 4 return Settings.KEYS.ANALYZER_ARCHIVE_ENABLED;
158
}
159
@@ -332,19 +332,19 @@
@Override
166
public void initializeFileTypeAnalyzer() throws Exception {
- 167 1 final File baseDir = Settings.getTempDirectory();
- 168 1 tempFileLocation = File.createTempFile("check" , "tmp" , baseDir);
- 169 1 if (!tempFileLocation.delete()) {
+ 167 2 final File baseDir = Settings.getTempDirectory();
+ 168 2 tempFileLocation = File.createTempFile("check" , "tmp" , baseDir);
+ 169 2 if (!tempFileLocation.delete()) {
170 0 final String msg = String.format("Unable to delete temporary file '%s'." , tempFileLocation.getAbsolutePath());
171 0 throw new AnalysisException(msg);
172
}
- 173 1 if (!tempFileLocation.mkdirs()) {
+ 173 2 if (!tempFileLocation.mkdirs()) {
174 0 final String msg = String.format("Unable to create directory '%s'." , tempFileLocation.getAbsolutePath());
175 0 throw new AnalysisException(msg);
176
}
- 177 1 }
+ 177 2 }
178
179
@@ -361,16 +361,16 @@
@Override
185
public void close() throws Exception {
- 186 1 if (tempFileLocation != null && tempFileLocation.exists()) {
- 187 1 LOGGER.log(Level.FINE, "Attempting to delete temporary files" );
- 188 1 final boolean success = FileUtils.delete(tempFileLocation);
- 189 1 if (!success && tempFileLocation != null & tempFileLocation.exists()) {
+ 186 2 if (tempFileLocation != null && tempFileLocation.exists()) {
+ 187 2 LOGGER.log(Level.FINE, "Attempting to delete temporary files" );
+ 188 2 final boolean success = FileUtils.delete(tempFileLocation);
+ 189 2 if (!success && tempFileLocation != null & tempFileLocation.exists()) {
190 0 LOGGER.log(Level.WARNING, "Failed to delete some temporary files, see the log for more details" );
191
}
192
}
- 193 1 }
+ 193 2 }
194
195
@@ -393,17 +393,17 @@
@Override
204
public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException {
- 205 2 final File f = new File(dependency.getActualFilePath());
- 206 2 final File tmpDir = getNextTempDirectory();
- 207 2 extractFiles(f, tmpDir, engine);
+ 205 4 final File f = new File(dependency.getActualFilePath());
+ 206 4 final File tmpDir = getNextTempDirectory();
+ 207 4 extractFiles(f, tmpDir, engine);
208
209
- 210 2 List<Dependency> dependencies = new ArrayList<Dependency>(engine.getDependencies());
- 211 2 engine.scan(tmpDir);
- 212 2 List<Dependency> newDependencies = engine.getDependencies();
- 213 2 if (dependencies.size() != newDependencies.size()) {
+ 210 4 List<Dependency> dependencies = new ArrayList<Dependency>(engine.getDependencies());
+ 211 4 engine.scan(tmpDir);
+ 212 4 List<Dependency> newDependencies = engine.getDependencies();
+ 213 4 if (dependencies.size() != newDependencies.size()) {
214
215 0 final Set<Dependency> dependencySet = new HashSet<Dependency>();
@@ -443,7 +443,7 @@
238 0 }
239
}
- 240 2 if (this .REMOVE_FROM_ANALYSIS.contains(dependency.getFileExtension())) {
+ 240 4 if (this .REMOVE_FROM_ANALYSIS.contains(dependency.getFileExtension())) {
241 0 if ("zip" .equals(dependency.getFileExtension()) && isZipFileActuallyJarFile(dependency)) {
242 0 final File tdir = getNextTempDirectory();
243 0 final String fileName = dependency.getFileName();
@@ -486,8 +486,8 @@
272 0 engine.getDependencies().remove(dependency);
273
}
- 274 2 Collections.sort(engine.getDependencies());
- 275 2 }
+ 274 4 Collections.sort(engine.getDependencies());
+ 275 4 }
276
277
@@ -504,20 +504,20 @@
283
private File getNextTempDirectory() throws AnalysisException {
- 284 2 dirCount += 1;
- 285 2 final File directory = new File(tempFileLocation, String.valueOf(dirCount));
+ 284 4 dirCount += 1;
+ 285 4 final File directory = new File(tempFileLocation, String.valueOf(dirCount));
286
- 287 2 if (directory.exists()) {
+ 287 4 if (directory.exists()) {
288 0 return getNextTempDirectory();
289
}
- 290 2 if (!directory.mkdirs()) {
+ 290 4 if (!directory.mkdirs()) {
291 0 final String msg = String.format("Unable to create temp directory '%s'." , directory.getAbsolutePath());
292 0 throw new AnalysisException(msg);
293
}
- 294 2 return directory;
+ 294 4 return directory;
295
}
296
@@ -540,25 +540,25 @@
305
private void extractFiles(File archive, File destination, Engine engine) throws AnalysisException {
- 306 2 if (archive == null || destination == null ) {
+ 306 4 if (archive == null || destination == null ) {
307 0 return ;
308
}
309
- 310 2 FileInputStream fis = null ;
+ 310 4 FileInputStream fis = null ;
311
try {
- 312 2 fis = new FileInputStream(archive);
+ 312 4 fis = new FileInputStream(archive);
313 0 } catch (FileNotFoundException ex) {
314 0 LOGGER.log(Level.FINE, null , ex);
315 0 throw new AnalysisException("Archive file was not found." , ex);
- 316 2 }
- 317 2 final String archiveExt = FileUtils.getFileExtension(archive.getName()).toLowerCase();
+ 316 4 }
+ 317 4 final String archiveExt = FileUtils.getFileExtension(archive.getName()).toLowerCase();
318
try {
- 319 2 if (ZIPPABLES.contains(archiveExt)) {
- 320 2 extractArchive(new ZipArchiveInputStream(new BufferedInputStream(fis)), destination, engine);
+ 319 4 if (ZIPPABLES.contains(archiveExt)) {
+ 320 4 extractArchive(new ZipArchiveInputStream(new BufferedInputStream(fis)), destination, engine);
321 0 } else if ("tar" .equals(archiveExt)) {
322 0 extractArchive(new TarArchiveInputStream(new BufferedInputStream(fis)), destination, engine);
323 0 } else if ("gz" .equals(archiveExt) || "tgz" .equals(archiveExt)) {
@@ -581,12 +581,12 @@
338
} finally {
339 0 try {
- 340 2 fis.close();
+ 340 4 fis.close();
341 0 } catch (IOException ex) {
342 0 LOGGER.log(Level.FINEST, null , ex);
- 343 2 }
+ 343 4 }
344 0 }
- 345 2 }
+ 345 4 }
346
347
@@ -611,21 +611,21 @@
ArchiveEntry entry;
357
try {
- 358 887 while ((entry = input.getNextEntry()) != null ) {
- 359 885 if (entry.isDirectory()) {
- 360 36 final File d = new File(destination, entry.getName());
- 361 36 if (!d.exists()) {
- 362 36 if (!d.mkdirs()) {
+ 358 1774 while ((entry = input.getNextEntry()) != null ) {
+ 359 1770 if (entry.isDirectory()) {
+ 360 72 final File d = new File(destination, entry.getName());
+ 361 72 if (!d.exists()) {
+ 362 72 if (!d.mkdirs()) {
363 0 final String msg = String.format("Unable to create directory '%s'." , d.getAbsolutePath());
364 0 throw new AnalysisException(msg);
365
}
366
}
- 367 36 } else {
- 368 849 final File file = new File(destination, entry.getName());
- 369 849 final String ext = FileUtils.getFileExtension(file.getName());
- 370 849 if (engine.supportsExtension(ext)) {
+ 367 72 } else {
+ 368 1698 final File file = new File(destination, entry.getName());
+ 369 1698 final String ext = FileUtils.getFileExtension(file.getName());
+ 370 1698 if (engine.supportsExtension(ext)) {
371 0 BufferedOutputStream bos = null ;
372
FileOutputStream fos;
@@ -673,7 +673,7 @@
}
406
}
- 407 849 }
+ 407 1698 }
408
}
409 0 } catch (IOException ex) {
@@ -682,18 +682,18 @@
412 0 throw new ArchiveExtractionException(ex);
413
} finally {
- 414 2 if (input != null ) {
+ 414 4 if (input != null ) {
415
try {
- 416 2 input.close();
+ 416 4 input.close();
417 0 } catch (IOException ex) {
418 0 LOGGER.log(Level.FINEST, null , ex);
- 419 2 }
+ 419 4 }
420
}
421
}
- 422 2 }
+ 422 4 }
423
424
@@ -796,6 +796,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AssemblyAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AssemblyAnalyzer.html
index ca5114afc..3ce37ef35 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AssemblyAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.AssemblyAnalyzer.html
@@ -12,7 +12,7 @@
@@ -135,14 +135,14 @@
59
- 60 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
+ 60 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
61
62
63
- 64 1 private static final Set<String> SUPPORTED_EXTENSIONS = newHashSet("dll" , "exe" );
+ 64 2 private static final Set<String> SUPPORTED_EXTENSIONS = newHashSet("dll" , "exe" );
65
66
@@ -165,7 +165,7 @@
75
- 76 1 private static final Logger LOGGER = Logger.getLogger(AssemblyAnalyzer.class .getName(), "dependencycheck-resources" );
+ 76 2 private static final Logger LOGGER = Logger.getLogger(AssemblyAnalyzer.class .getName(), "dependencycheck-resources" );
77
78
@@ -182,8 +182,8 @@
private List<String> buildArgumentList() {
84
- 85 8 final List<String> args = new ArrayList<String>();
- 86 8 if (!"\\" .equals(System.getProperty("file.separator" ))) {
+ 85 16 final List<String> args = new ArrayList<String>();
+ 86 16 if (!"\\" .equals(System.getProperty("file.separator" ))) {
87 0 if (Settings.getString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH) != null ) {
88 0 args.add(Settings.getString(Settings.KEYS.ANALYZER_ASSEMBLY_MONO_PATH));
89
@@ -193,10 +193,10 @@
}
92
}
- 93 8 args.add(grokAssemblyExe.getPath());
+ 93 16 args.add(grokAssemblyExe.getPath());
94
- 95 8 return args;
+ 95 16 return args;
96
}
97
@@ -221,83 +221,83 @@
public void analyzeFileType(Dependency dependency, Engine engine)
107
throws AnalysisException {
- 108 3 if (grokAssemblyExe == null ) {
+ 108 6 if (grokAssemblyExe == null ) {
109 0 LOGGER.warning("analyzer.AssemblyAnalyzer.notdeployed" );
110 0 return ;
111
}
112
- 113 3 final List<String> args = buildArgumentList();
- 114 3 args.add(dependency.getActualFilePath());
- 115 3 final ProcessBuilder pb = new ProcessBuilder(args);
- 116 3 BufferedReader rdr = null ;
- 117 3 Document doc = null ;
+ 113 6 final List<String> args = buildArgumentList();
+ 114 6 args.add(dependency.getActualFilePath());
+ 115 6 final ProcessBuilder pb = new ProcessBuilder(args);
+ 116 6 BufferedReader rdr = null ;
+ 117 6 Document doc = null ;
118
try {
- 119 3 final Process proc = pb.start();
+ 119 6 final Process proc = pb.start();
120
- 121 3 rdr = new BufferedReader(new InputStreamReader(proc.getErrorStream(), "UTF-8" ));
- 122 3 String line = null ;
- 123 3 while (rdr.ready() && (line = rdr.readLine()) != null ) {
+ 121 6 rdr = new BufferedReader(new InputStreamReader(proc.getErrorStream(), "UTF-8" ));
+ 122 6 String line = null ;
+ 123 6 while (rdr.ready() && (line = rdr.readLine()) != null ) {
124 0 LOGGER.log(Level.WARNING, "analyzer.AssemblyAnalyzer.grokassembly.stderr" , line);
125
}
- 126 3 int rc = 0;
- 127 3 doc = builder.parse(proc.getInputStream());
+ 126 6 int rc = 0;
+ 127 6 doc = builder.parse(proc.getInputStream());
128
129
try {
- 130 3 rc = proc.waitFor();
+ 130 6 rc = proc.waitFor();
131 0 } catch (InterruptedException ie) {
132
return ;
- 133 3 }
- 134 3 if (rc == 3) {
+ 133 6 }
+ 134 6 if (rc == 3) {
135 0 LOGGER.log(Level.FINE, "analyzer.AssemblyAnalyzer.notassembly" , dependency.getActualFilePath());
136
return ;
- 137 3 } else if (rc != 0) {
- 138 1 LOGGER.log(Level.WARNING, "analyzer.AssemblyAnalyzer.grokassembly.rc" , rc);
+ 137 6 } else if (rc != 0) {
+ 138 2 LOGGER.log(Level.WARNING, "analyzer.AssemblyAnalyzer.grokassembly.rc" , rc);
139
}
140
- 141 3 final XPath xpath = XPathFactory.newInstance().newXPath();
+ 141 6 final XPath xpath = XPathFactory.newInstance().newXPath();
142
143
- 144 3 final String error = xpath.evaluate("/assembly/error" , doc);
- 145 3 if (error != null && !"" .equals(error)) {
- 146 1 throw new AnalysisException(error);
+ 144 6 final String error = xpath.evaluate("/assembly/error" , doc);
+ 145 6 if (error != null && !"" .equals(error)) {
+ 146 2 throw new AnalysisException(error);
147
}
148
- 149 2 final String version = xpath.evaluate("/assembly/version" , doc);
- 150 2 if (version != null ) {
- 151 2 dependency.getVersionEvidence().addEvidence(new Evidence("grokassembly" , "version" ,
+ 149 4 final String version = xpath.evaluate("/assembly/version" , doc);
+ 150 4 if (version != null ) {
+ 151 4 dependency.getVersionEvidence().addEvidence(new Evidence("grokassembly" , "version" ,
152
version, Confidence.HIGHEST));
153
}
154
- 155 2 final String vendor = xpath.evaluate("/assembly/company" , doc);
- 156 2 if (vendor != null ) {
- 157 2 dependency.getVendorEvidence().addEvidence(new Evidence("grokassembly" , "vendor" ,
+ 155 4 final String vendor = xpath.evaluate("/assembly/company" , doc);
+ 156 4 if (vendor != null ) {
+ 157 4 dependency.getVendorEvidence().addEvidence(new Evidence("grokassembly" , "vendor" ,
158
vendor, Confidence.HIGH));
159
}
160
- 161 2 final String product = xpath.evaluate("/assembly/product" , doc);
- 162 2 if (product != null ) {
- 163 2 dependency.getProductEvidence().addEvidence(new Evidence("grokassembly" , "product" ,
+ 161 4 final String product = xpath.evaluate("/assembly/product" , doc);
+ 162 4 if (product != null ) {
+ 163 4 dependency.getProductEvidence().addEvidence(new Evidence("grokassembly" , "product" ,
164
product, Confidence.HIGH));
165
@@ -314,18 +314,18 @@
173 0 throw new AnalysisException(xpe);
174
} finally {
- 175 3 if (rdr != null ) {
+ 175 6 if (rdr != null ) {
176
try {
- 177 3 rdr.close();
+ 177 6 rdr.close();
178 0 } catch (IOException ex) {
179 0 LOGGER.log(Level.FINEST, "ignore" , ex);
- 180 4 }
+ 180 8 }
181
}
182
}
- 183 2 }
+ 183 4 }
184
185
@@ -342,201 +342,202 @@
@Override
191
public void initializeFileTypeAnalyzer() throws Exception {
- 192 5 final File tempFile = File.createTempFile("GKA" , ".exe" , Settings.getTempDirectory());
- 193 5 FileOutputStream fos = null ;
- 194 5 InputStream is = null ;
+ 192 10 final File tempFile = File.createTempFile("GKA" , ".exe" , Settings.getTempDirectory());
+ 193 10 FileOutputStream fos = null ;
+ 194 10 InputStream is = null ;
195
try {
- 196 5 fos = new FileOutputStream(tempFile);
- 197 5 is = AssemblyAnalyzer.class .getClassLoader().getResourceAsStream("GrokAssembly.exe" );
- 198 5 final byte [] buff = new byte [4096];
- 199 5 int bread = -1;
- 200 15 while ((bread = is.read(buff)) >= 0) {
- 201 10 fos.write(buff, 0, bread);
+ 196 10 fos = new FileOutputStream(tempFile);
+ 197 10 is = AssemblyAnalyzer.class .getClassLoader().getResourceAsStream("GrokAssembly.exe" );
+ 198 10 final byte [] buff = new byte [4096];
+ 199 10 int bread = -1;
+ 200 30 while ((bread = is.read(buff)) >= 0) {
+ 201 20 fos.write(buff, 0, bread);
202
}
- 203 5 grokAssemblyExe = tempFile;
+ 203 10 grokAssemblyExe = tempFile;
204
- 205 5 grokAssemblyExe.deleteOnExit();
- 206 5 LOGGER.log(Level.FINE, "analyzer.AssemblyAnalyzer.grokassembly.deployed" , grokAssemblyExe.getPath());
+ 205 10 grokAssemblyExe.deleteOnExit();
+ 206 10 LOGGER.log(Level.FINE, "analyzer.AssemblyAnalyzer.grokassembly.deployed" , grokAssemblyExe.getPath());
207 0 } catch (IOException ioe) {
- 208 0 LOGGER.log(Level.WARNING, "analyzer.AssemblyAnalyzer.grokassembly.notdeployed" , ioe.getMessage());
- 209 0 throw new AnalysisException("Could not extract GrokAssembly.exe" , ioe);
- 210
+ 208 0 this .setEnabled(false );
+ 209 0 LOGGER.log(Level.WARNING, "analyzer.AssemblyAnalyzer.grokassembly.notdeployed" , ioe.getMessage());
+ 210 0 throw new AnalysisException("Could not extract GrokAssembly.exe" , ioe);
+ 211
} finally {
- 211 5 if (fos != null ) {
- 212
+ 212 10 if (fos != null ) {
+ 213
try {
- 213 5 fos.close();
- 214 0 } catch (Throwable e) {
- 215 0 LOGGER.fine("Error closing output stream" );
- 216 5 }
- 217
+ 214 10 fos.close();
+ 215 0 } catch (Throwable e) {
+ 216 0 LOGGER.fine("Error closing output stream" );
+ 217 10 }
+ 218
}
- 218 5 if (is != null ) {
- 219
+ 219 10 if (is != null ) {
+ 220
try {
- 220 5 is.close();
- 221 0 } catch (Throwable e) {
- 222 0 LOGGER.fine("Error closing input stream" );
- 223 5 }
- 224
- }
+ 221 10 is.close();
+ 222 0 } catch (Throwable e) {
+ 223 0 LOGGER.fine("Error closing input stream" );
+ 224 10 }
225
- }
+ }
226
-
- 227
-
- 228 5 final List<String> args = buildArgumentList();
- 229 5 BufferedReader rdr = null ;
- 230
- try {
- 231 5 final ProcessBuilder pb = new ProcessBuilder(args);
- 232 5 final Process p = pb.start();
- 233
-
- 234 5 rdr = new BufferedReader(new InputStreamReader(p.getErrorStream(), "UTF-8" ));
- 235 5 while (rdr.ready() && rdr.readLine() != null ) {
- 236
-
- 237
- }
- 238 5 final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(p.getInputStream());
- 239 5 final XPath xpath = XPathFactory.newInstance().newXPath();
- 240 5 final String error = xpath.evaluate("/assembly/error" , doc);
- 241 5 if (p.waitFor() != 1 || error == null || "" .equals(error)) {
- 242 0 LOGGER.warning("An error occurred with the .NET AssemblyAnalyzer, please see the log for more details." );
- 243 0 LOGGER.fine("GrokAssembly.exe is not working properly" );
- 244 0 grokAssemblyExe = null ;
- 245 0 throw new AnalysisException("Could not execute .NET AssemblyAnalyzer" );
- 246
- }
- 247 0 } catch (Throwable e) {
- 248 0 if (e instanceof AnalysisException) {
- 249 0 throw (AnalysisException) e;
- 250
- } else {
- 251 0 LOGGER.warning("analyzer.AssemblyAnalyzer.grokassembly.initialization.failed" );
- 252 0 LOGGER.log(Level.FINE, "analyzer.AssemblyAnalyzer.grokassembly.initialization.message" , e.getMessage());
- 253 0 throw new AnalysisException("An error occured with the .NET AssemblyAnalyzer" , e);
- 254
- }
- 255
- } finally {
- 256 5 if (rdr != null ) {
- 257
- try {
- 258 5 rdr.close();
- 259 0 } catch (IOException ex) {
- 260 0 LOGGER.log(Level.FINEST, "ignore" , ex);
- 261 5 }
- 262
- }
- 263
}
- 264
+ 227
- 265 5 builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- 266 5 }
- 267
-
- 268
- @Override
- 269
- public void close() throws Exception {
- 270 6 super .close();
- 271
+ 228
+
+ 229 10 final List<String> args = buildArgumentList();
+ 230 10 BufferedReader rdr = null ;
+ 231
try {
- 272 6 if (grokAssemblyExe != null && !grokAssemblyExe.delete()) {
- 273 0 grokAssemblyExe.deleteOnExit();
- 274
+ 232 10 final ProcessBuilder pb = new ProcessBuilder(args);
+ 233 10 final Process p = pb.start();
+ 234
+
+ 235 10 rdr = new BufferedReader(new InputStreamReader(p.getErrorStream(), "UTF-8" ));
+ 236 10 while (rdr.ready() && rdr.readLine() != null ) {
+ 237
+
+ 238
}
- 275 0 } catch (SecurityException se) {
- 276 0 LOGGER.fine("analyzer.AssemblyAnalyzer.grokassembly.notdeleted" );
- 277 6 }
- 278 6 }
- 279
+ 239 10 final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(p.getInputStream());
+ 240 10 final XPath xpath = XPathFactory.newInstance().newXPath();
+ 241 10 final String error = xpath.evaluate("/assembly/error" , doc);
+ 242 10 if (p.waitFor() != 1 || error == null || "" .equals(error)) {
+ 243 0 LOGGER.warning("An error occurred with the .NET AssemblyAnalyzer, please see the log for more details." );
+ 244 0 LOGGER.fine("GrokAssembly.exe is not working properly" );
+ 245 0 grokAssemblyExe = null ;
+ 246 0 this .setEnabled(false );
+ 247 0 throw new AnalysisException("Could not execute .NET AssemblyAnalyzer" );
+ 248
+ }
+ 249 0 } catch (Throwable e) {
+ 250 0 if (e instanceof AnalysisException) {
+ 251 0 throw (AnalysisException) e;
+ 252
+ } else {
+ 253 0 LOGGER.warning("analyzer.AssemblyAnalyzer.grokassembly.initialization.failed" );
+ 254 0 LOGGER.log(Level.FINE, "analyzer.AssemblyAnalyzer.grokassembly.initialization.message" , e.getMessage());
+ 255 0 this .setEnabled(false );
+ 256 0 throw new AnalysisException("An error occured with the .NET AssemblyAnalyzer" , e);
+ 257
+ }
+ 258
+ } finally {
+ 259 10 if (rdr != null ) {
+ 260
+ try {
+ 261 10 rdr.close();
+ 262 0 } catch (IOException ex) {
+ 263 0 LOGGER.log(Level.FINEST, "ignore" , ex);
+ 264 10 }
+ 265
+ }
+ 266
+ }
+ 267 10 builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ 268 10 }
+ 269
- 280
-
+ 270
+ @Override
+ 271
+ public void close() throws Exception {
+ 272 12 super .close();
+ 273
+ try {
+ 274 12 if (grokAssemblyExe != null && !grokAssemblyExe.delete()) {
+ 275 0 grokAssemblyExe.deleteOnExit();
+ 276
+ }
+ 277 0 } catch (SecurityException se) {
+ 278 0 LOGGER.fine("analyzer.AssemblyAnalyzer.grokassembly.notdeleted" );
+ 279 12 }
+ 280 12 }
281
-
+
282
-
+
283
-
+
284
-
+
285
- @Override
+
286
- public Set<String> getSupportedExtensions() {
- 287 853 return SUPPORTED_EXTENSIONS;
+
+ 287
+ @Override
288
- }
- 289
-
+ public Set<String> getSupportedExtensions() {
+ 289 1706 return SUPPORTED_EXTENSIONS;
290
-
+ }
291
-
+
292
-
+
293
-
+
294
-
+
295
- @Override
+
296
- public String getName() {
- 297 5 return ANALYZER_NAME;
+
+ 297
+ @Override
298
- }
- 299
-
+ public String getName() {
+ 299 10 return ANALYZER_NAME;
300
-
+ }
301
-
- 302
-
- 303
-
- 304
-
- 305
- @Override
- 306
- public AnalysisPhase getAnalysisPhase() {
- 307 1 return ANALYSIS_PHASE;
- 308
- }
- 309
- 310
+ 302
- 311
-
- 312
+ 303
+
+ 304
- 313
-
- 314
+ 305
+
+ 306
- 315
+ 307
@Override
- 316
- protected String getAnalyzerEnabledSettingKey() {
- 317 7 return Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED;
- 318
+ 308
+ public AnalysisPhase getAnalysisPhase() {
+ 309 2 return ANALYSIS_PHASE;
+ 310
}
- 319
+ 311
+
+ 312
+
+ 313
+
+ 314
+
+ 315
+
+ 316
+
+ 317
+ @Override
+ 318
+ protected String getAnalyzerEnabledSettingKey() {
+ 319 14 return Settings.KEYS.ANALYZER_ASSEMBLY_ENABLED;
+ 320
+ }
+ 321
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.CPEAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.CPEAnalyzer.html
index 639b3c060..95f12048a 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.CPEAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.CPEAnalyzer.html
@@ -12,7 +12,7 @@
Classes in this File Line Coverage Branch Coverage Complexity
- CPEAnalyzer 4.428571428571429; 4.429
+ CPEAnalyzer 4.428571428571429; 4.429
CPEAnalyzer$IdentifierConfidence 4.428571428571429; 4.429
CPEAnalyzer$IdentifierMatch 4.428571428571429; 4.429
@@ -145,7 +145,7 @@
63
- 64 1 private static final Logger LOGGER = Logger.getLogger(CPEAnalyzer.class .getName());
+ 64 2 private static final Logger LOGGER = Logger.getLogger(CPEAnalyzer.class .getName());
65
66
@@ -228,7 +228,7 @@
@Override
105
public String getName() {
- 106 4 return "CPE Analyzer" ;
+ 106 8 return "CPE Analyzer" ;
107
}
108
@@ -247,7 +247,7 @@
@Override
115
public AnalysisPhase getAnalysisPhase() {
- 116 1 return AnalysisPhase.IDENTIFIER_ANALYSIS;
+ 116 2 return AnalysisPhase.IDENTIFIER_ANALYSIS;
117
}
118
@@ -266,8 +266,8 @@
@Override
125
public void initialize() throws Exception {
- 126 1 this .open();
- 127 1 }
+ 126 2 this .open();
+ 127 2 }
128
129
@@ -286,19 +286,19 @@
136
public void open() throws IOException, DatabaseException {
- 137 1 LOGGER.log(Level.FINE, "Opening the CVE Database" );
- 138 1 cve = new CveDB();
- 139 1 cve.open();
- 140 1 LOGGER.log(Level.FINE, "Creating the Lucene CPE Index" );
- 141 1 cpe = CpeMemoryIndex.getInstance();
+ 137 2 LOGGER.log(Level.FINE, "Opening the CVE Database" );
+ 138 2 cve = new CveDB();
+ 139 2 cve.open();
+ 140 2 LOGGER.log(Level.FINE, "Creating the Lucene CPE Index" );
+ 141 2 cpe = CpeMemoryIndex.getInstance();
142
try {
- 143 1 cpe.open(cve);
+ 143 2 cpe.open(cve);
144 0 } catch (IndexException ex) {
145 0 LOGGER.log(Level.FINE, "IndexException" , ex);
146 0 throw new DatabaseException(ex);
- 147 1 }
- 148 1 }
+ 147 2 }
+ 148 2 }
149
150
@@ -311,15 +311,15 @@
@Override
154
public void close() {
- 155 1 if (cpe != null ) {
- 156 1 cpe.close();
+ 155 2 if (cpe != null ) {
+ 156 2 cpe.close();
157
}
- 158 1 if (cve != null ) {
- 159 1 cve.close();
+ 158 2 if (cve != null ) {
+ 159 2 cve.close();
160
}
- 161 1 }
+ 161 2 }
162
163
@@ -342,56 +342,56 @@
172
protected void determineCPE(Dependency dependency) throws CorruptIndexException, IOException, ParseException {
- 173 2 Confidence confidence = Confidence.HIGHEST;
+ 173 4 Confidence confidence = Confidence.HIGHEST;
174
- 175 2 String vendors = addEvidenceWithoutDuplicateTerms("" , dependency.getVendorEvidence(), confidence);
- 176 2 String products = addEvidenceWithoutDuplicateTerms("" , dependency.getProductEvidence(), confidence);
+ 175 4 String vendors = addEvidenceWithoutDuplicateTerms("" , dependency.getVendorEvidence(), confidence);
+ 176 4 String products = addEvidenceWithoutDuplicateTerms("" , dependency.getProductEvidence(), confidence);
177
178
- 179 2 addEvidenceWithoutDuplicateTerms("" , dependency.getVersionEvidence(), confidence);
+ 179 4 addEvidenceWithoutDuplicateTerms("" , dependency.getVersionEvidence(), confidence);
180
- 181 2 int ctr = 0;
+ 181 4 int ctr = 0;
182
do {
- 183 8 if (!vendors.isEmpty() && !products.isEmpty()) {
- 184 8 final List<IndexEntry> entries = searchCPE(vendors, products, dependency.getProductEvidence().getWeighting(),
+ 183 16 if (!vendors.isEmpty() && !products.isEmpty()) {
+ 184 16 final List<IndexEntry> entries = searchCPE(vendors, products, dependency.getProductEvidence().getWeighting(),
185
dependency.getVendorEvidence().getWeighting());
186
- 187 8 for (IndexEntry e : entries) {
- 188 54 if (verifyEntry(e, dependency)) {
- 189 4 final String vendor = e.getVendor();
- 190 4 final String product = e.getProduct();
- 191 4 determineIdentifiers(dependency, vendor, product);
+ 187 16 for (IndexEntry e : entries) {
+ 188 108 if (verifyEntry(e, dependency)) {
+ 189 8 final String vendor = e.getVendor();
+ 190 8 final String product = e.getProduct();
+ 191 8 determineIdentifiers(dependency, vendor, product);
192
}
- 193 54 }
+ 193 108 }
194
}
- 195 8 confidence = reduceConfidence(confidence);
- 196 8 if (dependency.getVendorEvidence().contains(confidence)) {
- 197 8 vendors = addEvidenceWithoutDuplicateTerms(vendors, dependency.getVendorEvidence(), confidence);
+ 195 16 confidence = reduceConfidence(confidence);
+ 196 16 if (dependency.getVendorEvidence().contains(confidence)) {
+ 197 16 vendors = addEvidenceWithoutDuplicateTerms(vendors, dependency.getVendorEvidence(), confidence);
198
}
- 199 8 if (dependency.getProductEvidence().contains(confidence)) {
- 200 7 products = addEvidenceWithoutDuplicateTerms(products, dependency.getProductEvidence(), confidence);
+ 199 16 if (dependency.getProductEvidence().contains(confidence)) {
+ 200 14 products = addEvidenceWithoutDuplicateTerms(products, dependency.getProductEvidence(), confidence);
201
}
202
203
- 204 8 if (dependency.getVersionEvidence().contains(confidence)) {
- 205 6 addEvidenceWithoutDuplicateTerms("" , dependency.getVersionEvidence(), confidence);
+ 204 16 if (dependency.getVersionEvidence().contains(confidence)) {
+ 205 12 addEvidenceWithoutDuplicateTerms("" , dependency.getVersionEvidence(), confidence);
206
}
- 207 8 } while ((++ctr) < 4);
- 208 2 }
+ 207 16 } while ((++ctr) < 4);
+ 208 4 }
209
210
@@ -416,31 +416,31 @@
220
private String addEvidenceWithoutDuplicateTerms(final String text, final EvidenceCollection ec, Confidence confidenceFilter) {
- 221 27 final String txt = (text == null ) ? "" : text;
- 222 27 final StringBuilder sb = new StringBuilder(txt.length() + (20 * ec.size()));
- 223 27 sb.append(' ' ).append(txt).append(' ' );
- 224 27 for (Evidence e : ec.iterator(confidenceFilter)) {
- 225 76 String value = e.getValue();
+ 221 54 final String txt = (text == null ) ? "" : text;
+ 222 54 final StringBuilder sb = new StringBuilder(txt.length() + (20 * ec.size()));
+ 223 54 sb.append(' ' ).append(txt).append(' ' );
+ 224 54 for (Evidence e : ec.iterator(confidenceFilter)) {
+ 225 152 String value = e.getValue();
226
227
228
- 229 76 if (value.startsWith("http://" )) {
- 230 4 value = value.substring(7).replaceAll("\\." , " " );
+ 229 152 if (value.startsWith("http://" )) {
+ 230 8 value = value.substring(7).replaceAll("\\." , " " );
231
}
- 232 76 if (value.startsWith("https://" )) {
+ 232 152 if (value.startsWith("https://" )) {
233 0 value = value.substring(8).replaceAll("\\." , " " );
234
}
- 235 76 if (sb.indexOf(" " + value + " " ) < 0) {
- 236 48 sb.append(value).append(' ' );
+ 235 152 if (sb.indexOf(" " + value + " " ) < 0) {
+ 236 96 sb.append(value).append(' ' );
237
}
- 238 76 }
- 239 27 return sb.toString().trim();
+ 238 152 }
+ 239 54 return sb.toString().trim();
240
}
241
@@ -459,13 +459,13 @@
248
private Confidence reduceConfidence(final Confidence c) {
- 249 8 if (c == Confidence.HIGHEST) {
- 250 2 return Confidence.HIGH;
- 251 6 } else if (c == Confidence.HIGH) {
- 252 2 return Confidence.MEDIUM;
+ 249 16 if (c == Confidence.HIGHEST) {
+ 250 4 return Confidence.HIGH;
+ 251 12 } else if (c == Confidence.HIGH) {
+ 252 4 return Confidence.MEDIUM;
253
} else {
- 254 4 return Confidence.LOW;
+ 254 8 return Confidence.LOW;
255
}
256
@@ -514,23 +514,23 @@
Set<String> vendorWeightings, Set<String> productWeightings)
278
throws CorruptIndexException, IOException, ParseException {
- 279 8 final ArrayList<IndexEntry> ret = new ArrayList<IndexEntry>(MAX_QUERY_RESULTS);
+ 279 16 final ArrayList<IndexEntry> ret = new ArrayList<IndexEntry>(MAX_QUERY_RESULTS);
280
- 281 8 final String searchString = buildSearch(vendor, product, vendorWeightings, productWeightings);
- 282 8 if (searchString == null ) {
+ 281 16 final String searchString = buildSearch(vendor, product, vendorWeightings, productWeightings);
+ 282 16 if (searchString == null ) {
283 0 return ret;
284
}
285
- 286 8 final TopDocs docs = cpe.search(searchString, MAX_QUERY_RESULTS);
- 287 208 for (ScoreDoc d : docs.scoreDocs) {
- 288 200 if (d.score >= 0.08) {
- 289 54 final Document doc = cpe.getDocument(d.doc);
- 290 54 final IndexEntry entry = new IndexEntry();
- 291 54 entry.setVendor(doc.get(Fields.VENDOR));
- 292 54 entry.setProduct(doc.get(Fields.PRODUCT));
+ 286 16 final TopDocs docs = cpe.search(searchString, MAX_QUERY_RESULTS);
+ 287 416 for (ScoreDoc d : docs.scoreDocs) {
+ 288 400 if (d.score >= 0.08) {
+ 289 108 final Document doc = cpe.getDocument(d.doc);
+ 290 108 final IndexEntry entry = new IndexEntry();
+ 291 108 entry.setVendor(doc.get(Fields.VENDOR));
+ 292 108 entry.setProduct(doc.get(Fields.PRODUCT));
293
294
@@ -545,16 +545,16 @@
299
- 300 54 entry.setSearchScore(d.score);
- 301 54 if (!ret.contains(entry)) {
- 302 54 ret.add(entry);
+ 300 108 entry.setSearchScore(d.score);
+ 301 108 if (!ret.contains(entry)) {
+ 302 108 ret.add(entry);
303
}
304
}
305
}
- 306 8 return ret;
+ 306 16 return ret;
307
}
308
@@ -591,23 +591,23 @@
protected String buildSearch(String vendor, String product,
324
Set<String> vendorWeighting, Set<String> productWeightings) {
- 325 8 final String v = vendor;
- 326 8 final String p = product;
- 327 8 final StringBuilder sb = new StringBuilder(v.length() + p.length()
+ 325 16 final String v = vendor;
+ 326 16 final String p = product;
+ 327 16 final StringBuilder sb = new StringBuilder(v.length() + p.length()
328
+ Fields.PRODUCT.length() + Fields.VENDOR.length() + STRING_BUILDER_BUFFER);
329
- 330 8 if (!appendWeightedSearch(sb, Fields.PRODUCT, p, productWeightings)) {
+ 330 16 if (!appendWeightedSearch(sb, Fields.PRODUCT, p, productWeightings)) {
331 0 return null ;
332
}
- 333 8 sb.append(" AND " );
- 334 8 if (!appendWeightedSearch(sb, Fields.VENDOR, v, vendorWeighting)) {
+ 333 16 sb.append(" AND " );
+ 334 16 if (!appendWeightedSearch(sb, Fields.VENDOR, v, vendorWeighting)) {
335 0 return null ;
336
}
- 337 8 return sb.toString();
+ 337 16 return sb.toString();
338
}
339
@@ -636,47 +636,47 @@
351
private boolean appendWeightedSearch(StringBuilder sb, String field, String searchText, Set<String> weightedText) {
- 352 16 sb.append(" " ).append(field).append(":( " );
+ 352 32 sb.append(" " ).append(field).append(":( " );
353
- 354 16 final String cleanText = cleanseText(searchText);
+ 354 32 final String cleanText = cleanseText(searchText);
355
- 356 16 if ("" .equals(cleanText)) {
+ 356 32 if ("" .equals(cleanText)) {
357 0 return false ;
358
}
359
- 360 16 if (weightedText == null || weightedText.isEmpty()) {
+ 360 32 if (weightedText == null || weightedText.isEmpty()) {
361 0 LuceneUtils.appendEscapedLuceneQuery(sb, cleanText);
362
} else {
- 363 16 final StringTokenizer tokens = new StringTokenizer(cleanText);
- 364 240 while (tokens.hasMoreElements()) {
- 365 224 final String word = tokens.nextToken();
- 366 224 String temp = null ;
- 367 224 for (String weighted : weightedText) {
- 368 408 final String weightedStr = cleanseText(weighted);
- 369 408 if (equalsIgnoreCaseAndNonAlpha(word, weightedStr)) {
- 370 30 temp = LuceneUtils.escapeLuceneQuery(word) + WEIGHTING_BOOST;
- 371 30 if (!word.equalsIgnoreCase(weightedStr)) {
+ 363 32 final StringTokenizer tokens = new StringTokenizer(cleanText);
+ 364 480 while (tokens.hasMoreElements()) {
+ 365 448 final String word = tokens.nextToken();
+ 366 448 String temp = null ;
+ 367 448 for (String weighted : weightedText) {
+ 368 816 final String weightedStr = cleanseText(weighted);
+ 369 816 if (equalsIgnoreCaseAndNonAlpha(word, weightedStr)) {
+ 370 60 temp = LuceneUtils.escapeLuceneQuery(word) + WEIGHTING_BOOST;
+ 371 60 if (!word.equalsIgnoreCase(weightedStr)) {
372 0 temp += " " + LuceneUtils.escapeLuceneQuery(weightedStr) + WEIGHTING_BOOST;
373
}
374
}
- 375 408 }
- 376 224 if (temp == null ) {
- 377 194 temp = LuceneUtils.escapeLuceneQuery(word);
+ 375 816 }
+ 376 448 if (temp == null ) {
+ 377 388 temp = LuceneUtils.escapeLuceneQuery(word);
378
}
- 379 224 sb.append(" " ).append(temp);
- 380 224 }
+ 379 448 sb.append(" " ).append(temp);
+ 380 448 }
381
}
- 382 16 sb.append(" ) " );
- 383 16 return true ;
+ 382 32 sb.append(" ) " );
+ 383 32 return true ;
384
}
385
@@ -695,7 +695,7 @@
392
private String cleanseText(String text) {
- 393 424 return text.replaceAll(CLEANSE_CHARACTER_RX, " " );
+ 393 848 return text.replaceAll(CLEANSE_CHARACTER_RX, " " );
394
}
395
@@ -716,15 +716,15 @@
403
private boolean equalsIgnoreCaseAndNonAlpha(String l, String r) {
- 404 408 if (l == null || r == null ) {
+ 404 816 if (l == null || r == null ) {
405 0 return false ;
406
}
407
- 408 408 final String left = l.replaceAll(CLEANSE_NONALPHA_RX, "" );
- 409 408 final String right = r.replaceAll(CLEANSE_NONALPHA_RX, "" );
- 410 408 return left.equalsIgnoreCase(right);
+ 408 816 final String left = l.replaceAll(CLEANSE_NONALPHA_RX, "" );
+ 409 816 final String right = r.replaceAll(CLEANSE_NONALPHA_RX, "" );
+ 410 816 return left.equalsIgnoreCase(right);
411
}
412
@@ -747,18 +747,18 @@
421
private boolean verifyEntry(final IndexEntry entry, final Dependency dependency) {
- 422 54 boolean isValid = false ;
+ 422 108 boolean isValid = false ;
423
- 424 54 if (collectionContainsString(dependency.getProductEvidence(), entry.getProduct())
+ 424 108 if (collectionContainsString(dependency.getProductEvidence(), entry.getProduct())
425
&& collectionContainsString(dependency.getVendorEvidence(), entry.getVendor())) {
426
- 427 4 isValid = true ;
+ 427 8 isValid = true ;
428
}
- 429 54 return isValid;
+ 429 108 return isValid;
430
}
431
@@ -803,14 +803,14 @@
451
- 452 59 if (text == null ) {
+ 452 118 if (text == null ) {
453 0 return false ;
454
}
- 455 59 final String[] words = text.split("[\\s_-]" );
- 456 59 final List<String> list = new ArrayList<String>();
- 457 59 String tempWord = null ;
- 458 174 for (String word : words) {
+ 455 118 final String[] words = text.split("[\\s_-]" );
+ 456 118 final List<String> list = new ArrayList<String>();
+ 457 118 String tempWord = null ;
+ 458 348 for (String word : words) {
459
460
@@ -819,28 +819,28 @@
462
- 463 115 if (tempWord != null ) {
- 464 4 list.add(tempWord + word);
- 465 4 tempWord = null ;
- 466 111 } else if (word.length() <= 2) {
- 467 4 tempWord = word;
+ 463 230 if (tempWord != null ) {
+ 464 8 list.add(tempWord + word);
+ 465 8 tempWord = null ;
+ 466 222 } else if (word.length() <= 2) {
+ 467 8 tempWord = word;
468
} else {
- 469 107 list.add(word);
+ 469 214 list.add(word);
470
}
471
}
- 472 59 if (tempWord != null && !list.isEmpty()) {
+ 472 118 if (tempWord != null && !list.isEmpty()) {
473 0 final String tmp = list.get(list.size() - 1) + tempWord;
474 0 list.add(tmp);
475
}
- 476 59 boolean contains = true ;
- 477 59 for (String word : list) {
- 478 111 contains &= ec.containsUsedString(word);
- 479 111 }
- 480 59 return contains;
+ 476 118 boolean contains = true ;
+ 477 118 for (String word : list) {
+ 478 222 contains &= ec.containsUsedString(word);
+ 479 222 }
+ 480 118 return contains;
481
}
482
@@ -865,15 +865,15 @@
public void analyze(Dependency dependency, Engine engine) throws AnalysisException {
492
try {
- 493 2 determineCPE(dependency);
+ 493 4 determineCPE(dependency);
494 0 } catch (CorruptIndexException ex) {
495 0 throw new AnalysisException("CPE Index is corrupt." , ex);
496 0 } catch (IOException ex) {
497 0 throw new AnalysisException("Failure opening the CPE Index." , ex);
498 0 } catch (ParseException ex) {
499 0 throw new AnalysisException("Unable to parse the generated Lucene query for this dependency." , ex);
- 500 2 }
- 501 2 }
+ 500 4 }
+ 501 4 }
502
503
@@ -898,422 +898,420 @@
513
private void determineIdentifiers(Dependency dependency, String vendor, String product) throws UnsupportedEncodingException {
- 514 4 final Set<VulnerableSoftware> cpes = cve.getCPEs(vendor, product);
- 515 4 DependencyVersion bestGuess = new DependencyVersion("-" );
- 516 4 Confidence bestGuessConf = null ;
- 517 4 final List<IdentifierMatch> collected = new ArrayList<IdentifierMatch>();
- 518 20 for (Confidence conf : Confidence.values()) {
- 519 16 for (Evidence evidence : dependency.getVersionEvidence().iterator(conf)) {
- 520 16 final DependencyVersion evVer = DependencyVersionUtil.parseVersion(evidence.getValue());
- 521 16 if (evVer == null ) {
+ 514 8 final Set<VulnerableSoftware> cpes = cve.getCPEs(vendor, product);
+ 515 8 DependencyVersion bestGuess = new DependencyVersion("-" );
+ 516 8 Confidence bestGuessConf = null ;
+ 517 8 final List<IdentifierMatch> collected = new ArrayList<IdentifierMatch>();
+ 518 40 for (Confidence conf : Confidence.values()) {
+ 519 32 for (Evidence evidence : dependency.getVersionEvidence().iterator(conf)) {
+ 520 32 final DependencyVersion evVer = DependencyVersionUtil.parseVersion(evidence.getValue());
+ 521 32 if (evVer == null ) {
522 0 continue ;
523
}
- 524 16 for (VulnerableSoftware vs : cpes) {
+ 524 32 for (VulnerableSoftware vs : cpes) {
525
DependencyVersion dbVer;
- 526 240 if (vs.getRevision() != null && !vs.getRevision().isEmpty()) {
- 527 72 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion() + "." + vs.getRevision());
+ 526 1248 if (vs.getRevision() != null && !vs.getRevision().isEmpty()) {
+ 527 512 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion() + "." + vs.getRevision());
528
} else {
- 529 168 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion());
+ 529 736 dbVer = DependencyVersionUtil.parseVersion(vs.getVersion());
530
}
- 531 240 if (dbVer == null
+ 531 1248 if (dbVer == null
532
|| evVer.equals(dbVer)) {
533
- 534
-
- 535 16 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8" ));
- 536 16 final IdentifierMatch match = new IdentifierMatch("cpe" , vs.getName(), url, IdentifierConfidence.EXACT_MATCH, conf);
- 537 16 collected.add(match);
- 538 16 } else {
- 539
+ 534 32 final String url = String.format(NVD_SEARCH_URL, URLEncoder.encode(vs.getName(), "UTF-8" ));
+ 535 32 final IdentifierMatch match = new IdentifierMatch("cpe" , vs.getName(), url, IdentifierConfidence.EXACT_MATCH, conf);
+ 536 32 collected.add(match);
+ 537 32 } else {
+ 538
- 540 224 if (evVer.getVersionParts().size() <= dbVer.getVersionParts().size()
- 541
+ 539 1216 if (evVer.getVersionParts().size() <= dbVer.getVersionParts().size()
+ 540
&& evVer.matchesAtLeastThreeLevels(dbVer)) {
- 542 56 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) {
- 543 2 if (bestGuess.getVersionParts().size() < dbVer.getVersionParts().size()) {
- 544 2 bestGuess = dbVer;
- 545 2 bestGuessConf = conf;
- 546
+ 541 256 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) {
+ 542 8 if (bestGuess.getVersionParts().size() < dbVer.getVersionParts().size()) {
+ 543 8 bestGuess = dbVer;
+ 544 8 bestGuessConf = conf;
+ 545
}
- 547
+ 546
}
- 548
+ 547
}
- 549
+ 548
+ }
+ 549 1248 }
+ 550 32 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) {
+ 551 0 if (bestGuess.getVersionParts().size() < evVer.getVersionParts().size()) {
+ 552 0 bestGuess = evVer;
+ 553 0 bestGuessConf = conf;
+ 554
}
- 550 240 }
- 551 16 if (bestGuessConf == null || bestGuessConf.compareTo(conf) > 0) {
- 552 2 if (bestGuess.getVersionParts().size() < evVer.getVersionParts().size()) {
- 553 2 bestGuess = evVer;
- 554 2 bestGuessConf = conf;
555
- }
- 556
}
- 557 16 }
- 558
+ 556 32 }
+ 557
}
- 559 4 final String cpeName = String.format("cpe:/a:%s:%s:%s" , vendor, product, bestGuess.toString());
- 560 4 final String url = null ;
- 561 4 if (bestGuessConf == null ) {
- 562 0 bestGuessConf = Confidence.LOW;
- 563
+ 558 8 final String cpeName = String.format("cpe:/a:%s:%s:%s" , vendor, product, bestGuess.toString());
+ 559 8 final String url = null ;
+ 560 8 if (bestGuessConf == null ) {
+ 561 0 bestGuessConf = Confidence.LOW;
+ 562
}
- 564 4 final IdentifierMatch match = new IdentifierMatch("cpe" , cpeName, url, IdentifierConfidence.BEST_GUESS, bestGuessConf);
- 565 4 collected.add(match);
- 566
+ 563 8 final IdentifierMatch match = new IdentifierMatch("cpe" , cpeName, url, IdentifierConfidence.BEST_GUESS, bestGuessConf);
+ 564 8 collected.add(match);
+ 565
- 567 4 Collections.sort(collected);
- 568 4 final IdentifierConfidence bestIdentifierQuality = collected.get(0).getConfidence();
- 569 4 final Confidence bestEvidenceQuality = collected.get(0).getEvidenceConfidence();
- 570 4 for (IdentifierMatch m : collected) {
- 571 20 if (bestIdentifierQuality.equals(m.getConfidence())
- 572
+ 566 8 Collections.sort(collected);
+ 567 8 final IdentifierConfidence bestIdentifierQuality = collected.get(0).getConfidence();
+ 568 8 final Confidence bestEvidenceQuality = collected.get(0).getEvidenceConfidence();
+ 569 8 for (IdentifierMatch m : collected) {
+ 570 40 if (bestIdentifierQuality.equals(m.getConfidence())
+ 571
&& bestEvidenceQuality.equals(m.getEvidenceConfidence())) {
- 573 4 final Identifier i = m.getIdentifier();
- 574 4 if (bestIdentifierQuality == IdentifierConfidence.BEST_GUESS) {
- 575 0 i.setConfidence(Confidence.LOW);
- 576
+ 572 8 final Identifier i = m.getIdentifier();
+ 573 8 if (bestIdentifierQuality == IdentifierConfidence.BEST_GUESS) {
+ 574 0 i.setConfidence(Confidence.LOW);
+ 575
} else {
- 577 4 i.setConfidence(bestEvidenceQuality);
- 578
+ 576 8 i.setConfidence(bestEvidenceQuality);
+ 577
}
- 579 4 dependency.addIdentifier(i);
- 580
+ 578 8 dependency.addIdentifier(i);
+ 579
}
- 581 20 }
- 582 4 }
+ 580 40 }
+ 581 8 }
+ 582
+
583
-
+
584
-
- 585
- 586
+ 585
- 587 1 private enum IdentifierConfidence {
+ 586 2 private enum IdentifierConfidence {
+ 587
+
588
-
+
589
-
- 590
- 591
+ 590
- 592 1 EXACT_MATCH,
+ 591 2 EXACT_MATCH,
+ 592
+
593
-
- 594
- 595
+ 594
- 596 1 BEST_GUESS
+ 595 2 BEST_GUESS
+ 596
+ }
597
- }
+
598
-
- 599
- 600
+ 599
- 601
+ 600
- 602 16 private static class IdentifierMatch implements Comparable<IdentifierMatch> {
+ 601 32 private static class IdentifierMatch implements Comparable<IdentifierMatch> {
+ 602
+
603
-
+
604
-
- 605
+ 605
+
606
-
- 607
- 608
+ 607
- 609
+ 608
- 610
+ 609
- 611
+ 610
- 612
+ 611
- 613 20 IdentifierMatch(String type, String value, String url, IdentifierConfidence identifierConfidence, Confidence evidenceConfidence) {
- 614 20 this .identifier = new Identifier(type, value, url);
- 615 20 this .confidence = identifierConfidence;
- 616 20 this .evidenceConfidence = evidenceConfidence;
- 617 20 }
- 618
+ 612 40 IdentifierMatch(String type, String value, String url, IdentifierConfidence identifierConfidence, Confidence evidenceConfidence) {
+ 613 40 this .identifier = new Identifier(type, value, url);
+ 614 40 this .confidence = identifierConfidence;
+ 615 40 this .evidenceConfidence = evidenceConfidence;
+ 616 40 }
+ 617
+ 618
+
619
-
- 620
+ 620
+
621
-
- 622
private Confidence evidenceConfidence;
+ 622
+
623
-
+
624
-
- 625
+ 625
+
626
-
- 627
+ 627
+
628
-
- 629
public Confidence getEvidenceConfidence() {
- 630
+ 629
return evidenceConfidence;
+ 630
+ }
631
- }
+
632
-
+
633
-
- 634
+ 634
+
635
-
- 636
+ 636
+
637
-
- 638
public void setEvidenceConfidence(Confidence evidenceConfidence) {
- 639
+ 638
this .evidenceConfidence = evidenceConfidence;
+ 639
+ }
640
- }
+
641
-
- 642
+ 642
+
643
-
- 644
private IdentifierConfidence confidence;
+ 644
+
645
-
+
646
-
- 647
+ 647
+
648
-
- 649
+ 649
+
650
-
- 651
public IdentifierConfidence getConfidence() {
- 652
+ 651
return confidence;
+ 652
+ }
653
- }
+
654
-
+
655
-
- 656
+ 656
+
657
-
- 658
+ 658
+
659
-
- 660
public void setConfidence(IdentifierConfidence confidence) {
- 661
+ 660
this .confidence = confidence;
+ 661
+ }
662
- }
+
663
-
- 664
+ 664
+
665
-
- 666
private Identifier identifier;
+ 666
+
667
-
+
668
-
- 669
+ 669
+
670
-
- 671
+ 671
+
672
-
- 673
public Identifier getIdentifier() {
- 674
+ 673
return identifier;
+ 674
+ }
675
- }
+
676
-
+
677
-
- 678
+ 678
+
679
-
- 680
+ 680
+
681
-
- 682
public void setIdentifier(Identifier identifier) {
- 683
+ 682
this .identifier = identifier;
+ 683
+ }
684
- }
+
685
-
- 686
+ 686
+
687
-
+
688
-
- 689
+ 689
+
690
-
- 691
+ 691
+
692
-
+ @Override
693
- @Override
- 694
public String toString() {
- 695 0 return "IdentifierMatch{" + "evidenceConfidence=" + evidenceConfidence
- 696
+ 694 0 return "IdentifierMatch{" + "evidenceConfidence=" + evidenceConfidence
+ 695
+ ", confidence=" + confidence + ", identifier=" + identifier + '}' ;
+ 696
+ }
697
- }
+
698
-
+
699
-
- 700
+ 700
+
701
-
- 702
+ 702
+
703
-
+ @Override
704
- @Override
- 705
public int hashCode() {
- 706 0 int hash = 5;
- 707 0 hash = 97 * hash + (this .evidenceConfidence != null ? this .evidenceConfidence.hashCode() : 0);
- 708 0 hash = 97 * hash + (this .confidence != null ? this .confidence.hashCode() : 0);
- 709 0 hash = 97 * hash + (this .identifier != null ? this .identifier.hashCode() : 0);
- 710 0 return hash;
+ 705 0 int hash = 5;
+ 706 0 hash = 97 * hash + (this .evidenceConfidence != null ? this .evidenceConfidence.hashCode() : 0);
+ 707 0 hash = 97 * hash + (this .confidence != null ? this .confidence.hashCode() : 0);
+ 708 0 hash = 97 * hash + (this .identifier != null ? this .identifier.hashCode() : 0);
+ 709 0 return hash;
+ 710
+ }
711
- }
+
712
-
+
713
-
- 714
+ 714
+
715
-
- 716
- 717
+ 716
+ 717
+
718
-
+ @Override
719
- @Override
- 720
public boolean equals(Object obj) {
- 721 0 if (obj == null ) {
- 722 0 return false ;
- 723
+ 720 0 if (obj == null ) {
+ 721 0 return false ;
+ 722
}
- 724 0 if (getClass() != obj.getClass()) {
- 725 0 return false ;
- 726
+ 723 0 if (getClass() != obj.getClass()) {
+ 724 0 return false ;
+ 725
}
- 727 0 final IdentifierMatch other = (IdentifierMatch) obj;
- 728 0 if (this .evidenceConfidence != other.evidenceConfidence) {
- 729 0 return false ;
- 730
+ 726 0 final IdentifierMatch other = (IdentifierMatch) obj;
+ 727 0 if (this .evidenceConfidence != other.evidenceConfidence) {
+ 728 0 return false ;
+ 729
}
- 731 0 if (this .confidence != other.confidence) {
- 732 0 return false ;
- 733
+ 730 0 if (this .confidence != other.confidence) {
+ 731 0 return false ;
+ 732
}
- 734 0 if (this .identifier != other.identifier && (this .identifier == null || !this .identifier.equals(other.identifier))) {
- 735 0 return false ;
- 736
+ 733 0 if (this .identifier != other.identifier && (this .identifier == null || !this .identifier.equals(other.identifier))) {
+ 734 0 return false ;
+ 735
}
- 737 0 return true ;
+ 736 0 return true ;
+ 737
+ }
738
- }
- 739
- 740
+ 739
- 741
+ 740
- 742
+ 741
- 743
+ 742
- 744
+ 743
- 745
+ 744
- 746
+ 745
- 747
+ 746
- 748
+ 747
@Override
- 749
+ 748
public int compareTo(IdentifierMatch o) {
- 750 16 int conf = this .confidence.compareTo(o.confidence);
- 751 16 if (conf == 0) {
- 752 12 conf = this .evidenceConfidence.compareTo(o.evidenceConfidence);
- 753 12 if (conf == 0) {
- 754 4 conf = identifier.compareTo(o.identifier);
- 755
+ 749 32 int conf = this .confidence.compareTo(o.confidence);
+ 750 32 if (conf == 0) {
+ 751 24 conf = this .evidenceConfidence.compareTo(o.evidenceConfidence);
+ 752 24 if (conf == 0) {
+ 753 8 conf = identifier.compareTo(o.identifier);
+ 754
}
- 756
+ 755
}
- 757 16 return conf;
- 758
+ 756 32 return conf;
+ 757
}
- 759
+ 758
}
- 760
+ 759
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.CpeSuppressionAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.CpeSuppressionAnalyzer.html
index 74ec43e04..155412620 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.CpeSuppressionAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.CpeSuppressionAnalyzer.html
@@ -12,7 +12,7 @@
@@ -97,7 +97,7 @@
40
- 41 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.POST_IDENTIFIER_ANALYSIS;
+ 41 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.POST_IDENTIFIER_ANALYSIS;
42
43
@@ -114,7 +114,7 @@
@Override
49
public String getName() {
- 50 4 return ANALYZER_NAME;
+ 50 8 return ANALYZER_NAME;
51
}
52
@@ -133,7 +133,7 @@
@Override
59
public AnalysisPhase getAnalysisPhase() {
- 60 1 return ANALYSIS_PHASE;
+ 60 2 return ANALYSIS_PHASE;
61
}
62
@@ -146,20 +146,20 @@
public void analyze(final Dependency dependency, final Engine engine) throws AnalysisException {
66
- 67 2 if (getRules() == null || getRules().size() <= 0) {
- 68 2 return ;
+ 67 4 if (getRules() == null || getRules().size() <= 0) {
+ 68 0 return ;
69
}
70
- 71 0 for (final SuppressionRule rule : getRules()) {
- 72 0 rule.process(dependency);
- 73 0 }
- 74 0 }
+ 71 4 for (final SuppressionRule rule : getRules()) {
+ 72 4 rule.process(dependency);
+ 73 4 }
+ 74 4 }
75
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer.html
index 87f5a4ee8..2516b5425 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.DependencyBundlingAnalyzer.html
@@ -119,7 +119,7 @@
51
- 52 1 private static final Logger LOGGER = Logger.getLogger(DependencyBundlingAnalyzer.class .getName());
+ 52 2 private static final Logger LOGGER = Logger.getLogger(DependencyBundlingAnalyzer.class .getName());
53
54
@@ -130,7 +130,7 @@
57
- 58 1 private static final Pattern STARTING_TEXT_PATTERN = Pattern.compile("^[a-zA-Z]*" );
+ 58 2 private static final Pattern STARTING_TEXT_PATTERN = Pattern.compile("^[a-zA-Z]*" );
59
60
@@ -157,7 +157,7 @@
71
- 72 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.PRE_FINDING_ANALYSIS;
+ 72 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.PRE_FINDING_ANALYSIS;
73
74
@@ -172,7 +172,7 @@
79
public String getName() {
- 80 5 return ANALYZER_NAME;
+ 80 10 return ANALYZER_NAME;
81
}
82
@@ -189,7 +189,7 @@
88
public AnalysisPhase getAnalysisPhase() {
- 89 2 return ANALYSIS_PHASE;
+ 89 4 return ANALYSIS_PHASE;
90
}
91
@@ -216,19 +216,19 @@
@Override
102
public void analyze(Dependency ignore, Engine engine) throws AnalysisException {
- 103 2 if (!analyzed) {
- 104 1 analyzed = true ;
- 105 1 final Set<Dependency> dependenciesToRemove = new HashSet<Dependency>();
- 106 1 final ListIterator<Dependency> mainIterator = engine.getDependencies().listIterator();
+ 103 4 if (!analyzed) {
+ 104 2 analyzed = true ;
+ 105 2 final Set<Dependency> dependenciesToRemove = new HashSet<Dependency>();
+ 106 2 final ListIterator<Dependency> mainIterator = engine.getDependencies().listIterator();
107
- 108 3 while (mainIterator.hasNext()) {
- 109 2 final Dependency dependency = mainIterator.next();
- 110 2 if (mainIterator.hasNext()) {
- 111 1 final ListIterator<Dependency> subIterator = engine.getDependencies().listIterator(mainIterator.nextIndex());
- 112 2 while (subIterator.hasNext()) {
- 113 1 final Dependency nextDependency = subIterator.next();
- 114 1 if (hashesMatch(dependency, nextDependency)) {
+ 108 6 while (mainIterator.hasNext()) {
+ 109 4 final Dependency dependency = mainIterator.next();
+ 110 4 if (mainIterator.hasNext()) {
+ 111 2 final ListIterator<Dependency> subIterator = engine.getDependencies().listIterator(mainIterator.nextIndex());
+ 112 4 while (subIterator.hasNext()) {
+ 113 2 final Dependency nextDependency = subIterator.next();
+ 114 2 if (hashesMatch(dependency, nextDependency)) {
115 0 if (isCore(dependency, nextDependency)) {
116 0 mergeDependencies(dependency, nextDependency, dependenciesToRemove);
117
@@ -236,7 +236,7 @@
118 0 mergeDependencies(nextDependency, dependency, dependenciesToRemove);
119
}
- 120 1 } else if (isShadedJar(dependency, nextDependency)) {
+ 120 2 } else if (isShadedJar(dependency, nextDependency)) {
121 0 if (dependency.getFileName().toLowerCase().endsWith("pom.xml" )) {
122 0 dependenciesToRemove.add(dependency);
123
@@ -244,7 +244,7 @@
124 0 dependenciesToRemove.add(nextDependency);
125
}
- 126 1 } else if (cpeIdentifiersMatch(dependency, nextDependency)
+ 126 2 } else if (cpeIdentifiersMatch(dependency, nextDependency)
127
&& hasSameBasePath(dependency, nextDependency)
128
@@ -260,20 +260,20 @@
}
135
}
- 136 1 }
+ 136 2 }
137
}
- 138 2 }
+ 138 4 }
139
140
- 141 1 for (Dependency d : dependenciesToRemove) {
+ 141 2 for (Dependency d : dependenciesToRemove) {
142 0 engine.getDependencies().remove(d);
143 0 }
144
}
- 145 2 }
+ 145 4 }
146
147
@@ -440,28 +440,28 @@
250
private boolean cpeIdentifiersMatch(Dependency dependency1, Dependency dependency2) {
- 251 1 if (dependency1 == null || dependency1.getIdentifiers() == null
+ 251 2 if (dependency1 == null || dependency1.getIdentifiers() == null
252
|| dependency2 == null || dependency2.getIdentifiers() == null ) {
253 0 return false ;
254
}
- 255 1 boolean matches = false ;
- 256 1 int cpeCount1 = 0;
- 257 1 int cpeCount2 = 0;
- 258 1 for (Identifier i : dependency1.getIdentifiers()) {
+ 255 2 boolean matches = false ;
+ 256 2 int cpeCount1 = 0;
+ 257 2 int cpeCount2 = 0;
+ 258 2 for (Identifier i : dependency1.getIdentifiers()) {
259 0 if ("cpe" .equals(i.getType())) {
260 0 cpeCount1 += 1;
261
}
262 0 }
- 263 1 for (Identifier i : dependency2.getIdentifiers()) {
- 264 2 if ("cpe" .equals(i.getType())) {
- 265 2 cpeCount2 += 1;
+ 263 2 for (Identifier i : dependency2.getIdentifiers()) {
+ 264 4 if ("cpe" .equals(i.getType())) {
+ 265 4 cpeCount2 += 1;
266
}
- 267 2 }
- 268 1 if (cpeCount1 > 0 && cpeCount1 == cpeCount2) {
+ 267 4 }
+ 268 2 if (cpeCount1 > 0 && cpeCount1 == cpeCount2) {
269 0 for (Identifier i : dependency1.getIdentifiers()) {
270 0 matches |= dependency2.getIdentifiers().contains(i);
271 0 if (!matches) {
@@ -471,12 +471,12 @@
274 0 }
275
}
- 276 1 if (LogUtils.isVerboseLoggingEnabled()) {
+ 276 2 if (LogUtils.isVerboseLoggingEnabled()) {
277 0 final String msg = String.format("IdentifiersMatch=%s (%s, %s)" , matches, dependency1.getFileName(), dependency2.getFileName());
278 0 LOGGER.log(Level.FINE, msg);
279
}
- 280 1 return matches;
+ 280 2 return matches;
281
}
282
@@ -553,24 +553,24 @@
328
boolean isCore(Dependency left, Dependency right) {
- 329 2 final String leftName = left.getFileName().toLowerCase();
- 330 2 final String rightName = right.getFileName().toLowerCase();
+ 329 4 final String leftName = left.getFileName().toLowerCase();
+ 330 4 final String rightName = right.getFileName().toLowerCase();
331
332
final boolean returnVal;
- 333 2 if (!rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+" ) && leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+" )
+ 333 4 if (!rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+" ) && leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+" )
334
|| rightName.contains("core" ) && !leftName.contains("core" )
335
|| rightName.contains("kernel" ) && !leftName.contains("kernel" )) {
336 0 returnVal = false ;
- 337 2 } else if (rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+" ) && !leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+" )
+ 337 4 } else if (rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+" ) && !leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+" )
338
|| !rightName.contains("core" ) && leftName.contains("core" )
339
|| !rightName.contains("kernel" ) && leftName.contains("kernel" )) {
- 340 2 returnVal = true ;
+ 340 4 returnVal = true ;
341
} else {
342
@@ -594,12 +594,12 @@
351 0 returnVal = leftName.length() <= rightName.length();
352
}
- 353 2 if (LogUtils.isVerboseLoggingEnabled()) {
+ 353 4 if (LogUtils.isVerboseLoggingEnabled()) {
354 0 final String msg = String.format("IsCore=%s (%s, %s)" , returnVal, left.getFileName(), right.getFileName());
355 0 LOGGER.log(Level.FINE, msg);
356
}
- 357 2 return returnVal;
+ 357 4 return returnVal;
358
}
359
@@ -620,11 +620,11 @@
367
private boolean hashesMatch(Dependency dependency1, Dependency dependency2) {
- 368 1 if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null ) {
+ 368 2 if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null ) {
369 0 return false ;
370
}
- 371 1 return dependency1.getSha1sum().equals(dependency2.getSha1sum());
+ 371 2 return dependency1.getSha1sum().equals(dependency2.getSha1sum());
372
}
373
@@ -649,21 +649,21 @@
383
private boolean isShadedJar(Dependency dependency, Dependency nextDependency) {
- 384 1 final String mainName = dependency.getFileName().toLowerCase();
- 385 1 final String nextName = nextDependency.getFileName().toLowerCase();
- 386 1 if (mainName.endsWith(".jar" ) && nextName.endsWith("pom.xml" )) {
+ 384 2 final String mainName = dependency.getFileName().toLowerCase();
+ 385 2 final String nextName = nextDependency.getFileName().toLowerCase();
+ 386 2 if (mainName.endsWith(".jar" ) && nextName.endsWith("pom.xml" )) {
387 0 return dependency.getIdentifiers().containsAll(nextDependency.getIdentifiers());
- 388 1 } else if (nextName.endsWith(".jar" ) && mainName.endsWith("pom.xml" )) {
+ 388 2 } else if (nextName.endsWith(".jar" ) && mainName.endsWith("pom.xml" )) {
389 0 return nextDependency.getIdentifiers().containsAll(dependency.getIdentifiers());
390
}
- 391 1 return false ;
+ 391 2 return false ;
392
}
393
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer.html
index 25103e051..8d4128c34 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer.html
@@ -12,7 +12,7 @@
@@ -111,7 +111,7 @@
47
- 48 1 private static final Logger LOGGER = Logger.getLogger(FalsePositiveAnalyzer.class .getName());
+ 48 2 private static final Logger LOGGER = Logger.getLogger(FalsePositiveAnalyzer.class .getName());
49
50
@@ -128,7 +128,7 @@
56
- 57 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.POST_IDENTIFIER_ANALYSIS;
+ 57 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.POST_IDENTIFIER_ANALYSIS;
58
59
@@ -143,7 +143,7 @@
64
public String getName() {
- 65 5 return ANALYZER_NAME;
+ 65 10 return ANALYZER_NAME;
66
}
67
@@ -160,7 +160,7 @@
73
public AnalysisPhase getAnalysisPhase() {
- 74 2 return ANALYSIS_PHASE;
+ 74 4 return ANALYSIS_PHASE;
75
}
76
@@ -185,13 +185,13 @@
@Override
86
public void analyze(Dependency dependency, Engine engine) throws AnalysisException {
- 87 3 removeJreEntries(dependency);
- 88 3 removeBadMatches(dependency);
- 89 3 removeWrongVersionMatches(dependency);
- 90 3 removeSpuriousCPE(dependency);
- 91 3 removeDuplicativeEntriesFromJar(dependency, engine);
- 92 3 addFalseNegativeCPEs(dependency);
- 93 3 }
+ 87 6 removeJreEntries(dependency);
+ 88 6 removeBadMatches(dependency);
+ 89 6 removeWrongVersionMatches(dependency);
+ 90 6 removeSpuriousCPE(dependency);
+ 91 6 removeDuplicativeEntriesFromJar(dependency, engine);
+ 92 6 addFalseNegativeCPEs(dependency);
+ 93 6 }
94
95
@@ -234,28 +234,28 @@
@SuppressWarnings("null" )
114
private void removeSpuriousCPE(Dependency dependency) {
- 115 3 final List<Identifier> ids = new ArrayList<Identifier>();
- 116 3 ids.addAll(dependency.getIdentifiers());
- 117 3 Collections.sort(ids);
- 118 3 final ListIterator<Identifier> mainItr = ids.listIterator();
- 119 5 while (mainItr.hasNext()) {
- 120 2 final Identifier currentId = mainItr.next();
- 121 2 final VulnerableSoftware currentCpe = parseCpe(currentId.getType(), currentId.getValue());
- 122 2 if (currentCpe == null ) {
+ 115 6 final List<Identifier> ids = new ArrayList<Identifier>();
+ 116 6 ids.addAll(dependency.getIdentifiers());
+ 117 6 Collections.sort(ids);
+ 118 6 final ListIterator<Identifier> mainItr = ids.listIterator();
+ 119 10 while (mainItr.hasNext()) {
+ 120 4 final Identifier currentId = mainItr.next();
+ 121 4 final VulnerableSoftware currentCpe = parseCpe(currentId.getType(), currentId.getValue());
+ 122 4 if (currentCpe == null ) {
123 0 continue ;
124
}
- 125 2 final ListIterator<Identifier> subItr = ids.listIterator(mainItr.nextIndex());
- 126 3 while (subItr.hasNext()) {
- 127 1 final Identifier nextId = subItr.next();
- 128 1 final VulnerableSoftware nextCpe = parseCpe(nextId.getType(), nextId.getValue());
- 129 1 if (nextCpe == null ) {
+ 125 4 final ListIterator<Identifier> subItr = ids.listIterator(mainItr.nextIndex());
+ 126 6 while (subItr.hasNext()) {
+ 127 2 final Identifier nextId = subItr.next();
+ 128 2 final VulnerableSoftware nextCpe = parseCpe(nextId.getType(), nextId.getValue());
+ 129 2 if (nextCpe == null ) {
130 0 continue ;
131
}
132
- 133 1 if (currentCpe.getVendor().equals(nextCpe.getVendor())) {
+ 133 2 if (currentCpe.getVendor().equals(nextCpe.getVendor())) {
134 0 if (currentCpe.getProduct().equals(nextCpe.getProduct())) {
135
@@ -286,414 +286,450 @@
}
155
}
- 156 1 }
- 157 2 }
- 158 3 }
+ 156 2 }
+ 157 4 }
+ 158 6 }
159
160
161
- 162 1 public static final Pattern CORE_JAVA = Pattern.compile("^cpe:/a:(sun|oracle|ibm):(j2[ems]e|"
+ 162 2 public static final Pattern CORE_JAVA = Pattern.compile("^cpe:/a:(sun|oracle|ibm):(j2[ems]e|"
163
+ "java(_platform_micro_edition|_runtime_environment|_se|virtual_machine|se_development_kit|fx)?|"
164
- + "jdk|jre|jsf|jsse)($|:.*)" );
+ + "jdk|jre|jsse)($|:.*)" );
165
-
- 166
-
- 167
-
- 168 1 public static final Pattern CORE_FILES = Pattern.compile("^((alt[-])?rt|jsf[-].*|jsse|jfxrt|jfr|jce|javaws|deploy|charsets)\\.jar$" );
- 169
+ 166
+
+ 167
+
+ 168
+
+ 169 2 public static final Pattern CORE_JAVA_JSF = Pattern.compile("^cpe:/a:(sun|oracle|ibm):jsf($|:.*)" );
170
171
-
+
172
-
- 173
-
+
+ 173 2 public static final Pattern CORE_FILES = Pattern.compile("(^|/)((alt[-])?rt|jsse|jfxrt|jfr|jce|javaws|deploy|charsets)\\.jar$" );
174
-
+
175
- private void removeJreEntries(Dependency dependency) {
- 176 3 final Set<Identifier> identifiers = dependency.getIdentifiers();
- 177 3 final Iterator<Identifier> itr = identifiers.iterator();
- 178 6 while (itr.hasNext()) {
- 179 3 final Identifier i = itr.next();
- 180 3 final Matcher coreCPE = CORE_JAVA.matcher(i.getValue());
- 181 3 final Matcher coreFiles = CORE_FILES.matcher(dependency.getFileName());
- 182 3 if (coreCPE.matches() && !coreFiles.matches()) {
- 183 0 itr.remove();
+
+ 176
+
+ 177 2 public static final Pattern CORE_JSF_FILES = Pattern.compile("(^|/)jsf[-][^/]*\\.jar$" );
+ 178
+
+ 179
+
+ 180
+
+ 181
+
+ 182
+
+ 183
+
184
- }
- 185 3 }
- 186 3 }
- 187
-
- 188
-
- 189
-
- 190
-
- 191
-
- 192
-
+ private void removeJreEntries(Dependency dependency) {
+ 185 6 final Set<Identifier> identifiers = dependency.getIdentifiers();
+ 186 6 final Iterator<Identifier> itr = identifiers.iterator();
+ 187 12 while (itr.hasNext()) {
+ 188 6 final Identifier i = itr.next();
+ 189 6 final Matcher coreCPE = CORE_JAVA.matcher(i.getValue());
+ 190 6 final Matcher coreFiles = CORE_FILES.matcher(dependency.getFileName());
+ 191 6 if (coreCPE.matches() && !coreFiles.matches()) {
+ 192 0 itr.remove();
193
-
- 194
-
- 195
- private VulnerableSoftware parseCpe(String type, String value) {
- 196 3 if (!"cpe" .equals(type)) {
- 197 0 return null ;
+ }
+ 194 6 final Matcher coreJsfCPE = CORE_JAVA_JSF.matcher(i.getValue());
+ 195 6 final Matcher coreJsfFiles = CORE_JSF_FILES.matcher(dependency.getFileName());
+ 196 6 if (coreJsfCPE.matches() && !coreJsfFiles.matches()) {
+ 197 0 itr.remove();
198
- }
- 199 3 final VulnerableSoftware cpe = new VulnerableSoftware();
- 200
- try {
- 201 3 cpe.parseName(value);
- 202 0 } catch (UnsupportedEncodingException ex) {
- 203 0 LOGGER.log(Level.FINEST, null , ex);
- 204 0 return null ;
- 205 3 }
- 206 3 return cpe;
+ }
+ 199 6 }
+ 200 6 }
+ 201
+
+ 202
+
+ 203
+
+ 204
+
+ 205
+
+ 206
+
207
- }
+
208
-
+
209
-
- 210
-
- 211
-
+ private VulnerableSoftware parseCpe(String type, String value) {
+ 210 6 if (!"cpe" .equals(type)) {
+ 211 0 return null ;
212
-
- 213
-
+ }
+ 213 6 final VulnerableSoftware cpe = new VulnerableSoftware();
214
-
- 215
- private void removeBadMatches(Dependency dependency) {
- 216 3 final Set<Identifier> identifiers = dependency.getIdentifiers();
- 217 3 final Iterator<Identifier> itr = identifiers.iterator();
- 218
-
- 219
-
- 220
-
+ try {
+ 215 6 cpe.parseName(value);
+ 216 0 } catch (UnsupportedEncodingException ex) {
+ 217 0 LOGGER.log(Level.FINEST, null , ex);
+ 218 0 return null ;
+ 219 6 }
+ 220 6 return cpe;
221
-
+ }
222
-
+
223
-
+
224
-
+
225
-
- 226 6 while (itr.hasNext()) {
- 227 3 final Identifier i = itr.next();
- 228
-
- 229 3 if ("cpe" .equals(i.getType())) {
- 230 3 if ((i.getValue().matches(".*c\\+\\+.*" )
- 231
- || i.getValue().startsWith("cpe:/a:file:file" )
- 232
- || i.getValue().startsWith("cpe:/a:mozilla:mozilla" )
- 233
- || i.getValue().startsWith("cpe:/a:cvs:cvs" )
- 234
- || i.getValue().startsWith("cpe:/a:ftp:ftp" )
- 235
- || i.getValue().startsWith("cpe:/a:tcp:tcp" )
- 236
- || i.getValue().startsWith("cpe:/a:ssh:ssh" )
- 237
- || i.getValue().startsWith("cpe:/a:lookup:lookup" ))
- 238
- && (dependency.getFileName().toLowerCase().endsWith(".jar" )
- 239
- || dependency.getFileName().toLowerCase().endsWith("pom.xml" )
- 240
- || dependency.getFileName().toLowerCase().endsWith(".dll" )
- 241
- || dependency.getFileName().toLowerCase().endsWith(".exe" )
- 242
- || dependency.getFileName().toLowerCase().endsWith(".nuspec" )
- 243
- || dependency.getFileName().toLowerCase().endsWith(".nupkg" ))) {
- 244 1 itr.remove();
- 245 2 } else if ((i.getValue().startsWith("cpe:/a:jquery:jquery" )
- 246
- || i.getValue().startsWith("cpe:/a:prototypejs:prototype" )
- 247
- || i.getValue().startsWith("cpe:/a:yahoo:yui" ))
- 248
- && (dependency.getFileName().toLowerCase().endsWith(".jar" )
- 249
- || dependency.getFileName().toLowerCase().endsWith("pom.xml" )
- 250
- || dependency.getFileName().toLowerCase().endsWith(".dll" )
- 251
- || dependency.getFileName().toLowerCase().endsWith(".exe" ))) {
- 252 0 itr.remove();
- 253 2 } else if (i.getValue().startsWith("cpe:/a:apache:maven" )
- 254
- && !dependency.getFileName().toLowerCase().matches("maven-core-[\\d\\.]+\\.jar" )) {
- 255 0 itr.remove();
- 256 2 } else if (i.getValue().startsWith("cpe:/a:m-core:m-core" )
- 257
- && !dependency.getEvidenceUsed().containsUsedString("m-core" )) {
- 258 0 itr.remove();
- 259 2 } else if (i.getValue().startsWith("cpe:/a:jboss:jboss" )
- 260
- && !dependency.getFileName().toLowerCase().matches("jboss-?[\\d\\.-]+(GA)?\\.jar" )) {
- 261 0 itr.remove();
- 262
- }
- 263
- }
- 264 3 }
- 265 3 }
- 266
-
- 267
-
- 268
-
- 269
+
+ 226
- 270
+ 227
+ 228
+
+ 229
+ private void removeBadMatches(Dependency dependency) {
+ 230 6 final Set<Identifier> identifiers = dependency.getIdentifiers();
+ 231 6 final Iterator<Identifier> itr = identifiers.iterator();
+ 232
+
+ 233
+
+ 234
+
+ 235
+
+ 236
+
+ 237
+
+ 238
+
+ 239
+
+ 240 12 while (itr.hasNext()) {
+ 241 6 final Identifier i = itr.next();
+ 242
+
+ 243 6 if ("cpe" .equals(i.getType())) {
+ 244 6 if ((i.getValue().matches(".*c\\+\\+.*" )
+ 245
+ || i.getValue().startsWith("cpe:/a:file:file" )
+ 246
+ || i.getValue().startsWith("cpe:/a:mozilla:mozilla" )
+ 247
+ || i.getValue().startsWith("cpe:/a:cvs:cvs" )
+ 248
+ || i.getValue().startsWith("cpe:/a:ftp:ftp" )
+ 249
+ || i.getValue().startsWith("cpe:/a:tcp:tcp" )
+ 250
+ || i.getValue().startsWith("cpe:/a:ssh:ssh" )
+ 251
+ || i.getValue().startsWith("cpe:/a:lookup:lookup" ))
+ 252
+ && (dependency.getFileName().toLowerCase().endsWith(".jar" )
+ 253
+ || dependency.getFileName().toLowerCase().endsWith("pom.xml" )
+ 254
+ || dependency.getFileName().toLowerCase().endsWith(".dll" )
+ 255
+ || dependency.getFileName().toLowerCase().endsWith(".exe" )
+ 256
+ || dependency.getFileName().toLowerCase().endsWith(".nuspec" )
+ 257
+ || dependency.getFileName().toLowerCase().endsWith(".nupkg" ))) {
+ 258 2 itr.remove();
+ 259 4 } else if ((i.getValue().startsWith("cpe:/a:jquery:jquery" )
+ 260
+ || i.getValue().startsWith("cpe:/a:prototypejs:prototype" )
+ 261
+ || i.getValue().startsWith("cpe:/a:yahoo:yui" ))
+ 262
+ && (dependency.getFileName().toLowerCase().endsWith(".jar" )
+ 263
+ || dependency.getFileName().toLowerCase().endsWith("pom.xml" )
+ 264
+ || dependency.getFileName().toLowerCase().endsWith(".dll" )
+ 265
+ || dependency.getFileName().toLowerCase().endsWith(".exe" ))) {
+ 266 0 itr.remove();
+ 267 4 } else if ((i.getValue().startsWith("cpe:/a:microsoft:excel" )
+ 268
+ || i.getValue().startsWith("cpe:/a:microsoft:word" )
+ 269
+ || i.getValue().startsWith("cpe:/a:microsoft:visio" )
+ 270
+ || i.getValue().startsWith("cpe:/a:microsoft:powerpoint" )
271
-
+ || i.getValue().startsWith("cpe:/a:microsoft:office" ))
272
- private void removeWrongVersionMatches(Dependency dependency) {
- 273 3 final Set<Identifier> identifiers = dependency.getIdentifiers();
- 274 3 final Iterator<Identifier> itr = identifiers.iterator();
- 275
-
- 276 3 final String fileName = dependency.getFileName();
- 277 3 if (fileName != null && fileName.contains("axis2" )) {
- 278 0 while (itr.hasNext()) {
- 279 0 final Identifier i = itr.next();
- 280 0 if ("cpe" .equals(i.getType())) {
- 281 0 final String cpe = i.getValue();
- 282 0 if (cpe != null && (cpe.startsWith("cpe:/a:apache:axis:" ) || "cpe:/a:apache:axis" .equals(cpe))) {
- 283 0 itr.remove();
+ && (dependency.getFileName().toLowerCase().endsWith(".jar" )
+ 273
+ || dependency.getFileName().toLowerCase().endsWith("pom.xml" ))) {
+ 274 0 itr.remove();
+ 275 4 } else if (i.getValue().startsWith("cpe:/a:apache:maven" )
+ 276
+ && !dependency.getFileName().toLowerCase().matches("maven-core-[\\d\\.]+\\.jar" )) {
+ 277 0 itr.remove();
+ 278 4 } else if (i.getValue().startsWith("cpe:/a:m-core:m-core" )
+ 279
+ && !dependency.getEvidenceUsed().containsUsedString("m-core" )) {
+ 280 0 itr.remove();
+ 281 4 } else if (i.getValue().startsWith("cpe:/a:jboss:jboss" )
+ 282
+ && !dependency.getFileName().toLowerCase().matches("jboss-?[\\d\\.-]+(GA)?\\.jar" )) {
+ 283 0 itr.remove();
284
- }
+ }
285
- }
- 286 0 }
- 287 3 } else if (fileName != null && fileName.contains("axis" )) {
- 288 0 while (itr.hasNext()) {
- 289 0 final Identifier i = itr.next();
- 290 0 if ("cpe" .equals(i.getType())) {
- 291 0 final String cpe = i.getValue();
- 292 0 if (cpe != null && (cpe.startsWith("cpe:/a:apache:axis2:" ) || "cpe:/a:apache:axis2" .equals(cpe))) {
- 293 0 itr.remove();
+ }
+ 286 6 }
+ 287 6 }
+ 288
+
+ 289
+
+ 290
+
+ 291
+
+ 292
+
+ 293
+
294
- }
- 295
- }
- 296 0 }
+ private void removeWrongVersionMatches(Dependency dependency) {
+ 295 6 final Set<Identifier> identifiers = dependency.getIdentifiers();
+ 296 6 final Iterator<Identifier> itr = identifiers.iterator();
297
- }
- 298 3 }
- 299
- 300
-
- 301
-
- 302
-
- 303
-
- 304
-
- 305
-
+ 298 6 final String fileName = dependency.getFileName();
+ 299 6 if (fileName != null && fileName.contains("axis2" )) {
+ 300 0 while (itr.hasNext()) {
+ 301 0 final Identifier i = itr.next();
+ 302 0 if ("cpe" .equals(i.getType())) {
+ 303 0 final String cpe = i.getValue();
+ 304 0 if (cpe != null && (cpe.startsWith("cpe:/a:apache:axis:" ) || "cpe:/a:apache:axis" .equals(cpe))) {
+ 305 0 itr.remove();
306
-
- 307
- private void addFalseNegativeCPEs(Dependency dependency) {
- 308
-
- 309 3 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator();
- 310 5 while (itr.hasNext()) {
- 311 2 final Identifier i = itr.next();
- 312 2 if ("cpe" .equals(i.getType()) && i.getValue() != null
- 313
- && (i.getValue().startsWith("cpe:/a:oracle:opensso:" )
- 314
- || i.getValue().startsWith("cpe:/a:oracle:opensso_enterprise:" )
- 315
- || i.getValue().startsWith("cpe:/a:sun:opensso_enterprise:" )
- 316
- || i.getValue().startsWith("cpe:/a:sun:opensso:" ))) {
- 317 0 final String newCpe = String.format("cpe:/a:sun:opensso_enterprise:%s" , i.getValue().substring(22));
- 318 0 final String newCpe2 = String.format("cpe:/a:oracle:opensso_enterprise:%s" , i.getValue().substring(22));
- 319 0 final String newCpe3 = String.format("cpe:/a:sun:opensso:%s" , i.getValue().substring(22));
- 320 0 final String newCpe4 = String.format("cpe:/a:oracle:opensso:%s" , i.getValue().substring(22));
- 321
- try {
- 322 0 dependency.addIdentifier("cpe" ,
- 323
- newCpe,
- 324
- String.format(CPEAnalyzer.NVD_SEARCH_URL, URLEncoder.encode(newCpe, "UTF-8" )));
- 325 0 dependency.addIdentifier("cpe" ,
- 326
- newCpe2,
- 327
- String.format(CPEAnalyzer.NVD_SEARCH_URL, URLEncoder.encode(newCpe2, "UTF-8" )));
- 328 0 dependency.addIdentifier("cpe" ,
- 329
- newCpe3,
- 330
- String.format(CPEAnalyzer.NVD_SEARCH_URL, URLEncoder.encode(newCpe3, "UTF-8" )));
- 331 0 dependency.addIdentifier("cpe" ,
- 332
- newCpe4,
- 333
- String.format(CPEAnalyzer.NVD_SEARCH_URL, URLEncoder.encode(newCpe4, "UTF-8" )));
- 334 0 } catch (UnsupportedEncodingException ex) {
- 335 0 LOGGER.log(Level.FINE, null , ex);
- 336 0 }
- 337
- }
- 338 2 }
- 339 3 }
- 340
-
- 341
-
- 342
-
- 343
-
- 344
-
- 345
-
- 346
-
- 347
-
- 348
- private void removeDuplicativeEntriesFromJar(Dependency dependency, Engine engine) {
- 349 3 if (dependency.getFileName().toLowerCase().endsWith("pom.xml" )
- 350
- || "dll" .equals(dependency.getFileExtension())
- 351
- || "exe" .equals(dependency.getFileExtension())) {
- 352 1 String parentPath = dependency.getFilePath().toLowerCase();
- 353 1 if (parentPath.contains(".jar" )) {
- 354 0 parentPath = parentPath.substring(0, parentPath.indexOf(".jar" ) + 4);
- 355 0 final Dependency parent = findDependency(parentPath, engine.getDependencies());
- 356 0 if (parent != null ) {
- 357 0 boolean remove = false ;
- 358 0 for (Identifier i : dependency.getIdentifiers()) {
- 359 0 if ("cpe" .equals(i.getType())) {
- 360 0 final String trimmedCPE = trimCpeToVendor(i.getValue());
- 361 0 for (Identifier parentId : parent.getIdentifiers()) {
- 362 0 if ("cpe" .equals(parentId.getType()) && parentId.getValue().startsWith(trimmedCPE)) {
- 363 0 remove |= true ;
- 364
- }
- 365 0 }
- 366
- }
- 367 0 if (!remove) {
- 368 0 return ;
- 369
- }
- 370 0 }
- 371 0 if (remove) {
- 372 0 engine.getDependencies().remove(dependency);
- 373
}
- 374
+ 307
}
- 375
- }
- 376
-
- 377
+ 308 0 }
+ 309 6 } else if (fileName != null && fileName.contains("axis" )) {
+ 310 0 while (itr.hasNext()) {
+ 311 0 final Identifier i = itr.next();
+ 312 0 if ("cpe" .equals(i.getType())) {
+ 313 0 final String cpe = i.getValue();
+ 314 0 if (cpe != null && (cpe.startsWith("cpe:/a:apache:axis2:" ) || "cpe:/a:apache:axis2" .equals(cpe))) {
+ 315 0 itr.remove();
+ 316
+ }
+ 317
+ }
+ 318 0 }
+ 319
}
- 378 3 }
- 379
+ 320 6 }
+ 321
- 380
+ 322
- 381
-
- 382
+ 323
+
+ 324
+
+ 325
+
+ 326
- 383
-
- 384
-
- 385
-
+ 327
+
+ 328
+
+ 329
+ private void addFalseNegativeCPEs(Dependency dependency) {
+ 330
+
+ 331 6 final Iterator<Identifier> itr = dependency.getIdentifiers().iterator();
+ 332 10 while (itr.hasNext()) {
+ 333 4 final Identifier i = itr.next();
+ 334 4 if ("cpe" .equals(i.getType()) && i.getValue() != null
+ 335
+ && (i.getValue().startsWith("cpe:/a:oracle:opensso:" )
+ 336
+ || i.getValue().startsWith("cpe:/a:oracle:opensso_enterprise:" )
+ 337
+ || i.getValue().startsWith("cpe:/a:sun:opensso_enterprise:" )
+ 338
+ || i.getValue().startsWith("cpe:/a:sun:opensso:" ))) {
+ 339 0 final String newCpe = String.format("cpe:/a:sun:opensso_enterprise:%s" , i.getValue().substring(22));
+ 340 0 final String newCpe2 = String.format("cpe:/a:oracle:opensso_enterprise:%s" , i.getValue().substring(22));
+ 341 0 final String newCpe3 = String.format("cpe:/a:sun:opensso:%s" , i.getValue().substring(22));
+ 342 0 final String newCpe4 = String.format("cpe:/a:oracle:opensso:%s" , i.getValue().substring(22));
+ 343
+ try {
+ 344 0 dependency.addIdentifier("cpe" ,
+ 345
+ newCpe,
+ 346
+ String.format(CPEAnalyzer.NVD_SEARCH_URL, URLEncoder.encode(newCpe, "UTF-8" )));
+ 347 0 dependency.addIdentifier("cpe" ,
+ 348
+ newCpe2,
+ 349
+ String.format(CPEAnalyzer.NVD_SEARCH_URL, URLEncoder.encode(newCpe2, "UTF-8" )));
+ 350 0 dependency.addIdentifier("cpe" ,
+ 351
+ newCpe3,
+ 352
+ String.format(CPEAnalyzer.NVD_SEARCH_URL, URLEncoder.encode(newCpe3, "UTF-8" )));
+ 353 0 dependency.addIdentifier("cpe" ,
+ 354
+ newCpe4,
+ 355
+ String.format(CPEAnalyzer.NVD_SEARCH_URL, URLEncoder.encode(newCpe4, "UTF-8" )));
+ 356 0 } catch (UnsupportedEncodingException ex) {
+ 357 0 LOGGER.log(Level.FINE, null , ex);
+ 358 0 }
+ 359
+ }
+ 360 4 }
+ 361 6 }
+ 362
+
+ 363
+
+ 364
+
+ 365
+
+ 366
+
+ 367
+
+ 368
+
+ 369
+
+ 370
+ private void removeDuplicativeEntriesFromJar(Dependency dependency, Engine engine) {
+ 371 6 if (dependency.getFileName().toLowerCase().endsWith("pom.xml" )
+ 372
+ || "dll" .equals(dependency.getFileExtension())
+ 373
+ || "exe" .equals(dependency.getFileExtension())) {
+ 374 2 String parentPath = dependency.getFilePath().toLowerCase();
+ 375 2 if (parentPath.contains(".jar" )) {
+ 376 0 parentPath = parentPath.substring(0, parentPath.indexOf(".jar" ) + 4);
+ 377 0 final Dependency parent = findDependency(parentPath, engine.getDependencies());
+ 378 0 if (parent != null ) {
+ 379 0 boolean remove = false ;
+ 380 0 for (Identifier i : dependency.getIdentifiers()) {
+ 381 0 if ("cpe" .equals(i.getType())) {
+ 382 0 final String trimmedCPE = trimCpeToVendor(i.getValue());
+ 383 0 for (Identifier parentId : parent.getIdentifiers()) {
+ 384 0 if ("cpe" .equals(parentId.getType()) && parentId.getValue().startsWith(trimmedCPE)) {
+ 385 0 remove |= true ;
386
-
- 387
- private Dependency findDependency(String dependencyPath, List<Dependency> dependencies) {
- 388 0 for (Dependency d : dependencies) {
- 389 0 if (d.getFilePath().equalsIgnoreCase(dependencyPath)) {
- 390 0 return d;
+ }
+ 387 0 }
+ 388
+ }
+ 389 0 if (!remove) {
+ 390 0 return ;
391
- }
- 392 0 }
- 393 0 return null ;
- 394
- }
+ }
+ 392 0 }
+ 393 0 if (remove) {
+ 394 0 engine.getDependencies().remove(dependency);
395
-
+ }
396
-
+ }
397
-
+ }
398
-
+
399
-
- 400
-
- 401
-
- 402
- private String trimCpeToVendor(String value) {
- 403
-
- 404 0 final int pos1 = value.indexOf(":" , 7);
- 405 0 final int pos2 = value.indexOf(":" , pos1 + 1);
- 406 0 if (pos2 < 0) {
- 407 0 return value;
- 408
- } else {
- 409 0 return value.substring(0, pos2);
- 410
}
- 411
+ 400 6 }
+ 401
+
+ 402
+
+ 403
+
+ 404
+
+ 405
+
+ 406
+
+ 407
+
+ 408
+
+ 409
+ private Dependency findDependency(String dependencyPath, List<Dependency> dependencies) {
+ 410 0 for (Dependency d : dependencies) {
+ 411 0 if (d.getFilePath().equalsIgnoreCase(dependencyPath)) {
+ 412 0 return d;
+ 413
+ }
+ 414 0 }
+ 415 0 return null ;
+ 416
}
- 412
+ 417
+
+ 418
+
+ 419
+
+ 420
+
+ 421
+
+ 422
+
+ 423
+
+ 424
+ private String trimCpeToVendor(String value) {
+ 425
+
+ 426 0 final int pos1 = value.indexOf(":" , 7);
+ 427 0 final int pos2 = value.indexOf(":" , pos1 + 1);
+ 428 0 if (pos2 < 0) {
+ 429 0 return value;
+ 430
+ } else {
+ 431 0 return value.substring(0, pos2);
+ 432
+ }
+ 433
+ }
+ 434
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FileNameAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FileNameAnalyzer.html
index 881f8b14c..26e799abb 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FileNameAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FileNameAnalyzer.html
@@ -103,7 +103,7 @@
43
- 44 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
+ 44 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
45
46
@@ -118,7 +118,7 @@
51
public String getName() {
- 52 5 return ANALYZER_NAME;
+ 52 10 return ANALYZER_NAME;
53
}
54
@@ -135,7 +135,7 @@
60
public AnalysisPhase getAnalysisPhase() {
- 61 2 return ANALYSIS_PHASE;
+ 61 4 return ANALYSIS_PHASE;
62
}
63
@@ -164,41 +164,41 @@
75
- 76 4 final File f = new File(dependency.getFileName());
- 77 4 String fileName = f.getName();
+ 76 8 final File f = new File(dependency.getFileName());
+ 77 8 String fileName = f.getName();
78
79
- 80 4 final int pos = fileName.lastIndexOf("." );
- 81 4 if (pos > 0) {
- 82 4 fileName = fileName.substring(0, pos);
+ 80 8 final int pos = fileName.lastIndexOf("." );
+ 81 8 if (pos > 0) {
+ 82 8 fileName = fileName.substring(0, pos);
83
}
84
85
- 86 4 final DependencyVersion version = DependencyVersionUtil.parseVersion(fileName);
- 87 4 if (version != null ) {
+ 86 8 final DependencyVersion version = DependencyVersionUtil.parseVersion(fileName);
+ 87 8 if (version != null ) {
88
89
90
- 91 4 if (version.getVersionParts() == null || version.getVersionParts().size() < 2) {
+ 91 8 if (version.getVersionParts() == null || version.getVersionParts().size() < 2) {
92 0 dependency.getVersionEvidence().addEvidence("file" , "name" ,
93
version.toString(), Confidence.MEDIUM);
94
} else {
- 95 4 dependency.getVersionEvidence().addEvidence("file" , "name" ,
+ 95 8 dependency.getVersionEvidence().addEvidence("file" , "name" ,
96
version.toString(), Confidence.HIGHEST);
97
}
- 98 4 dependency.getVersionEvidence().addEvidence("file" , "name" ,
+ 98 8 dependency.getVersionEvidence().addEvidence("file" , "name" ,
99
fileName, Confidence.MEDIUM);
100
@@ -207,11 +207,11 @@
102
- 103 4 if (fileName.contains("-" )) {
- 104 4 dependency.getProductEvidence().addEvidence("file" , "name" ,
+ 103 8 if (fileName.contains("-" )) {
+ 104 8 dependency.getProductEvidence().addEvidence("file" , "name" ,
105
fileName, Confidence.HIGHEST);
- 106 4 dependency.getVendorEvidence().addEvidence("file" , "name" ,
+ 106 8 dependency.getVendorEvidence().addEvidence("file" , "name" ,
107
fileName, Confidence.HIGHEST);
108
@@ -224,11 +224,11 @@
fileName, Confidence.HIGH);
113
}
- 114 4 }
+ 114 8 }
115
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FileTypeAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FileTypeAnalyzer.html
index 9ed8d56e2..1ac81c08e 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FileTypeAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.FileTypeAnalyzer.html
@@ -87,6 +87,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.HintAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.HintAnalyzer.html
index b65bdf27c..21dc71037 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.HintAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.HintAnalyzer.html
@@ -101,7 +101,7 @@
42
- 43 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.PRE_IDENTIFIER_ANALYSIS;
+ 43 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.PRE_IDENTIFIER_ANALYSIS;
44
45
@@ -118,7 +118,7 @@
@Override
51
public String getName() {
- 52 5 return ANALYZER_NAME;
+ 52 10 return ANALYZER_NAME;
53
}
54
@@ -137,7 +137,7 @@
@Override
61
public AnalysisPhase getAnalysisPhase() {
- 62 2 return ANALYSIS_PHASE;
+ 62 4 return ANALYSIS_PHASE;
63
}
64
@@ -164,7 +164,7 @@
@Override
75
public void analyze(Dependency dependency, Engine engine) throws AnalysisException {
- 76 2 final Evidence springTest1 = new Evidence("Manifest" ,
+ 76 4 final Evidence springTest1 = new Evidence("Manifest" ,
77
"Implementation-Title" ,
78
@@ -173,7 +173,7 @@
Confidence.HIGH);
80
- 81 2 final Evidence springTest2 = new Evidence("Manifest" ,
+ 81 4 final Evidence springTest2 = new Evidence("Manifest" ,
82
"Implementation-Title" ,
83
@@ -182,7 +182,7 @@
Confidence.HIGH);
85
- 86 2 final Evidence springTest3 = new Evidence("Manifest" ,
+ 86 4 final Evidence springTest3 = new Evidence("Manifest" ,
87
"Bundle-Vendor" ,
88
@@ -191,26 +191,26 @@
Confidence.HIGH);
90
- 91 2 Set<Evidence> evidence = dependency.getProductEvidence().getEvidence();
- 92 2 if (evidence.contains(springTest1) || evidence.contains(springTest2)) {
- 93 1 dependency.getProductEvidence().addEvidence("hint analyzer" , "product" , "springsource_spring_framework" , Confidence.HIGH);
- 94 1 dependency.getVendorEvidence().addEvidence("hint analyzer" , "vendor" , "SpringSource" , Confidence.HIGH);
- 95 1 dependency.getVendorEvidence().addEvidence("hint analyzer" , "vendor" , "vmware" , Confidence.HIGH);
+ 91 4 Set<Evidence> evidence = dependency.getProductEvidence().getEvidence();
+ 92 4 if (evidence.contains(springTest1) || evidence.contains(springTest2)) {
+ 93 2 dependency.getProductEvidence().addEvidence("hint analyzer" , "product" , "springsource_spring_framework" , Confidence.HIGH);
+ 94 2 dependency.getVendorEvidence().addEvidence("hint analyzer" , "vendor" , "SpringSource" , Confidence.HIGH);
+ 95 2 dependency.getVendorEvidence().addEvidence("hint analyzer" , "vendor" , "vmware" , Confidence.HIGH);
96
}
97
- 98 2 evidence = dependency.getVendorEvidence().getEvidence();
- 99 2 if (evidence.contains(springTest3)) {
- 100 1 dependency.getProductEvidence().addEvidence("hint analyzer" , "product" , "springsource_spring_framework" , Confidence.HIGH);
- 101 1 dependency.getVendorEvidence().addEvidence("hint analyzer" , "vendor" , "vmware" , Confidence.HIGH);
+ 98 4 evidence = dependency.getVendorEvidence().getEvidence();
+ 99 4 if (evidence.contains(springTest3)) {
+ 100 2 dependency.getProductEvidence().addEvidence("hint analyzer" , "product" , "springsource_spring_framework" , Confidence.HIGH);
+ 101 2 dependency.getVendorEvidence().addEvidence("hint analyzer" , "vendor" , "vmware" , Confidence.HIGH);
102
}
- 103 2 final Iterator<Evidence> itr = dependency.getVendorEvidence().iterator();
- 104 2 final ArrayList<Evidence> newEntries = new ArrayList<Evidence>();
- 105 27 while (itr.hasNext()) {
- 106 25 final Evidence e = itr.next();
- 107 25 if ("sun" .equalsIgnoreCase(e.getValue(false ))) {
+ 103 4 final Iterator<Evidence> itr = dependency.getVendorEvidence().iterator();
+ 104 4 final ArrayList<Evidence> newEntries = new ArrayList<Evidence>();
+ 105 54 while (itr.hasNext()) {
+ 106 50 final Evidence e = itr.next();
+ 107 50 if ("sun" .equalsIgnoreCase(e.getValue(false ))) {
108 0 final Evidence newEvidence = new Evidence(e.getSource() + " (hint)" , e.getName(), "oracle" , e.getConfidence());
109 0 newEntries.add(newEvidence);
110 0 } else if ("oracle" .equalsIgnoreCase(e.getValue(false ))) {
@@ -218,17 +218,17 @@
112 0 newEntries.add(newEvidence);
113
}
- 114 25 }
- 115 2 for (Evidence e : newEntries) {
+ 114 50 }
+ 115 4 for (Evidence e : newEntries) {
116 0 dependency.getVendorEvidence().addEvidence(e);
117 0 }
118
- 119 2 }
+ 119 4 }
120
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.JarAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.JarAnalyzer.html
index 8aaccea4d..ebbb1f86a 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.JarAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.JarAnalyzer.html
@@ -12,8 +12,8 @@
@@ -151,2026 +151,1976 @@
66
import org.owasp.dependencycheck.jaxb.pom.generated.Organization;
67
- import org.owasp.dependencycheck.jaxb.pom.generated.Parent;
- 68
import org.owasp.dependencycheck.utils.FileUtils;
- 69
+ 68
import org.owasp.dependencycheck.utils.NonClosingStream;
- 70
+ 69
import org.owasp.dependencycheck.utils.Settings;
- 71
+ 70
import org.xml.sax.InputSource;
- 72
+ 71
import org.xml.sax.SAXException;
- 73
+ 72
import org.xml.sax.XMLFilter;
- 74
+ 73
import org.xml.sax.XMLReader;
- 75
+ 74
- 76
+ 75
+ 76
+
77
78
-
- 79
-
- 80
- 81
+ 79
- 82
+ 80
public class JarAnalyzer extends AbstractFileTypeAnalyzer {
- 83
+ 81
- 84
+ 82
- 85
+ 83
- 86
+ 84
+ 85
+
+ 86 2 private static final Logger LOGGER = Logger.getLogger(JarAnalyzer.class .getName());
87
-
- 88 1 private static final Logger LOGGER = Logger.getLogger(JarAnalyzer.class .getName());
- 89
- 90
+ 88
- 91
+ 89
- 92
+ 90
private static final int BUFFER_SIZE = 4096;
- 93
+ 91
- 94
+ 92
+ 93
+
+ 94 2 private static int dirCount = 0;
95
-
- 96 1 private static int dirCount = 0;
- 97
- 98
+ 96
+ 97
+
+ 98 2 private static final String NEWLINE = System.getProperty("line.separator" );
99
-
- 100 1 private static final String NEWLINE = System.getProperty("line.separator" );
- 101
- 102
+ 100
+ 101
+
+ 102 2 private static final Set<String> IGNORE_VALUES = newHashSet(
103
-
- 104 1 private static final Set<String> IGNORE_VALUES = newHashSet(
- 105
"Sun Java System Application Server" );
- 106
+ 104
- 107
+ 105
+ 106
+
+ 107 2 private static final Set<String> IGNORE_KEYS = newHashSet(
108
-
- 109 1 private static final Set<String> IGNORE_KEYS = newHashSet(
- 110
"built-by" ,
- 111
+ 109
"created-by" ,
- 112
+ 110
"builtby" ,
- 113
+ 111
"createdby" ,
- 114
+ 112
"build-jdk" ,
- 115
+ 113
"buildjdk" ,
- 116
+ 114
"ant-version" ,
- 117
+ 115
"antversion" ,
- 118
+ 116
"dynamicimportpackage" ,
- 119
+ 117
"dynamicimport-package" ,
- 120
+ 118
"dynamic-importpackage" ,
- 121
+ 119
"dynamic-import-package" ,
- 122
+ 120
"import-package" ,
- 123
+ 121
"ignore-package" ,
- 124
+ 122
"export-package" ,
- 125
+ 123
"importpackage" ,
- 126
+ 124
"ignorepackage" ,
- 127
+ 125
"exportpackage" ,
- 128
+ 126
"sealed" ,
- 129
+ 127
"manifest-version" ,
- 130
+ 128
"archiver-version" ,
- 131
+ 129
"manifestversion" ,
- 132
+ 130
"archiverversion" ,
- 133
+ 131
"classpath" ,
- 134
+ 132
"class-path" ,
- 135
+ 133
"tool" ,
- 136
+ 134
"bundle-manifestversion" ,
- 137
+ 135
"bundlemanifestversion" ,
- 138
+ 136
"include-resource" ,
- 139
+ 137
"embed-dependency" ,
- 140
+ 138
"ipojo-components" ,
- 141
+ 139
"ipojo-extension" ,
- 142
+ 140
"eclipse-sourcereferences" );
+ 141
+
+ 142
+
143
-
+
144
-
- 145
-
- 146
private static final String BUNDLE_VERSION = "Bundle-Version" ;
+ 145
+
+ 146
+
147
-
+
148
-
- 149
-
- 150
private static final String BUNDLE_DESCRIPTION = "Bundle-Description" ;
+ 149
+
+ 150
+
151
-
+
152
-
- 153
-
- 154
private static final String BUNDLE_NAME = "Bundle-Name" ;
- 155
+ 153
- 156
+ 154
- 157
+ 155
- 158
+ 156
private static final String BUNDLE_VENDOR = "Bundle-Vendor" ;
- 159
+ 157
- 160
+ 158
+ 159
+
+ 160 2 private static final Pattern HTML_DETECTION_PATTERN = Pattern.compile("\\<[a-z]+.*/?\\>" , Pattern.CASE_INSENSITIVE);
161
-
- 162 1 private static final Pattern HTML_DETECTION_PATTERN = Pattern.compile("\\<[a-z]+.*/?\\>" , Pattern.CASE_INSENSITIVE);
- 163
- 164
+ 162
- 165
+ 163
- 166
+ 164
private Unmarshaller pomUnmarshaller;
+ 165
+
+ 166
+
167
-
+
168
-
- 169
-
- 170
+ 169
+
+ 170 14 public JarAnalyzer() {
171
-
- 172 7 public JarAnalyzer() {
- 173
try {
- 174 7 final JAXBContext jaxbContext = JAXBContext.newInstance("org.owasp.dependencycheck.jaxb.pom.generated" );
- 175 7 pomUnmarshaller = jaxbContext.createUnmarshaller();
- 176 0 } catch (JAXBException ex) {
- 177 0 LOGGER.log(Level.SEVERE, "Unable to load parser. See the log for more details." );
- 178 0 LOGGER.log(Level.FINE, null , ex);
- 179 7 }
- 180 7 }
- 181
+ 172 14 final JAXBContext jaxbContext = JAXBContext.newInstance("org.owasp.dependencycheck.jaxb.pom.generated" );
+ 173 14 pomUnmarshaller = jaxbContext.createUnmarshaller();
+ 174 0 } catch (JAXBException ex) {
+ 175 0 LOGGER.log(Level.SEVERE, "Unable to load parser. See the log for more details." );
+ 176 0 LOGGER.log(Level.FINE, null , ex);
+ 177 14 }
+ 178 14 }
+ 179
- 182
+ 180
- 183
+ 181
- 184
+ 182
- 185
+ 183
- 186
+ 184
private static final String ANALYZER_NAME = "Jar Analyzer" ;
- 187
+ 185
- 188
+ 186
+ 187
+
+ 188 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
189
-
- 190 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
- 191
- 192
+ 190
+ 191
+
+ 192 2 private static final Set<String> EXTENSIONS = newHashSet("jar" , "war" );
193
-
- 194 1 private static final Set<String> EXTENSIONS = newHashSet("jar" , "war" );
+
+ 194
+
195
-
- 196
-
- 197
- 198
+ 196
- 199
+ 197
+ 198
+
+ 199
+ @Override
200
-
- 201
- @Override
- 202
public Set<String> getSupportedExtensions() {
- 203 852 return EXTENSIONS;
+ 201 1704 return EXTENSIONS;
+ 202
+ }
+ 203
+
204
- }
+
205
-
- 206
-
- 207
- 208
+ 206
- 209
+ 207
+ 208
+
+ 209
+ @Override
210
-
- 211
- @Override
- 212
public String getName() {
- 213 5 return ANALYZER_NAME;
+ 211 10 return ANALYZER_NAME;
+ 212
+ }
+ 213
+
214
- }
+
215
-
- 216
-
- 217
- 218
+ 216
- 219
+ 217
- 220
+ 218
- 221
+ 219
public AnalysisPhase getAnalysisPhase() {
- 222 1 return ANALYSIS_PHASE;
- 223
+ 220 2 return ANALYSIS_PHASE;
+ 221
}
- 224
+ 222
+ 223
+
+ 224
+
225
-
- 226
-
- 227
- 228
+ 226
- 229
+ 227
+ 228
+
+ 229
+ @Override
230
-
- 231
- @Override
- 232
protected String getAnalyzerEnabledSettingKey() {
- 233 7 return Settings.KEYS.ANALYZER_JAR_ENABLED;
+ 231 14 return Settings.KEYS.ANALYZER_JAR_ENABLED;
+ 232
+ }
+ 233
+
234
- }
+
235
-
- 236
-
- 237
- 238
+ 236
- 239
+ 237
- 240
+ 238
- 241
+ 239
- 242
+ 240
- 243
+ 241
- 244
+ 242
@Override
- 245
+ 243
public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException {
- 246
+ 244
try {
- 247 5 final ArrayList<ClassNameInformation> classNames = collectClassNames(dependency);
- 248 5 final String fileName = dependency.getFileName().toLowerCase();
- 249 5 if (classNames.isEmpty()
- 250
+ 245 10 final ArrayList<ClassNameInformation> classNames = collectClassNames(dependency);
+ 246 10 final String fileName = dependency.getFileName().toLowerCase();
+ 247 10 if (classNames.isEmpty()
+ 248
&& (fileName.endsWith("-sources.jar" )
- 251
+ 249
|| fileName.endsWith("-javadoc.jar" )
- 252
+ 250
|| fileName.endsWith("-src.jar" )
- 253
+ 251
|| fileName.endsWith("-doc.jar" ))) {
- 254 0 engine.getDependencies().remove(dependency);
- 255
+ 252 0 engine.getDependencies().remove(dependency);
+ 253
}
- 256 5 final boolean hasManifest = parseManifest(dependency, classNames);
- 257 5 final boolean hasPOM = analyzePOM(dependency, classNames, engine);
- 258 5 final boolean addPackagesAsEvidence = !(hasManifest && hasPOM);
- 259 5 analyzePackageNames(classNames, dependency, addPackagesAsEvidence);
- 260 0 } catch (IOException ex) {
- 261 0 throw new AnalysisException("Exception occurred reading the JAR file." , ex);
- 262 5 }
- 263 5 }
+ 254 10 final boolean hasManifest = parseManifest(dependency, classNames);
+ 255 10 final boolean hasPOM = analyzePOM(dependency, classNames, engine);
+ 256 10 final boolean addPackagesAsEvidence = !(hasManifest && hasPOM);
+ 257 10 analyzePackageNames(classNames, dependency, addPackagesAsEvidence);
+ 258 0 } catch (IOException ex) {
+ 259 0 throw new AnalysisException("Exception occurred reading the JAR file." , ex);
+ 260 10 }
+ 261 10 }
+ 262
+
+ 263
+
264
-
- 265
-
- 266
- 267
+ 265
+ 266
+
+ 267
+
268
-
- 269
-
- 270
- 271
+ 269
- 272
+ 270
- 273
+ 271
- 274
+ 272
- 275
+ 273
protected boolean analyzePOM(Dependency dependency, ArrayList<ClassNameInformation> classes, Engine engine) throws AnalysisException {
- 276 5 boolean foundSomething = false ;
- 277
+ 274 10 boolean foundSomething = false ;
+ 275
final JarFile jar;
- 278
+ 276
try {
- 279 5 jar = new JarFile(dependency.getActualFilePath());
- 280 0 } catch (IOException ex) {
- 281 0 final String msg = String.format("Unable to read JarFile '%s'." , dependency.getActualFilePath());
- 282
+ 277 10 jar = new JarFile(dependency.getActualFilePath());
+ 278 0 } catch (IOException ex) {
+ 279 0 final String msg = String.format("Unable to read JarFile '%s'." , dependency.getActualFilePath());
+ 280
- 283 0 LOGGER.log(Level.WARNING, msg);
- 284 0 LOGGER.log(Level.FINE, "" , ex);
- 285 0 return false ;
- 286 5 }
- 287
+ 281 0 LOGGER.log(Level.WARNING, msg);
+ 282 0 LOGGER.log(Level.FINE, "" , ex);
+ 283 0 return false ;
+ 284 10 }
+ 285
List<String> pomEntries;
- 288
+ 286
try {
- 289 5 pomEntries = retrievePomListing(jar);
- 290 0 } catch (IOException ex) {
- 291 0 final String msg = String.format("Unable to read Jar file entries in '%s'." , dependency.getActualFilePath());
- 292
+ 287 10 pomEntries = retrievePomListing(jar);
+ 288 0 } catch (IOException ex) {
+ 289 0 final String msg = String.format("Unable to read Jar file entries in '%s'." , dependency.getActualFilePath());
+ 290
- 293 0 LOGGER.log(Level.WARNING, msg);
- 294 0 LOGGER.log(Level.FINE, msg, ex);
- 295 0 return false ;
- 296 5 }
- 297 5 if (pomEntries.isEmpty()) {
- 298 4 return false ;
- 299
+ 291 0 LOGGER.log(Level.WARNING, msg);
+ 292 0 LOGGER.log(Level.FINE, msg, ex);
+ 293 0 return false ;
+ 294 10 }
+ 295 10 if (pomEntries.isEmpty()) {
+ 296 8 return false ;
+ 297
}
- 300 1 for (String path : pomEntries) {
- 301 1 Properties pomProperties = null ;
- 302
+ 298 2 for (String path : pomEntries) {
+ 299 2 Properties pomProperties = null ;
+ 300
try {
- 303 1 pomProperties = retrievePomProperties(path, jar);
- 304 0 } catch (IOException ex) {
- 305 0 LOGGER.log(Level.FINEST, "ignore this, failed reading a non-existent pom.properties" , ex);
- 306 1 }
- 307 1 Model pom = null ;
+ 301 2 pomProperties = retrievePomProperties(path, jar);
+ 302 0 } catch (IOException ex) {
+ 303 0 LOGGER.log(Level.FINEST, "ignore this, failed reading a non-existent pom.properties" , ex);
+ 304 2 }
+ 305 2 Model pom = null ;
+ 306
+ try {
+ 307 2 if (pomEntries.size() > 1) {
308
- try {
- 309 1 if (pomEntries.size() > 1) {
- 310
- 311 0 final Dependency newDependency = new Dependency();
- 312 0 pom = extractPom(path, jar, newDependency);
+ 309 0 final Dependency newDependency = new Dependency();
+ 310 0 pom = extractPom(path, jar, newDependency);
+ 311
+
+ 312 0 final String displayPath = String.format("%s%s%s" ,
313
-
- 314 0 final String displayPath = String.format("%s%s%s" ,
- 315
dependency.getFilePath(),
- 316
+ 314
File.separator,
+ 315
+ path);
+ 316 0 final String displayName = String.format("%s%s%s" ,
317
- path);
- 318 0 final String displayName = String.format("%s%s%s" ,
- 319
dependency.getFileName(),
- 320
+ 318
File.separator,
- 321
+ 319
path);
- 322
+ 320
- 323 0 newDependency.setFileName(displayName);
- 324 0 newDependency.setFilePath(displayPath);
- 325 0 addPomEvidence(newDependency, pom, pomProperties);
- 326 0 engine.getDependencies().add(newDependency);
- 327 0 Collections.sort(engine.getDependencies());
- 328 0 } else {
- 329 1 pom = retrievePom(path, jar);
- 330 1 foundSomething |= setPomEvidence(dependency, pom, pomProperties, classes);
- 331
+ 321 0 newDependency.setFileName(displayName);
+ 322 0 newDependency.setFilePath(displayPath);
+ 323 0 setPomEvidence(newDependency, pom, pomProperties, null );
+ 324 0 engine.getDependencies().add(newDependency);
+ 325 0 Collections.sort(engine.getDependencies());
+ 326 0 } else {
+ 327 2 pom = retrievePom(path, jar);
+ 328 2 foundSomething |= setPomEvidence(dependency, pom, pomProperties, classes);
+ 329
}
- 332 0 } catch (AnalysisException ex) {
- 333 0 final String msg = String.format("An error occured while analyzing '%s'." , dependency.getActualFilePath());
- 334 0 LOGGER.log(Level.WARNING, msg);
- 335 0 LOGGER.log(Level.FINE, "" , ex);
- 336 1 }
- 337 1 }
- 338 1 return foundSomething;
+ 330 0 } catch (AnalysisException ex) {
+ 331 0 final String msg = String.format("An error occured while analyzing '%s'." , dependency.getActualFilePath());
+ 332 0 LOGGER.log(Level.WARNING, msg);
+ 333 0 LOGGER.log(Level.FINE, "" , ex);
+ 334 2 }
+ 335 2 }
+ 336 2 return foundSomething;
+ 337
+ }
+ 338
+
339
- }
+
340
-
- 341
-
- 342
- 343
+ 341
- 344
+ 342
- 345
+ 343
- 346
+ 344
- 347
+ 345
- 348
+ 346
- 349
+ 347
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "OS_OPEN_STREAM" ,
- 350
+ 348
justification = "The reader is closed by closing the zipEntry" )
- 351
+ 349
private Properties retrievePomProperties(String path, final JarFile jar) throws IOException {
- 352 1 Properties pomProperties = null ;
- 353 1 final String propPath = path.substring(0, path.length() - 7) + "pom.properies" ;
- 354 1 final ZipEntry propEntry = jar.getEntry(propPath);
- 355 1 if (propEntry != null ) {
- 356 0 final Reader reader = new InputStreamReader(jar.getInputStream(propEntry), "UTF-8" );
- 357 0 pomProperties = new Properties();
- 358 0 pomProperties.load(reader);
+ 350 2 Properties pomProperties = null ;
+ 351 2 final String propPath = path.substring(0, path.length() - 7) + "pom.properies" ;
+ 352 2 final ZipEntry propEntry = jar.getEntry(propPath);
+ 353 2 if (propEntry != null ) {
+ 354 0 final Reader reader = new InputStreamReader(jar.getInputStream(propEntry), "UTF-8" );
+ 355 0 pomProperties = new Properties();
+ 356 0 pomProperties.load(reader);
+ 357
+ }
+ 358 2 return pomProperties;
359
- }
- 360 1 return pomProperties;
+ }
+ 360
+
361
- }
+
362
-
- 363
-
- 364
- 365
+ 363
- 366
+ 364
- 367
+ 365
- 368
+ 366
- 369
+ 367
- 370
+ 368
private List<String> retrievePomListing(final JarFile jar) throws IOException {
- 371 5 final List<String> pomEntries = new ArrayList<String>();
- 372 5 final Enumeration<JarEntry> entries = jar.entries();
- 373 1848 while (entries.hasMoreElements()) {
- 374 1843 final JarEntry entry = entries.nextElement();
- 375 1843 final String entryName = (new File(entry.getName())).getName().toLowerCase();
- 376 1843 if (!entry.isDirectory() && "pom.xml" .equals(entryName)) {
- 377 1 pomEntries.add(entry.getName());
- 378
+ 369 10 final List<String> pomEntries = new ArrayList<String>();
+ 370 10 final Enumeration<JarEntry> entries = jar.entries();
+ 371 3696 while (entries.hasMoreElements()) {
+ 372 3686 final JarEntry entry = entries.nextElement();
+ 373 3686 final String entryName = (new File(entry.getName())).getName().toLowerCase();
+ 374 3686 if (!entry.isDirectory() && "pom.xml" .equals(entryName)) {
+ 375 2 pomEntries.add(entry.getName());
+ 376
}
- 379 1843 }
- 380 5 return pomEntries;
+ 377 3686 }
+ 378 10 return pomEntries;
+ 379
+ }
+ 380
+
381
- }
+
382
-
+
383
-
+
384
-
+
385
-
+
386
-
- 387
-
- 388
+ 387
+
+ 388
+
389
-
+
390
-
+
391
-
- 392
-
- 393
private Model extractPom(String path, JarFile jar, Dependency dependency) throws AnalysisException {
- 394 0 InputStream input = null ;
- 395 0 FileOutputStream fos = null ;
- 396 0 BufferedOutputStream bos = null ;
- 397 0 final File tmpDir = getNextTempDirectory();
- 398 0 final File file = new File(tmpDir, "pom.xml" );
- 399
+ 392 0 InputStream input = null ;
+ 393 0 FileOutputStream fos = null ;
+ 394 0 BufferedOutputStream bos = null ;
+ 395 0 final File tmpDir = getNextTempDirectory();
+ 396 0 final File file = new File(tmpDir, "pom.xml" );
+ 397
try {
- 400 0 final ZipEntry entry = jar.getEntry(path);
- 401 0 input = jar.getInputStream(entry);
- 402 0 fos = new FileOutputStream(file);
- 403 0 bos = new BufferedOutputStream(fos, BUFFER_SIZE);
- 404
+ 398 0 final ZipEntry entry = jar.getEntry(path);
+ 399 0 input = jar.getInputStream(entry);
+ 400 0 fos = new FileOutputStream(file);
+ 401 0 bos = new BufferedOutputStream(fos, BUFFER_SIZE);
+ 402
int count;
- 405 0 final byte data[] = new byte [BUFFER_SIZE];
- 406 0 while ((count = input.read(data, 0, BUFFER_SIZE)) != -1) {
- 407 0 bos.write(data, 0, count);
- 408
+ 403 0 final byte data[] = new byte [BUFFER_SIZE];
+ 404 0 while ((count = input.read(data, 0, BUFFER_SIZE)) != -1) {
+ 405 0 bos.write(data, 0, count);
+ 406
}
- 409 0 bos.flush();
- 410 0 dependency.setActualFilePath(file.getAbsolutePath());
- 411 0 } catch (IOException ex) {
- 412 0 final String msg = String.format("An error occurred reading '%s' from '%s'." , path, dependency.getFilePath());
- 413 0 LOGGER.warning(msg);
- 414 0 LOGGER.log(Level.SEVERE, "" , ex);
- 415
+ 407 0 bos.flush();
+ 408 0 dependency.setActualFilePath(file.getAbsolutePath());
+ 409 0 } catch (IOException ex) {
+ 410 0 final String msg = String.format("An error occurred reading '%s' from '%s'." , path, dependency.getFilePath());
+ 411 0 LOGGER.warning(msg);
+ 412 0 LOGGER.log(Level.SEVERE, "" , ex);
+ 413
} finally {
- 416 0 closeStream(bos);
- 417 0 closeStream(fos);
- 418 0 closeStream(input);
- 419 0 }
- 420 0 Model model = null ;
- 421 0 FileInputStream fis = null ;
- 422
+ 414 0 closeStream(bos);
+ 415 0 closeStream(fos);
+ 416 0 closeStream(input);
+ 417 0 }
+ 418 0 Model model = null ;
+ 419 0 FileInputStream fis = null ;
+ 420
try {
- 423 0 fis = new FileInputStream(file);
- 424 0 final InputStreamReader reader = new InputStreamReader(fis, "UTF-8" );
- 425 0 final InputSource xml = new InputSource(reader);
- 426 0 final SAXSource source = new SAXSource(xml);
- 427 0 model = readPom(source);
- 428 0 } catch (FileNotFoundException ex) {
- 429 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s' (File Not Found)" , path, jar.getName());
- 430 0 LOGGER.log(Level.WARNING, msg);
- 431 0 LOGGER.log(Level.FINE, "" , ex);
- 432 0 throw new AnalysisException(ex);
- 433 0 } catch (UnsupportedEncodingException ex) {
- 434 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s' (IO Exception)" , path, jar.getName());
- 435 0 LOGGER.log(Level.WARNING, msg);
- 436 0 LOGGER.log(Level.FINE, "" , ex);
- 437 0 throw new AnalysisException(ex);
- 438 0 } catch (AnalysisException ex) {
- 439 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s'" , path, jar.getName());
- 440 0 LOGGER.log(Level.WARNING, msg);
- 441 0 LOGGER.log(Level.FINE, "" , ex);
- 442 0 throw ex;
- 443
+ 421 0 fis = new FileInputStream(file);
+ 422 0 final InputStreamReader reader = new InputStreamReader(fis, "UTF-8" );
+ 423 0 final InputSource xml = new InputSource(reader);
+ 424 0 final SAXSource source = new SAXSource(xml);
+ 425 0 model = readPom(source);
+ 426 0 } catch (FileNotFoundException ex) {
+ 427 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s' (File Not Found)" , path, jar.getName());
+ 428 0 LOGGER.log(Level.WARNING, msg);
+ 429 0 LOGGER.log(Level.FINE, "" , ex);
+ 430 0 throw new AnalysisException(ex);
+ 431 0 } catch (UnsupportedEncodingException ex) {
+ 432 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s' (IO Exception)" , path, jar.getName());
+ 433 0 LOGGER.log(Level.WARNING, msg);
+ 434 0 LOGGER.log(Level.FINE, "" , ex);
+ 435 0 throw new AnalysisException(ex);
+ 436 0 } catch (AnalysisException ex) {
+ 437 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s'" , path, jar.getName());
+ 438 0 LOGGER.log(Level.WARNING, msg);
+ 439 0 LOGGER.log(Level.FINE, "" , ex);
+ 440 0 throw ex;
+ 441
} finally {
- 444 0 closeStream(fis);
- 445 0 }
- 446 0 return model;
+ 442 0 closeStream(fis);
+ 443 0 }
+ 444 0 return model;
+ 445
+ }
+ 446
+
447
- }
+
448
-
- 449
-
- 450
- 451
+ 449
- 452
+ 450
- 453
+ 451
- 454
+ 452
private void closeStream(InputStream stream) {
- 455 0 if (stream != null ) {
- 456
+ 453 0 if (stream != null ) {
+ 454
try {
- 457 0 stream.close();
- 458 0 } catch (IOException ex) {
- 459 0 LOGGER.log(Level.FINEST, null , ex);
- 460 0 }
+ 455 0 stream.close();
+ 456 0 } catch (IOException ex) {
+ 457 0 LOGGER.log(Level.FINEST, null , ex);
+ 458 0 }
+ 459
+ }
+ 460 0 }
461
- }
- 462 0 }
+
+ 462
+
463
-
- 464
-
- 465
- 466
+ 464
- 467
+ 465
- 468
+ 466
- 469
+ 467
private void closeStream(OutputStream stream) {
- 470 0 if (stream != null ) {
- 471
+ 468 0 if (stream != null ) {
+ 469
try {
- 472 0 stream.close();
- 473 0 } catch (IOException ex) {
- 474 0 LOGGER.log(Level.FINEST, null , ex);
- 475 0 }
+ 470 0 stream.close();
+ 471 0 } catch (IOException ex) {
+ 472 0 LOGGER.log(Level.FINEST, null , ex);
+ 473 0 }
+ 474
+ }
+ 475 0 }
476
- }
- 477 0 }
+
+ 477
+
478
-
+
479
-
+
480
-
- 481
-
- 482
- 483
+ 481
- 484
+ 482
+ 483
+
+ 484
+
485
-
+
486
-
- 487
-
- 488
private Model retrievePom(String path, JarFile jar) throws AnalysisException {
- 489 1 final ZipEntry entry = jar.getEntry(path);
- 490 1 Model model = null ;
- 491 1 if (entry != null ) {
- 492
+ 487 2 final ZipEntry entry = jar.getEntry(path);
+ 488 2 Model model = null ;
+ 489 2 if (entry != null ) {
+ 490
try {
- 493 1 final NonClosingStream stream = new NonClosingStream(jar.getInputStream(entry));
- 494 1 final InputStreamReader reader = new InputStreamReader(stream, "UTF-8" );
- 495 1 final InputSource xml = new InputSource(reader);
- 496 1 final SAXSource source = new SAXSource(xml);
- 497 1 model = readPom(source);
- 498 0 } catch (SecurityException ex) {
- 499 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s'; invalid signature" , path, jar.getName());
- 500 0 LOGGER.log(Level.WARNING, msg);
- 501 0 LOGGER.log(Level.FINE, null , ex);
- 502 0 throw new AnalysisException(ex);
- 503 0 } catch (IOException ex) {
- 504 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s' (IO Exception)" , path, jar.getName());
- 505 0 LOGGER.log(Level.WARNING, msg);
- 506 0 LOGGER.log(Level.FINE, "" , ex);
- 507 0 throw new AnalysisException(ex);
- 508 0 } catch (Throwable ex) {
- 509 0 final String msg = String.format("Unexpected error during parsing of the pom '%s' in jar '%s'" , path, jar.getName());
- 510 0 LOGGER.log(Level.WARNING, msg);
- 511 0 LOGGER.log(Level.FINE, "" , ex);
- 512 0 throw new AnalysisException(ex);
- 513 1 }
+ 491 2 final NonClosingStream stream = new NonClosingStream(jar.getInputStream(entry));
+ 492 2 final InputStreamReader reader = new InputStreamReader(stream, "UTF-8" );
+ 493 2 final InputSource xml = new InputSource(reader);
+ 494 2 final SAXSource source = new SAXSource(xml);
+ 495 2 model = readPom(source);
+ 496 0 } catch (SecurityException ex) {
+ 497 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s'; invalid signature" , path, jar.getName());
+ 498 0 LOGGER.log(Level.WARNING, msg);
+ 499 0 LOGGER.log(Level.FINE, null , ex);
+ 500 0 throw new AnalysisException(ex);
+ 501 0 } catch (IOException ex) {
+ 502 0 final String msg = String.format("Unable to parse pom '%s' in jar '%s' (IO Exception)" , path, jar.getName());
+ 503 0 LOGGER.log(Level.WARNING, msg);
+ 504 0 LOGGER.log(Level.FINE, "" , ex);
+ 505 0 throw new AnalysisException(ex);
+ 506 0 } catch (Throwable ex) {
+ 507 0 final String msg = String.format("Unexpected error during parsing of the pom '%s' in jar '%s'" , path, jar.getName());
+ 508 0 LOGGER.log(Level.WARNING, msg);
+ 509 0 LOGGER.log(Level.FINE, "" , ex);
+ 510 0 throw new AnalysisException(ex);
+ 511 2 }
+ 512
+ }
+ 513 2 return model;
514
- }
- 515 1 return model;
+ }
+ 515
+
516
- }
+
517
-
- 518
-
- 519
- 520
+ 518
- 521
+ 519
- 522
+ 520
- 523
+ 521
- 524
+ 522
- 525
+ 523
- 526
+ 524
private Model readPom(SAXSource source) throws AnalysisException {
- 527 1 Model model = null ;
- 528
+ 525 2 Model model = null ;
+ 526
try {
- 529 1 final XMLFilter filter = new MavenNamespaceFilter();
- 530 1 final SAXParserFactory spf = SAXParserFactory.newInstance();
- 531 1 final SAXParser sp = spf.newSAXParser();
- 532 1 final XMLReader xr = sp.getXMLReader();
- 533 1 filter.setParent(xr);
- 534 1 final JAXBElement<Model> el = pomUnmarshaller.unmarshal(source, Model.class );
- 535 1 model = el.getValue();
- 536 0 } catch (SecurityException ex) {
+ 527 2 final XMLFilter filter = new MavenNamespaceFilter();
+ 528 2 final SAXParserFactory spf = SAXParserFactory.newInstance();
+ 529 2 final SAXParser sp = spf.newSAXParser();
+ 530 2 final XMLReader xr = sp.getXMLReader();
+ 531 2 filter.setParent(xr);
+ 532 2 final JAXBElement<Model> el = pomUnmarshaller.unmarshal(source, Model.class );
+ 533 2 model = el.getValue();
+ 534 0 } catch (SecurityException ex) {
+ 535 0 throw new AnalysisException(ex);
+ 536 0 } catch (ParserConfigurationException ex) {
537 0 throw new AnalysisException(ex);
- 538 0 } catch (ParserConfigurationException ex) {
+ 538 0 } catch (SAXException ex) {
539 0 throw new AnalysisException(ex);
- 540 0 } catch (SAXException ex) {
+ 540 0 } catch (JAXBException ex) {
541 0 throw new AnalysisException(ex);
- 542 0 } catch (JAXBException ex) {
+ 542 0 } catch (Throwable ex) {
543 0 throw new AnalysisException(ex);
- 544 0 } catch (Throwable ex) {
- 545 0 throw new AnalysisException(ex);
- 546 1 }
- 547 1 return model;
- 548
+ 544 2 }
+ 545 2 return model;
+ 546
}
- 549
+ 547
- 550
+ 548
- 551
+ 549
- 552
+ 550
- 553
+ 551
- 554
+ 552
- 555
+ 553
- 556
+ 554
- 557
+ 555
- 558
+ 556
- 559
+ 557
- 560
+ 558
private boolean setPomEvidence(Dependency dependency, Model pom, Properties pomProperties, ArrayList<ClassNameInformation> classes) {
- 561 1 boolean foundSomething = false ;
- 562 1 if (pom == null ) {
- 563 0 return foundSomething;
- 564
+ 559 2 boolean foundSomething = false ;
+ 560 2 boolean addAsIdentifier = true ;
+ 561 2 if (pom == null ) {
+ 562 0 return foundSomething;
+ 563
}
- 565 1 String groupid = interpolateString(pom.getGroupId(), pomProperties);
- 566 1 if (groupid != null && !groupid.isEmpty()) {
- 567 1 if (groupid.startsWith("org." ) || groupid.startsWith("com." )) {
- 568 1 groupid = groupid.substring(4);
- 569
+ 564 2 String groupid = interpolateString(pom.getGroupId(), pomProperties);
+ 565 2 String parentGroupId = null ;
+ 566
+
+ 567 2 if (pom.getParent() != null ) {
+ 568 2 parentGroupId = interpolateString(pom.getParent().getGroupId(), pomProperties);
+ 569 2 if ((groupid == null || groupid.isEmpty()) && parentGroupId != null && !parentGroupId.isEmpty()) {
+ 570 0 groupid = parentGroupId;
+ 571
}
- 570 1 foundSomething = true ;
- 571 1 dependency.getVendorEvidence().addEvidence("pom" , "groupid" , groupid, Confidence.HIGH);
- 572 1 dependency.getProductEvidence().addEvidence("pom" , "groupid" , groupid, Confidence.LOW);
- 573 1 addMatchingValues(classes, groupid, dependency.getVendorEvidence());
- 574 1 addMatchingValues(classes, groupid, dependency.getProductEvidence());
- 575
+ 572
}
- 576 1 String artifactid = interpolateString(pom.getArtifactId(), pomProperties);
- 577 1 if (artifactid != null && !artifactid.isEmpty()) {
- 578 1 if (artifactid.startsWith("org." ) || artifactid.startsWith("com." )) {
- 579 0 artifactid = artifactid.substring(4);
- 580
+ 573 2 final String originalGroupID = groupid;
+ 574
+
+ 575 2 if (groupid != null && !groupid.isEmpty()) {
+ 576 2 if (groupid.startsWith("org." ) || groupid.startsWith("com." )) {
+ 577 2 groupid = groupid.substring(4);
+ 578
}
- 581 1 foundSomething = true ;
- 582 1 dependency.getProductEvidence().addEvidence("pom" , "artifactid" , artifactid, Confidence.HIGH);
- 583 1 dependency.getVendorEvidence().addEvidence("pom" , "artifactid" , artifactid, Confidence.LOW);
- 584 1 addMatchingValues(classes, artifactid, dependency.getVendorEvidence());
- 585 1 addMatchingValues(classes, artifactid, dependency.getProductEvidence());
- 586
- }
- 587
-
- 588 1 final String version = interpolateString(pom.getVersion(), pomProperties);
- 589 1 if (version != null && !version.isEmpty()) {
- 590 0 foundSomething = true ;
- 591 0 dependency.getVersionEvidence().addEvidence("pom" , "version" , version, Confidence.HIGHEST);
+ 579 2 foundSomething = true ;
+ 580 2 dependency.getVendorEvidence().addEvidence("pom" , "groupid" , groupid, Confidence.HIGH);
+ 581 2 dependency.getProductEvidence().addEvidence("pom" , "groupid" , groupid, Confidence.LOW);
+ 582 2 addMatchingValues(classes, groupid, dependency.getVendorEvidence());
+ 583 2 addMatchingValues(classes, groupid, dependency.getProductEvidence());
+ 584 2 if (parentGroupId != null && !parentGroupId.isEmpty() && !parentGroupId.equals(groupid)) {
+ 585 2 dependency.getVendorEvidence().addEvidence("pom" , "parent-groupid" , parentGroupId, Confidence.MEDIUM);
+ 586 2 dependency.getProductEvidence().addEvidence("pom" , "parent-groupid" , parentGroupId, Confidence.LOW);
+ 587 2 addMatchingValues(classes, parentGroupId, dependency.getVendorEvidence());
+ 588 2 addMatchingValues(classes, parentGroupId, dependency.getProductEvidence());
+ 589
+ }
+ 590
+ } else {
+ 591 0 addAsIdentifier = false ;
592
}
593
-
- 594 1 final Organization org = pom.getOrganization();
- 595 1 if (org != null && org.getName() != null ) {
- 596 0 foundSomething = true ;
- 597 0 final String orgName = interpolateString(org.getName(), pomProperties);
- 598 0 if (orgName != null && !orgName.isEmpty()) {
- 599 0 dependency.getVendorEvidence().addEvidence("pom" , "organization name" , orgName, Confidence.HIGH);
- 600 0 addMatchingValues(classes, orgName, dependency.getVendorEvidence());
+
+ 594 2 String artifactid = interpolateString(pom.getArtifactId(), pomProperties);
+ 595 2 String parentArtifactId = null ;
+ 596
+
+ 597 2 if (pom.getParent() != null ) {
+ 598 2 parentArtifactId = interpolateString(pom.getParent().getArtifactId(), pomProperties);
+ 599 2 if ((artifactid == null || artifactid.isEmpty()) && parentArtifactId != null && !parentArtifactId.isEmpty()) {
+ 600 0 artifactid = parentArtifactId;
601
}
602
}
- 603
-
- 604 1 final String pomName = interpolateString(pom.getName(), pomProperties);
- 605 1 if (pomName != null && !pomName.isEmpty()) {
- 606 1 foundSomething = true ;
- 607 1 dependency.getProductEvidence().addEvidence("pom" , "name" , pomName, Confidence.HIGH);
- 608 1 dependency.getVendorEvidence().addEvidence("pom" , "name" , pomName, Confidence.HIGH);
- 609 1 addMatchingValues(classes, pomName, dependency.getVendorEvidence());
- 610 1 addMatchingValues(classes, pomName, dependency.getProductEvidence());
- 611
- }
- 612
-
- 613
-
- 614 1 if (pom.getDescription() != null ) {
- 615 0 foundSomething = true ;
- 616 0 final String description = interpolateString(pom.getDescription(), pomProperties);
- 617 0 if (description != null && !description.isEmpty()) {
- 618 0 final String trimmedDescription = addDescription(dependency, description, "pom" , "description" );
- 619 0 addMatchingValues(classes, trimmedDescription, dependency.getVendorEvidence());
- 620 0 addMatchingValues(classes, trimmedDescription, dependency.getProductEvidence());
+ 603 2 final String originalArtifactID = artifactid;
+ 604 2 if (artifactid != null && !artifactid.isEmpty()) {
+ 605 2 if (artifactid.startsWith("org." ) || artifactid.startsWith("com." )) {
+ 606 0 artifactid = artifactid.substring(4);
+ 607
+ }
+ 608 2 foundSomething = true ;
+ 609 2 dependency.getProductEvidence().addEvidence("pom" , "artifactid" , artifactid, Confidence.HIGH);
+ 610 2 dependency.getVendorEvidence().addEvidence("pom" , "artifactid" , artifactid, Confidence.LOW);
+ 611 2 addMatchingValues(classes, artifactid, dependency.getVendorEvidence());
+ 612 2 addMatchingValues(classes, artifactid, dependency.getProductEvidence());
+ 613 2 if (parentArtifactId != null && !parentArtifactId.isEmpty() && !parentArtifactId.equals(artifactid)) {
+ 614 2 dependency.getProductEvidence().addEvidence("pom" , "parent-artifactid" , parentArtifactId, Confidence.MEDIUM);
+ 615 2 dependency.getVendorEvidence().addEvidence("pom" , "parent-artifactid" , parentArtifactId, Confidence.LOW);
+ 616 2 addMatchingValues(classes, parentArtifactId, dependency.getVendorEvidence());
+ 617 2 addMatchingValues(classes, parentArtifactId, dependency.getProductEvidence());
+ 618
+ }
+ 619
+ } else {
+ 620 0 addAsIdentifier = false ;
621
- }
- 622
}
- 623 1 extractLicense(pom, pomProperties, dependency);
- 624 1 return foundSomething;
+ 622
+
+ 623 2 String version = interpolateString(pom.getVersion(), pomProperties);
+ 624 2 String parentVersion = null ;
625
- }
- 626
- 627
-
- 628
-
- 629
-
+ 626 2 if (pom.getParent() != null ) {
+ 627 2 parentVersion = interpolateString(pom.getParent().getVersion(), pomProperties);
+ 628 2 if ((version == null || version.isEmpty()) && parentVersion != null && !parentVersion.isEmpty()) {
+ 629 2 version = parentVersion;
630
-
+ }
631
-
+ }
632
-
- 633
-
- 634
-
- 635
- protected void analyzePackageNames(ArrayList<ClassNameInformation> classNames,
- 636
- Dependency dependency, boolean addPackagesAsEvidence) {
- 637 5 final HashMap<String, Integer> vendorIdentifiers = new HashMap<String, Integer>();
- 638 5 final HashMap<String, Integer> productIdentifiers = new HashMap<String, Integer>();
- 639 5 analyzeFullyQualifiedClassNames(classNames, vendorIdentifiers, productIdentifiers);
- 640
- 641 5 final int classCount = classNames.size();
- 642 5 final EvidenceCollection vendor = dependency.getVendorEvidence();
- 643 5 final EvidenceCollection product = dependency.getProductEvidence();
- 644
+ 633 2 if (version != null && !version.isEmpty()) {
+ 634 2 foundSomething = true ;
+ 635 2 dependency.getVersionEvidence().addEvidence("pom" , "version" , version, Confidence.HIGHEST);
+ 636 2 if (parentVersion != null && !parentVersion.isEmpty() && !parentVersion.equals(version)) {
+ 637 0 dependency.getVersionEvidence().addEvidence("pom" , "parent-version" , version, Confidence.LOW);
+ 638
+ }
+ 639
+ } else {
+ 640 0 addAsIdentifier = false ;
+ 641
+ }
+ 642
- 645 5 for (Map.Entry<String, Integer> entry : vendorIdentifiers.entrySet()) {
- 646 48 final float ratio = entry.getValue() / (float ) classCount;
- 647 48 if (ratio > 0.5) {
- 648
-
- 649 10 vendor.addWeighting(entry.getKey());
- 650 10 if (addPackagesAsEvidence && entry.getKey().length() > 1) {
- 651 8 vendor.addEvidence("jar" , "package" , entry.getKey(), Confidence.LOW);
- 652
- }
- 653
+ 643 2 if (addAsIdentifier) {
+ 644 2 dependency.addIdentifier("maven" , String.format("%s:%s:%s" , originalGroupID, originalArtifactID, version), null , Confidence.LOW);
+ 645
+ }
+ 646
+
+ 647
+
+ 648 2 final Organization org = pom.getOrganization();
+ 649 2 if (org != null && org.getName() != null ) {
+ 650 0 foundSomething = true ;
+ 651 0 final String orgName = interpolateString(org.getName(), pomProperties);
+ 652 0 if (orgName != null && !orgName.isEmpty()) {
+ 653 0 dependency.getVendorEvidence().addEvidence("pom" , "organization name" , orgName, Confidence.HIGH);
+ 654 0 addMatchingValues(classes, orgName, dependency.getVendorEvidence());
+ 655
}
- 654 48 }
- 655 5 for (Map.Entry<String, Integer> entry : productIdentifiers.entrySet()) {
- 656 985 final float ratio = entry.getValue() / (float ) classCount;
- 657 985 if (ratio > 0.5) {
- 658 5 product.addWeighting(entry.getKey());
- 659 5 if (addPackagesAsEvidence && entry.getKey().length() > 1) {
- 660 4 product.addEvidence("jar" , "package" , entry.getKey(), Confidence.LOW);
- 661
- }
- 662
- }
- 663 985 }
- 664 5 }
+ 656
+ }
+ 657
+
+ 658 2 final String pomName = interpolateString(pom.getName(), pomProperties);
+ 659 2 if (pomName != null && !pomName.isEmpty()) {
+ 660 2 foundSomething = true ;
+ 661 2 dependency.getProductEvidence().addEvidence("pom" , "name" , pomName, Confidence.HIGH);
+ 662 2 dependency.getVendorEvidence().addEvidence("pom" , "name" , pomName, Confidence.HIGH);
+ 663 2 addMatchingValues(classes, pomName, dependency.getVendorEvidence());
+ 664 2 addMatchingValues(classes, pomName, dependency.getProductEvidence());
665
-
+ }
666
-
+
667
-
- 668
-
- 669
-
- 670
-
- 671
-
- 672
-
- 673
-
- 674
-
+
+ 668 2 if (pom.getDescription() != null ) {
+ 669 0 foundSomething = true ;
+ 670 0 final String description = interpolateString(pom.getDescription(), pomProperties);
+ 671 0 if (description != null && !description.isEmpty()) {
+ 672 0 final String trimmedDescription = addDescription(dependency, description, "pom" , "description" );
+ 673 0 addMatchingValues(classes, trimmedDescription, dependency.getVendorEvidence());
+ 674 0 addMatchingValues(classes, trimmedDescription, dependency.getProductEvidence());
675
-
- 676
-
- 677
-
- 678
-
- 679
-
- 680
- protected boolean parseManifest(Dependency dependency, ArrayList<ClassNameInformation> classInformation) throws IOException {
- 681 5 boolean foundSomething = false ;
- 682 5 JarFile jar = null ;
- 683
- try {
- 684 5 jar = new JarFile(dependency.getActualFilePath());
- 685
-
- 686 5 final Manifest manifest = jar.getManifest();
- 687
-
- 688 5 if (manifest == null ) {
- 689
-
- 690 0 if (!dependency.getFileName().toLowerCase().endsWith("-sources.jar" )
- 691
- && !dependency.getFileName().toLowerCase().endsWith("-javadoc.jar" )
- 692
- && !dependency.getFileName().toLowerCase().endsWith("-src.jar" )
- 693
- && !dependency.getFileName().toLowerCase().endsWith("-doc.jar" )) {
- 694 0 LOGGER.log(Level.FINE,
- 695
- String.format("Jar file '%s' does not contain a manifest." ,
- 696
- dependency.getFileName()));
- 697
- }
- 698 0 return false ;
- 699
}
- 700 5 final Attributes atts = manifest.getMainAttributes();
- 701
+ 676
+ }
+ 677 2 extractLicense(pom, pomProperties, dependency);
+ 678 2 return foundSomething;
+ 679
+ }
+ 680
- 702 5 final EvidenceCollection vendorEvidence = dependency.getVendorEvidence();
- 703 5 final EvidenceCollection productEvidence = dependency.getProductEvidence();
- 704 5 final EvidenceCollection versionEvidence = dependency.getVersionEvidence();
- 705
+ 681
+
+ 682
+
+ 683
+
+ 684
+
+ 685
+
+ 686
+
+ 687
+
+ 688
+
+ 689
+ protected void analyzePackageNames(ArrayList<ClassNameInformation> classNames,
+ 690
+ Dependency dependency, boolean addPackagesAsEvidence) {
+ 691 10 final HashMap<String, Integer> vendorIdentifiers = new HashMap<String, Integer>();
+ 692 10 final HashMap<String, Integer> productIdentifiers = new HashMap<String, Integer>();
+ 693 10 analyzeFullyQualifiedClassNames(classNames, vendorIdentifiers, productIdentifiers);
+ 694
- 706 5 final String source = "Manifest" ;
- 707
+ 695 10 final int classCount = classNames.size();
+ 696 10 final EvidenceCollection vendor = dependency.getVendorEvidence();
+ 697 10 final EvidenceCollection product = dependency.getProductEvidence();
+ 698
- 708 5 for (Entry<Object, Object> entry : atts.entrySet()) {
- 709 65 String key = entry.getKey().toString();
- 710 65 String value = atts.getValue(key);
- 711 65 if (HTML_DETECTION_PATTERN.matcher(value).find()) {
- 712 0 value = Jsoup.parse(value).text();
- 713
+ 699 10 for (Map.Entry<String, Integer> entry : vendorIdentifiers.entrySet()) {
+ 700 96 final float ratio = entry.getValue() / (float ) classCount;
+ 701 96 if (ratio > 0.5) {
+ 702
+
+ 703 20 vendor.addWeighting(entry.getKey());
+ 704 20 if (addPackagesAsEvidence && entry.getKey().length() > 1) {
+ 705 16 vendor.addEvidence("jar" , "package name" , entry.getKey(), Confidence.LOW);
+ 706
}
- 714 65 if (IGNORE_VALUES.contains(value)) {
- 715 0 continue ;
- 716 65 } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_TITLE.toString())) {
- 717 1 foundSomething = true ;
- 718 1 productEvidence.addEvidence(source, key, value, Confidence.HIGH);
- 719 1 addMatchingValues(classInformation, value, productEvidence);
- 720 64 } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VERSION.toString())) {
- 721 2 foundSomething = true ;
- 722 2 versionEvidence.addEvidence(source, key, value, Confidence.HIGH);
- 723 62 } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VENDOR.toString())) {
- 724 1 foundSomething = true ;
- 725 1 vendorEvidence.addEvidence(source, key, value, Confidence.HIGH);
- 726 1 addMatchingValues(classInformation, value, vendorEvidence);
- 727 61 } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VENDOR_ID.toString())) {
- 728 0 foundSomething = true ;
- 729 0 vendorEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
- 730 0 addMatchingValues(classInformation, value, vendorEvidence);
- 731 61 } else if (key.equalsIgnoreCase(BUNDLE_DESCRIPTION)) {
- 732 2 foundSomething = true ;
- 733 2 addDescription(dependency, value, "manifest" , key);
+ 707
+ }
+ 708 96 }
+ 709 10 for (Map.Entry<String, Integer> entry : productIdentifiers.entrySet()) {
+ 710 1970 final float ratio = entry.getValue() / (float ) classCount;
+ 711 1970 if (ratio > 0.5) {
+ 712 10 product.addWeighting(entry.getKey());
+ 713 10 if (addPackagesAsEvidence && entry.getKey().length() > 1) {
+ 714 8 product.addEvidence("jar" , "package name" , entry.getKey(), Confidence.LOW);
+ 715
+ }
+ 716
+ }
+ 717 1970 }
+ 718 10 }
+ 719
+
+ 720
+
+ 721
+
+ 722
+
+ 723
+
+ 724
+
+ 725
+
+ 726
+
+ 727
+
+ 728
+
+ 729
+
+ 730
+
+ 731
+
+ 732
+
+ 733
+
734
-
- 735 2 addMatchingValues(classInformation, value, productEvidence);
- 736 59 } else if (key.equalsIgnoreCase(BUNDLE_NAME)) {
- 737 3 foundSomething = true ;
- 738 3 productEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
- 739 3 addMatchingValues(classInformation, value, productEvidence);
- 740 56 } else if (key.equalsIgnoreCase(BUNDLE_VENDOR)) {
- 741 3 foundSomething = true ;
- 742 3 vendorEvidence.addEvidence(source, key, value, Confidence.HIGH);
- 743 3 addMatchingValues(classInformation, value, vendorEvidence);
- 744 53 } else if (key.equalsIgnoreCase(BUNDLE_VERSION)) {
- 745 3 foundSomething = true ;
- 746 3 versionEvidence.addEvidence(source, key, value, Confidence.HIGH);
- 747 50 } else if (key.equalsIgnoreCase(Attributes.Name.MAIN_CLASS.toString())) {
- 748 2 continue ;
+ protected boolean parseManifest(Dependency dependency, ArrayList<ClassNameInformation> classInformation) throws IOException {
+ 735 10 boolean foundSomething = false ;
+ 736 10 JarFile jar = null ;
+ 737
+ try {
+ 738 10 jar = new JarFile(dependency.getActualFilePath());
+ 739
+
+ 740 10 final Manifest manifest = jar.getManifest();
+ 741
+
+ 742 10 if (manifest == null ) {
+ 743
+
+ 744 0 if (!dependency.getFileName().toLowerCase().endsWith("-sources.jar" )
+ 745
+ && !dependency.getFileName().toLowerCase().endsWith("-javadoc.jar" )
+ 746
+ && !dependency.getFileName().toLowerCase().endsWith("-src.jar" )
+ 747
+ && !dependency.getFileName().toLowerCase().endsWith("-doc.jar" )) {
+ 748 0 LOGGER.log(Level.FINE,
749
-
+ String.format("Jar file '%s' does not contain a manifest." ,
750
-
+ dependency.getFileName()));
751
-
- 752
-
+ }
+ 752 0 return false ;
753
-
- 754
-
+ }
+ 754 10 final Attributes atts = manifest.getMainAttributes();
755
-
- 756
-
- 757
- } else {
- 758 48 key = key.toLowerCase();
+
+ 756 10 final EvidenceCollection vendorEvidence = dependency.getVendorEvidence();
+ 757 10 final EvidenceCollection productEvidence = dependency.getProductEvidence();
+ 758 10 final EvidenceCollection versionEvidence = dependency.getVersionEvidence();
759
- 760 48 if (!IGNORE_KEYS.contains(key)
+ 760 10 final String source = "Manifest" ;
761
- && !key.endsWith("jdk" )
- 762
- && !key.contains("lastmodified" )
- 763
- && !key.endsWith("package" )
- 764
- && !key.endsWith("classpath" )
- 765
- && !key.endsWith("class-path" )
- 766
- && !key.endsWith("-scm" )
+
+ 762 10 for (Entry<Object, Object> entry : atts.entrySet()) {
+ 763 130 String key = entry.getKey().toString();
+ 764 130 String value = atts.getValue(key);
+ 765 130 if (HTML_DETECTION_PATTERN.matcher(value).find()) {
+ 766 0 value = Jsoup.parse(value).text();
767
- && !key.startsWith("scm-" )
- 768
- && !value.trim().startsWith("scm:" )
- 769
- && !isImportPackage(key, value)
- 770
- && !isPackage(key, value)) {
- 771
-
- 772 14 foundSomething = true ;
- 773 14 if (key.contains("version" )) {
- 774 1 if (key.contains("specification" )) {
- 775 1 versionEvidence.addEvidence(source, key, value, Confidence.LOW);
- 776
- } else {
- 777 0 versionEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
- 778
- }
- 779 13 } else if ("build-id" .equals(key)) {
- 780 0 int pos = value.indexOf('(' );
- 781 0 if (pos >= 0) {
- 782 0 value = value.substring(0, pos - 1);
- 783
- }
- 784 0 pos = value.indexOf('[' );
- 785 0 if (pos >= 0) {
- 786 0 value = value.substring(0, pos - 1);
- 787
- }
- 788 0 versionEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
- 789 0 } else if (key.contains("title" )) {
- 790 1 productEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
- 791 1 addMatchingValues(classInformation, value, productEvidence);
- 792 12 } else if (key.contains("vendor" )) {
- 793 0 if (key.contains("specification" )) {
- 794 0 vendorEvidence.addEvidence(source, key, value, Confidence.LOW);
- 795
- } else {
- 796 0 vendorEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
- 797 0 addMatchingValues(classInformation, value, vendorEvidence);
- 798
- }
- 799 12 } else if (key.contains("name" )) {
- 800 3 productEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
- 801 3 vendorEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
- 802 3 addMatchingValues(classInformation, value, vendorEvidence);
- 803 3 addMatchingValues(classInformation, value, productEvidence);
- 804 9 } else if (key.contains("license" )) {
- 805 2 addLicense(dependency, value);
- 806
- } else {
- 807 7 if (key.contains("description" )) {
- 808 0 addDescription(dependency, value, "manifest" , key);
- 809
- } else {
- 810 7 productEvidence.addEvidence(source, key, value, Confidence.LOW);
- 811 7 vendorEvidence.addEvidence(source, key, value, Confidence.LOW);
- 812 7 addMatchingValues(classInformation, value, vendorEvidence);
- 813 7 addMatchingValues(classInformation, value, productEvidence);
- 814 7 if (value.matches(".*\\d.*" )) {
- 815 3 final StringTokenizer tokenizer = new StringTokenizer(value, " " );
- 816 15 while (tokenizer.hasMoreElements()) {
- 817 12 final String s = tokenizer.nextToken();
- 818 12 if (s.matches("^[0-9.]+$" )) {
- 819 1 versionEvidence.addEvidence(source, key, s, Confidence.LOW);
- 820
- }
- 821 12 }
- 822
- }
- 823
- }
- 824
- }
- 825
- }
- 826
}
- 827 63 }
- 828
- } finally {
- 829 5 if (jar != null ) {
- 830 5 jar.close();
- 831
- }
+ 768 130 if (IGNORE_VALUES.contains(value)) {
+ 769 0 continue ;
+ 770 130 } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_TITLE.toString())) {
+ 771 2 foundSomething = true ;
+ 772 2 productEvidence.addEvidence(source, key, value, Confidence.HIGH);
+ 773 2 addMatchingValues(classInformation, value, productEvidence);
+ 774 128 } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VERSION.toString())) {
+ 775 4 foundSomething = true ;
+ 776 4 versionEvidence.addEvidence(source, key, value, Confidence.HIGH);
+ 777 124 } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VENDOR.toString())) {
+ 778 2 foundSomething = true ;
+ 779 2 vendorEvidence.addEvidence(source, key, value, Confidence.HIGH);
+ 780 2 addMatchingValues(classInformation, value, vendorEvidence);
+ 781 122 } else if (key.equalsIgnoreCase(Attributes.Name.IMPLEMENTATION_VENDOR_ID.toString())) {
+ 782 0 foundSomething = true ;
+ 783 0 vendorEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
+ 784 0 addMatchingValues(classInformation, value, vendorEvidence);
+ 785 122 } else if (key.equalsIgnoreCase(BUNDLE_DESCRIPTION)) {
+ 786 4 foundSomething = true ;
+ 787 4 addDescription(dependency, value, "manifest" , key);
+ 788
+
+ 789 4 addMatchingValues(classInformation, value, productEvidence);
+ 790 118 } else if (key.equalsIgnoreCase(BUNDLE_NAME)) {
+ 791 6 foundSomething = true ;
+ 792 6 productEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
+ 793 6 addMatchingValues(classInformation, value, productEvidence);
+ 794 112 } else if (key.equalsIgnoreCase(BUNDLE_VENDOR)) {
+ 795 6 foundSomething = true ;
+ 796 6 vendorEvidence.addEvidence(source, key, value, Confidence.HIGH);
+ 797 6 addMatchingValues(classInformation, value, vendorEvidence);
+ 798 106 } else if (key.equalsIgnoreCase(BUNDLE_VERSION)) {
+ 799 6 foundSomething = true ;
+ 800 6 versionEvidence.addEvidence(source, key, value, Confidence.HIGH);
+ 801 100 } else if (key.equalsIgnoreCase(Attributes.Name.MAIN_CLASS.toString())) {
+ 802 4 continue ;
+ 803
+
+ 804
+
+ 805
+
+ 806
+
+ 807
+
+ 808
+
+ 809
+
+ 810
+
+ 811
+ } else {
+ 812 96 key = key.toLowerCase();
+ 813
+
+ 814 96 if (!IGNORE_KEYS.contains(key)
+ 815
+ && !key.endsWith("jdk" )
+ 816
+ && !key.contains("lastmodified" )
+ 817
+ && !key.endsWith("package" )
+ 818
+ && !key.endsWith("classpath" )
+ 819
+ && !key.endsWith("class-path" )
+ 820
+ && !key.endsWith("-scm" )
+ 821
+ && !key.startsWith("scm-" )
+ 822
+ && !value.trim().startsWith("scm:" )
+ 823
+ && !isImportPackage(key, value)
+ 824
+ && !isPackage(key, value)) {
+ 825
+
+ 826 28 foundSomething = true ;
+ 827 28 if (key.contains("version" )) {
+ 828 2 if (key.contains("specification" )) {
+ 829 2 versionEvidence.addEvidence(source, key, value, Confidence.LOW);
+ 830
+ } else {
+ 831 0 versionEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
832
- }
- 833 5 return foundSomething;
- 834
- }
- 835
-
- 836
-
+ }
+ 833 26 } else if ("build-id" .equals(key)) {
+ 834 0 int pos = value.indexOf('(' );
+ 835 0 if (pos >= 0) {
+ 836 0 value = value.substring(0, pos - 1);
837
-
- 838
-
- 839
-
- 840
-
+ }
+ 838 0 pos = value.indexOf('[' );
+ 839 0 if (pos >= 0) {
+ 840 0 value = value.substring(0, pos - 1);
841
-
- 842
-
- 843
-
- 844
-
- 845
-
- 846
-
- 847
-
- 848
- private String addDescription(Dependency dependency, String description, String source, String key) {
- 849 2 if (dependency.getDescription() == null ) {
- 850 2 dependency.setDescription(description);
- 851
- }
+ }
+ 842 0 versionEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
+ 843 0 } else if (key.contains("title" )) {
+ 844 2 productEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
+ 845 2 addMatchingValues(classInformation, value, productEvidence);
+ 846 24 } else if (key.contains("vendor" )) {
+ 847 0 if (key.contains("specification" )) {
+ 848 0 vendorEvidence.addEvidence(source, key, value, Confidence.LOW);
+ 849
+ } else {
+ 850 0 vendorEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
+ 851 0 addMatchingValues(classInformation, value, vendorEvidence);
852
- String desc;
- 853 2 if (HTML_DETECTION_PATTERN.matcher(description).find()) {
- 854 0 desc = Jsoup.parse(description).text();
- 855
- } else {
- 856 2 desc = description;
- 857
- }
- 858 2 dependency.setDescription(desc);
- 859 2 if (desc.length() > 100) {
- 860 0 desc = desc.replaceAll("\\s\\s+" , " " );
- 861 0 final int posSuchAs = desc.toLowerCase().indexOf("such as " , 100);
- 862 0 final int posLike = desc.toLowerCase().indexOf("like " , 100);
- 863 0 final int posWillUse = desc.toLowerCase().indexOf("will use " , 100);
- 864 0 final int posUses = desc.toLowerCase().indexOf(" uses " , 100);
- 865 0 int pos = -1;
- 866 0 pos = Math.max(pos, posSuchAs);
- 867 0 if (pos >= 0 && posLike >= 0) {
- 868 0 pos = Math.min(pos, posLike);
- 869
- } else {
- 870 0 pos = Math.max(pos, posLike);
- 871
- }
- 872 0 if (pos >= 0 && posWillUse >= 0) {
- 873 0 pos = Math.min(pos, posWillUse);
+ }
+ 853 24 } else if (key.contains("name" )) {
+ 854 6 productEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
+ 855 6 vendorEvidence.addEvidence(source, key, value, Confidence.MEDIUM);
+ 856 6 addMatchingValues(classInformation, value, vendorEvidence);
+ 857 6 addMatchingValues(classInformation, value, productEvidence);
+ 858 18 } else if (key.contains("license" )) {
+ 859 4 addLicense(dependency, value);
+ 860
+ } else {
+ 861 14 if (key.contains("description" )) {
+ 862 0 addDescription(dependency, value, "manifest" , key);
+ 863
+ } else {
+ 864 14 productEvidence.addEvidence(source, key, value, Confidence.LOW);
+ 865 14 vendorEvidence.addEvidence(source, key, value, Confidence.LOW);
+ 866 14 addMatchingValues(classInformation, value, vendorEvidence);
+ 867 14 addMatchingValues(classInformation, value, productEvidence);
+ 868 14 if (value.matches(".*\\d.*" )) {
+ 869 6 final StringTokenizer tokenizer = new StringTokenizer(value, " " );
+ 870 30 while (tokenizer.hasMoreElements()) {
+ 871 24 final String s = tokenizer.nextToken();
+ 872 24 if (s.matches("^[0-9.]+$" )) {
+ 873 2 versionEvidence.addEvidence(source, key, s, Confidence.LOW);
874
- } else {
- 875 0 pos = Math.max(pos, posWillUse);
+ }
+ 875 24 }
876
- }
- 877 0 if (pos >= 0 && posUses >= 0) {
- 878 0 pos = Math.min(pos, posUses);
+ }
+ 877
+ }
+ 878
+ }
879
- } else {
- 880 0 pos = Math.max(pos, posUses);
- 881
- }
+ }
+ 880
+ }
+ 881 126 }
882
-
- 883 0 if (pos > 0) {
- 884 0 final StringBuilder sb = new StringBuilder(pos + 3);
- 885 0 sb.append(desc.substring(0, pos));
- 886 0 sb.append("..." );
- 887 0 desc = sb.toString();
+ } finally {
+ 883 10 if (jar != null ) {
+ 884 10 jar.close();
+ 885
+ }
+ 886
+ }
+ 887 10 return foundSomething;
888
- }
- 889 0 dependency.getProductEvidence().addEvidence(source, key, desc, Confidence.LOW);
- 890 0 dependency.getVendorEvidence().addEvidence(source, key, desc, Confidence.LOW);
- 891 0 } else {
- 892 2 dependency.getProductEvidence().addEvidence(source, key, desc, Confidence.MEDIUM);
- 893 2 dependency.getVendorEvidence().addEvidence(source, key, desc, Confidence.MEDIUM);
- 894
- }
- 895 2 return desc;
- 896
}
+ 889
+
+ 890
+
+ 891
+
+ 892
+
+ 893
+
+ 894
+
+ 895
+
+ 896
+
897
-
+
898
-
+
899
-
+
900
-
+
901
-
+
902
-
- 903
-
- 904
- private void addLicense(Dependency d, String license) {
- 905 2 if (d.getLicense() == null ) {
- 906 2 d.setLicense(license);
- 907 0 } else if (!d.getLicense().contains(license)) {
- 908 0 d.setLicense(d.getLicense() + NEWLINE + license);
+ private String addDescription(Dependency dependency, String description, String source, String key) {
+ 903 4 if (dependency.getDescription() == null ) {
+ 904 4 dependency.setDescription(description);
+ 905
+ }
+ 906
+ String desc;
+ 907 4 if (HTML_DETECTION_PATTERN.matcher(description).find()) {
+ 908 0 desc = Jsoup.parse(description).text();
909
- }
- 910 2 }
+ } else {
+ 910 4 desc = description;
911
-
- 912
-
- 913
-
- 914
-
- 915 7 private File tempFileLocation = null ;
- 916
-
- 917
-
- 918
-
- 919
-
- 920
-
- 921
-
- 922
- @Override
+ }
+ 912 4 dependency.setDescription(desc);
+ 913 4 if (desc.length() > 100) {
+ 914 0 desc = desc.replaceAll("\\s\\s+" , " " );
+ 915 0 final int posSuchAs = desc.toLowerCase().indexOf("such as " , 100);
+ 916 0 final int posLike = desc.toLowerCase().indexOf("like " , 100);
+ 917 0 final int posWillUse = desc.toLowerCase().indexOf("will use " , 100);
+ 918 0 final int posUses = desc.toLowerCase().indexOf(" uses " , 100);
+ 919 0 int pos = -1;
+ 920 0 pos = Math.max(pos, posSuchAs);
+ 921 0 if (pos >= 0 && posLike >= 0) {
+ 922 0 pos = Math.min(pos, posLike);
923
- public void initializeFileTypeAnalyzer() throws Exception {
- 924 1 final File baseDir = Settings.getTempDirectory();
- 925 1 tempFileLocation = File.createTempFile("check" , "tmp" , baseDir);
- 926 1 if (!tempFileLocation.delete()) {
- 927 0 final String msg = String.format("Unable to delete temporary file '%s'." , tempFileLocation.getAbsolutePath());
- 928 0 throw new AnalysisException(msg);
- 929
- }
- 930 1 if (!tempFileLocation.mkdirs()) {
- 931 0 final String msg = String.format("Unable to create directory '%s'." , tempFileLocation.getAbsolutePath());
- 932 0 throw new AnalysisException(msg);
- 933
- }
- 934 1 }
- 935
-
- 936
-
- 937
-
- 938
-
- 939
- @Override
- 940
- public void close() {
- 941 1 if (tempFileLocation != null && tempFileLocation.exists()) {
- 942 1 LOGGER.log(Level.FINE, "Attempting to delete temporary files" );
- 943 1 final boolean success = FileUtils.delete(tempFileLocation);
- 944 1 if (!success) {
- 945 0 LOGGER.log(Level.WARNING,
- 946
- "Failed to delete some temporary files, see the log for more details" );
- 947
+ } else {
+ 924 0 pos = Math.max(pos, posLike);
+ 925
}
+ 926 0 if (pos >= 0 && posWillUse >= 0) {
+ 927 0 pos = Math.min(pos, posWillUse);
+ 928
+ } else {
+ 929 0 pos = Math.max(pos, posWillUse);
+ 930
+ }
+ 931 0 if (pos >= 0 && posUses >= 0) {
+ 932 0 pos = Math.min(pos, posUses);
+ 933
+ } else {
+ 934 0 pos = Math.max(pos, posUses);
+ 935
+ }
+ 936
+
+ 937 0 if (pos > 0) {
+ 938 0 final StringBuilder sb = new StringBuilder(pos + 3);
+ 939 0 sb.append(desc.substring(0, pos));
+ 940 0 sb.append("..." );
+ 941 0 desc = sb.toString();
+ 942
+ }
+ 943 0 dependency.getProductEvidence().addEvidence(source, key, desc, Confidence.LOW);
+ 944 0 dependency.getVendorEvidence().addEvidence(source, key, desc, Confidence.LOW);
+ 945 0 } else {
+ 946 4 dependency.getProductEvidence().addEvidence(source, key, desc, Confidence.MEDIUM);
+ 947 4 dependency.getVendorEvidence().addEvidence(source, key, desc, Confidence.MEDIUM);
948
}
- 949 1 }
+ 949 4 return desc;
950
-
+ }
951
-
+
952
-
+
953
-
+
954
-
+
955
-
+
956
-
+
957
-
+
958
-
- 959
-
- 960
-
- 961
-
- 962
-
+ private void addLicense(Dependency d, String license) {
+ 959 4 if (d.getLicense() == null ) {
+ 960 4 d.setLicense(license);
+ 961 0 } else if (!d.getLicense().contains(license)) {
+ 962 0 d.setLicense(d.getLicense() + NEWLINE + license);
963
-
- 964
-
+ }
+ 964 4 }
965
-
+
966
-
+
967
-
+
968
-
- 969
-
+
+ 969 14 private File tempFileLocation = null ;
970
-
+
971
-
+
972
-
+
973
974
-
+
975
-
+
976
-
+ @Override
977
-
- 978
- protected String interpolateString(String text, Properties properties) {
- 979 11 Properties props = properties;
- 980 11 if (text == null ) {
- 981 1 return text;
- 982
+ public void initializeFileTypeAnalyzer() throws Exception {
+ 978 2 final File baseDir = Settings.getTempDirectory();
+ 979 2 tempFileLocation = File.createTempFile("check" , "tmp" , baseDir);
+ 980 2 if (!tempFileLocation.delete()) {
+ 981 0 final String msg = String.format("Unable to delete temporary file '%s'." , tempFileLocation.getAbsolutePath());
+ 982 0 throw new AnalysisException(msg);
+ 983
}
- 983 10 if (props == null ) {
- 984 3 props = new Properties();
- 985
+ 984 2 if (!tempFileLocation.mkdirs()) {
+ 985 0 final String msg = String.format("Unable to create directory '%s'." , tempFileLocation.getAbsolutePath());
+ 986 0 throw new AnalysisException(msg);
+ 987
}
- 986
+ 988 2 }
+ 989
- 987 10 final int pos = text.indexOf("${" );
- 988 10 if (pos < 0) {
- 989 7 return text;
990
- }
- 991 3 final int end = text.indexOf("}" );
- 992 3 if (end < pos) {
- 993 0 return text;
+
+ 991
+
+ 992
+
+ 993
+ @Override
994
- }
- 995
-
- 996 3 final String propName = text.substring(pos + 2, end);
- 997 3 String propValue = interpolateString(props.getProperty(propName), props);
- 998 3 if (propValue == null ) {
- 999 0 propValue = "" ;
+ public void close() {
+ 995 2 if (tempFileLocation != null && tempFileLocation.exists()) {
+ 996 2 LOGGER.log(Level.FINE, "Attempting to delete temporary files" );
+ 997 2 final boolean success = FileUtils.delete(tempFileLocation);
+ 998 2 if (!success) {
+ 999 0 LOGGER.log(Level.WARNING,
1000
+ "Failed to delete some temporary files, see the log for more details" );
+ 1001
+ }
+ 1002
}
- 1001 3 final StringBuilder sb = new StringBuilder(propValue.length() + text.length());
- 1002 3 sb.append(text.subSequence(0, pos));
- 1003 3 sb.append(propValue);
- 1004 3 sb.append(text.substring(end + 1));
- 1005 3 return interpolateString(sb.toString(), props);
+ 1003 2 }
+ 1004
+
+ 1005
+
1006
- }
+
1007
-
+
1008
-
+
1009
-
+
1010
-
+
1011
-
+
1012
-
+
1013
-
+
1014
-
+
1015
- private boolean isImportPackage(String key, String value) {
- 1016 15 final Pattern packageRx = Pattern.compile("^([a-zA-Z0-9_#\\$\\*\\.]+\\s*[,;]\\s*)+([a-zA-Z0-9_#\\$\\*\\.]+\\s*)?$" );
- 1017 15 final boolean matches = packageRx.matcher(value).matches();
- 1018 15 return matches && (key.contains("import" ) || key.contains("include" ) || value.length() > 10);
+
+ 1016
+
+ 1017
+
+ 1018
+
1019
- }
+
1020
-
+
1021
-
+
1022
-
+
1023
-
+
1024
-
+
1025
-
+
1026
-
+
1027
-
+
1028
- private ArrayList<ClassNameInformation> collectClassNames(Dependency dependency) {
- 1029 5 final ArrayList<ClassNameInformation> classNames = new ArrayList<ClassNameInformation>();
- 1030 5 JarFile jar = null ;
+
+ 1029
+
+ 1030
+
1031
- try {
- 1032 5 jar = new JarFile(dependency.getActualFilePath());
- 1033 5 final Enumeration entries = jar.entries();
- 1034 1848 while (entries.hasMoreElements()) {
- 1035 1843 final JarEntry entry = (JarEntry) entries.nextElement();
- 1036 1843 final String name = entry.getName().toLowerCase();
- 1037
-
- 1038 1843 if (name.endsWith(".class" ) && !name.matches("^javax?\\..*$" )) {
- 1039 1535 final ClassNameInformation className = new ClassNameInformation(name.substring(0, name.length() - 6));
- 1040 1535 classNames.add(className);
- 1041
- }
- 1042 1843 }
- 1043 0 } catch (IOException ex) {
- 1044 0 final String msg = String.format("Unable to open jar file '%s'." , dependency.getFileName());
- 1045 0 LOGGER.log(Level.WARNING, msg);
- 1046 0 LOGGER.log(Level.FINE, null , ex);
- 1047
- } finally {
- 1048 5 if (jar != null ) {
+
+ 1032
+ protected String interpolateString(String text, Properties properties) {
+ 1033 28 Properties props = properties;
+ 1034 28 if (text == null ) {
+ 1035 2 return text;
+ 1036
+ }
+ 1037 26 if (props == null ) {
+ 1038 12 props = new Properties();
+ 1039
+ }
+ 1040
+
+ 1041 26 final int pos = text.indexOf("${" );
+ 1042 26 if (pos < 0) {
+ 1043 20 return text;
+ 1044
+ }
+ 1045 6 final int end = text.indexOf("}" );
+ 1046 6 if (end < pos) {
+ 1047 0 return text;
+ 1048
+ }
1049
- try {
- 1050 5 jar.close();
- 1051 0 } catch (IOException ex) {
- 1052 0 LOGGER.log(Level.FINEST, null , ex);
- 1053 5 }
+
+ 1050 6 final String propName = text.substring(pos + 2, end);
+ 1051 6 String propValue = interpolateString(props.getProperty(propName), props);
+ 1052 6 if (propValue == null ) {
+ 1053 0 propValue = "" ;
1054
- }
- 1055
}
- 1056 5 return classNames;
- 1057
- }
- 1058
-
- 1059
-
+ 1055 6 final StringBuilder sb = new StringBuilder(propValue.length() + text.length());
+ 1056 6 sb.append(text.subSequence(0, pos));
+ 1057 6 sb.append(propValue);
+ 1058 6 sb.append(text.substring(end + 1));
+ 1059 6 return interpolateString(sb.toString(), props);
1060
-
+ }
1061
-
+
1062
-
+
1063
-
+
1064
-
+
1065
-
+
1066
-
+
1067
- private void analyzeFullyQualifiedClassNames(ArrayList<ClassNameInformation> classNames,
+
1068
- HashMap<String, Integer> vendor, HashMap<String, Integer> product) {
- 1069 5 for (ClassNameInformation entry : classNames) {
- 1070 1535 final ArrayList<String> list = entry.getPackageStructure();
- 1071 1535 addEntry(vendor, list.get(0));
- 1072
+
+ 1069
+ private boolean isImportPackage(String key, String value) {
+ 1070 30 final Pattern packageRx = Pattern.compile("^([a-zA-Z0-9_#\\$\\*\\.]+\\s*[,;]\\s*)+([a-zA-Z0-9_#\\$\\*\\.]+\\s*)?$" );
+ 1071 30 final boolean matches = packageRx.matcher(value).matches();
+ 1072 30 return matches && (key.contains("import" ) || key.contains("include" ) || value.length() > 10);
+ 1073
+ }
+ 1074
- 1073 1535 if (list.size() == 2) {
- 1074 0 addEntry(product, list.get(1));
1075
- }
- 1076 1535 if (list.size() == 3) {
- 1077 345 addEntry(vendor, list.get(1));
- 1078 345 addEntry(product, list.get(1));
- 1079 345 addEntry(product, list.get(2));
- 1080
- }
- 1081 1535 if (list.size() >= 4) {
- 1082 1190 addEntry(vendor, list.get(1));
- 1083 1190 addEntry(vendor, list.get(2));
- 1084 1190 addEntry(product, list.get(1));
- 1085 1190 addEntry(product, list.get(2));
- 1086 1190 addEntry(product, list.get(3));
- 1087
- }
- 1088 1535 }
- 1089 5 }
- 1090
-
- 1091
- 1092
-
- 1093
-
- 1094
+ 1076
+
+ 1077
+
+ 1078
- 1095
-
- 1096
-
- 1097
-
- 1098
- private void addEntry(HashMap<String, Integer> collection, String key) {
- 1099 8520 if (collection.containsKey(key)) {
- 1100 7487 collection.put(key, collection.get(key) + 1);
- 1101
- } else {
- 1102 1033 collection.put(key, 1);
- 1103
- }
- 1104 8520 }
- 1105
-
- 1106
-
- 1107
-
- 1108
-
- 1109
-
- 1110
-
- 1111
-
- 1112
-
- 1113
-
- 1114
-
- 1115
- private void addMatchingValues(ArrayList<ClassNameInformation> classes, String value, EvidenceCollection evidence) {
- 1116 37 if (value == null || value.isEmpty()) {
- 1117 0 return ;
- 1118
- }
- 1119 37 final String text = value.toLowerCase();
- 1120 37 for (ClassNameInformation cni : classes) {
- 1121 14916 for (String key : cni.getPackageStructure()) {
- 1122 57504 if (text.contains(key)) {
- 1123 13816 evidence.addEvidence("jar" , "package name" , key, Confidence.HIGHEST);
- 1124
- }
- 1125 57504 }
- 1126 14916 }
- 1127 37 }
- 1128
-
- 1129
-
- 1130
-
- 1131
-
- 1132
-
- 1133
-
- 1134
-
- 1135
-
- 1136
- private boolean isPackage(String key, String value) {
- 1137
-
- 1138 15 return !key.matches(".*(version|title|vendor|name|license|description).*" )
- 1139
- && value.matches("^([a-zA-Z_][a-zA-Z0-9_\\$]*(\\.[a-zA-Z_][a-zA-Z0-9_\\$]*)*)?$" );
- 1140
-
- 1141
- }
- 1142
-
- 1143
-
- 1144
-
- 1145
-
- 1146
-
- 1147
+ 1079
+ 1080
+
+ 1081
+
+ 1082
+ private ArrayList<ClassNameInformation> collectClassNames(Dependency dependency) {
+ 1083 10 final ArrayList<ClassNameInformation> classNames = new ArrayList<ClassNameInformation>();
+ 1084 10 JarFile jar = null ;
+ 1085
+ try {
+ 1086 10 jar = new JarFile(dependency.getActualFilePath());
+ 1087 10 final Enumeration entries = jar.entries();
+ 1088 3696 while (entries.hasMoreElements()) {
+ 1089 3686 final JarEntry entry = (JarEntry) entries.nextElement();
+ 1090 3686 final String name = entry.getName().toLowerCase();
+ 1091
+
+ 1092 3686 if (name.endsWith(".class" ) && !name.matches("^javax?\\..*$" )) {
+ 1093 3070 final ClassNameInformation className = new ClassNameInformation(name.substring(0, name.length() - 6));
+ 1094 3070 classNames.add(className);
+ 1095
+ }
+ 1096 3686 }
+ 1097 0 } catch (IOException ex) {
+ 1098 0 final String msg = String.format("Unable to open jar file '%s'." , dependency.getFileName());
+ 1099 0 LOGGER.log(Level.WARNING, msg);
+ 1100 0 LOGGER.log(Level.FINE, null , ex);
+ 1101
+ } finally {
+ 1102 10 if (jar != null ) {
+ 1103
+ try {
+ 1104 10 jar.close();
+ 1105 0 } catch (IOException ex) {
+ 1106 0 LOGGER.log(Level.FINEST, null , ex);
+ 1107 10 }
+ 1108
+ }
+ 1109
+ }
+ 1110 10 return classNames;
+ 1111
+ }
+ 1112
+
+ 1113
+
+ 1114
+
+ 1115
+
+ 1116
+
+ 1117
+
+ 1118
+
+ 1119
+
+ 1120
+
+ 1121
+ private void analyzeFullyQualifiedClassNames(ArrayList<ClassNameInformation> classNames,
+ 1122
+ HashMap<String, Integer> vendor, HashMap<String, Integer> product) {
+ 1123 10 for (ClassNameInformation entry : classNames) {
+ 1124 3070 final ArrayList<String> list = entry.getPackageStructure();
+ 1125 3070 addEntry(vendor, list.get(0));
+ 1126
+
+ 1127 3070 if (list.size() == 2) {
+ 1128 0 addEntry(product, list.get(1));
+ 1129
+ }
+ 1130 3070 if (list.size() == 3) {
+ 1131 690 addEntry(vendor, list.get(1));
+ 1132 690 addEntry(product, list.get(1));
+ 1133 690 addEntry(product, list.get(2));
+ 1134
+ }
+ 1135 3070 if (list.size() >= 4) {
+ 1136 2380 addEntry(vendor, list.get(1));
+ 1137 2380 addEntry(vendor, list.get(2));
+ 1138 2380 addEntry(product, list.get(1));
+ 1139 2380 addEntry(product, list.get(2));
+ 1140 2380 addEntry(product, list.get(3));
+ 1141
+ }
+ 1142 3070 }
+ 1143 10 }
+ 1144
+
+ 1145
+
+ 1146
+
+ 1147
+
1148
-
+
1149
-
+
1150
-
+
1151
- private void addPomEvidence(Dependency dependency, Model pom, Properties pomProperties) {
- 1152 0 if (pom == null ) {
- 1153 0 return ;
- 1154
+
+ 1152
+ private void addEntry(HashMap<String, Integer> collection, String key) {
+ 1153 17040 if (collection.containsKey(key)) {
+ 1154 14974 collection.put(key, collection.get(key) + 1);
+ 1155
+ } else {
+ 1156 2066 collection.put(key, 1);
+ 1157
}
- 1155 0 String groupid = interpolateString(pom.getGroupId(), pomProperties);
- 1156 0 if (groupid != null && !groupid.isEmpty()) {
- 1157 0 if (groupid.startsWith("org." ) || groupid.startsWith("com." )) {
- 1158 0 groupid = groupid.substring(4);
+ 1158 17040 }
1159
- }
- 1160 0 dependency.getVendorEvidence().addEvidence("pom" , "groupid" , groupid, Confidence.HIGH);
- 1161 0 dependency.getProductEvidence().addEvidence("pom" , "groupid" , groupid, Confidence.LOW);
+
+ 1160
+
+ 1161
+
1162
- }
- 1163 0 String artifactid = interpolateString(pom.getArtifactId(), pomProperties);
- 1164 0 if (artifactid != null && !artifactid.isEmpty()) {
- 1165 0 if (artifactid.startsWith("org." ) || artifactid.startsWith("com." )) {
- 1166 0 artifactid = artifactid.substring(4);
+
+ 1163
+
+ 1164
+
+ 1165
+
+ 1166
+
1167
- }
- 1168 0 dependency.getProductEvidence().addEvidence("pom" , "artifactid" , artifactid, Confidence.HIGH);
- 1169 0 dependency.getVendorEvidence().addEvidence("pom" , "artifactid" , artifactid, Confidence.LOW);
- 1170
+
+ 1168
+
+ 1169
+ private void addMatchingValues(ArrayList<ClassNameInformation> classes, String value, EvidenceCollection evidence) {
+ 1170 82 if (value == null || value.isEmpty() || classes == null || classes.isEmpty()) {
+ 1171 0 return ;
+ 1172
}
- 1171 0 final String version = interpolateString(pom.getVersion(), pomProperties);
- 1172 0 if (version != null && !version.isEmpty()) {
- 1173 0 dependency.getVersionEvidence().addEvidence("pom" , "version" , version, Confidence.HIGHEST);
- 1174
- }
- 1175
-
- 1176 0 final Parent parent = pom.getParent();
- 1177 0 if (parent != null ) {
- 1178 0 final String parentGroupId = interpolateString(parent.getGroupId(), pomProperties);
- 1179 0 if (parentGroupId != null && !parentGroupId.isEmpty()) {
- 1180 0 if (groupid == null || groupid.isEmpty()) {
- 1181 0 dependency.getVendorEvidence().addEvidence("pom" , "parent.groupid" , parentGroupId, Confidence.HIGH);
+ 1173 82 final String text = value.toLowerCase();
+ 1174 82 for (ClassNameInformation cni : classes) {
+ 1175 33000 for (String key : cni.getPackageStructure()) {
+ 1176 127640 if (text.contains(key)) {
+ 1177 30800 evidence.addEvidence("jar" , "package name" , key, Confidence.HIGHEST);
+ 1178
+ }
+ 1179 127640 }
+ 1180 33000 }
+ 1181 82 }
1182
- } else {
- 1183 0 dependency.getVendorEvidence().addEvidence("pom" , "parent.groupid" , parentGroupId, Confidence.MEDIUM);
+
+ 1183
+
1184
- }
- 1185 0 dependency.getProductEvidence().addEvidence("pom" , "parent.groupid" , parentGroupId, Confidence.LOW);
+
+ 1185
+
1186
- }
- 1187 0 final String parentArtifactId = interpolateString(parent.getArtifactId(), pomProperties);
- 1188 0 if (parentArtifactId != null && !parentArtifactId.isEmpty()) {
- 1189 0 if (artifactid == null || artifactid.isEmpty()) {
- 1190 0 dependency.getProductEvidence().addEvidence("pom" , "parent.artifactid" , parentArtifactId, Confidence.HIGH);
+
+ 1187
+
+ 1188
+
+ 1189
+
+ 1190
+ private boolean isPackage(String key, String value) {
1191
- } else {
- 1192 0 dependency.getProductEvidence().addEvidence("pom" , "parent.artifactid" , parentArtifactId, Confidence.MEDIUM);
+
+ 1192 30 return !key.matches(".*(version|title|vendor|name|license|description).*" )
1193
- }
- 1194 0 dependency.getVendorEvidence().addEvidence("pom" , "parent.artifactid" , parentArtifactId, Confidence.LOW);
+ && value.matches("^([a-zA-Z_][a-zA-Z0-9_\\$]*(\\.[a-zA-Z_][a-zA-Z0-9_\\$]*)*)?$" );
+ 1194
+
1195
- }
- 1196 0 final String parentVersion = interpolateString(parent.getVersion(), pomProperties);
- 1197 0 if (parentVersion != null && !parentVersion.isEmpty()) {
- 1198 0 if (version == null || version.isEmpty()) {
- 1199 0 dependency.getVersionEvidence().addEvidence("pom" , "parent.version" , parentVersion, Confidence.HIGH);
- 1200
- } else {
- 1201 0 dependency.getVersionEvidence().addEvidence("pom" , "parent.version" , parentVersion, Confidence.LOW);
- 1202
- }
- 1203
- }
- 1204
- }
- 1205
-
- 1206 0 final Organization org = pom.getOrganization();
- 1207 0 if (org != null && org.getName() != null ) {
- 1208 0 final String orgName = interpolateString(org.getName(), pomProperties);
- 1209 0 if (orgName != null && !orgName.isEmpty()) {
- 1210 0 dependency.getVendorEvidence().addEvidence("pom" , "organization name" , orgName, Confidence.HIGH);
- 1211
- }
- 1212
- }
- 1213
-
- 1214 0 final String pomName = interpolateString(pom.getName(), pomProperties);
- 1215 0 if (pomName != null && !pomName.isEmpty()) {
- 1216 0 dependency.getProductEvidence().addEvidence("pom" , "name" , pomName, Confidence.HIGH);
- 1217 0 dependency.getVendorEvidence().addEvidence("pom" , "name" , pomName, Confidence.HIGH);
- 1218
- }
- 1219
+ }
+ 1196
- 1220
-
- 1221 0 if (pom.getDescription() != null ) {
- 1222 0 final String description = interpolateString(pom.getDescription(), pomProperties);
- 1223 0 if (description != null && !description.isEmpty()) {
- 1224 0 addDescription(dependency, description, "pom" , "description" );
- 1225
- }
- 1226
- }
- 1227 0 extractLicense(pom, pomProperties, dependency);
- 1228 0 }
- 1229
-
- 1230
+ 1197
- 1231
+ 1198
- 1232
+ 1199
- 1233
+ 1200
- 1234
+ 1201
- 1235
+ 1202
- 1236
+ 1203
- 1237
+ 1204
private void extractLicense(Model pom, Properties pomProperties, Dependency dependency) {
- 1238
+ 1205
- 1239 1 if (pom.getLicenses() != null ) {
- 1240 0 String license = null ;
- 1241 0 for (License lic : pom.getLicenses().getLicense()) {
- 1242 0 String tmp = null ;
- 1243 0 if (lic.getName() != null ) {
- 1244 0 tmp = interpolateString(lic.getName(), pomProperties);
- 1245
+ 1206 2 if (pom.getLicenses() != null ) {
+ 1207 0 String license = null ;
+ 1208 0 for (License lic : pom.getLicenses().getLicense()) {
+ 1209 0 String tmp = null ;
+ 1210 0 if (lic.getName() != null ) {
+ 1211 0 tmp = interpolateString(lic.getName(), pomProperties);
+ 1212
}
- 1246 0 if (lic.getUrl() != null ) {
- 1247 0 if (tmp == null ) {
- 1248 0 tmp = interpolateString(lic.getUrl(), pomProperties);
- 1249
+ 1213 0 if (lic.getUrl() != null ) {
+ 1214 0 if (tmp == null ) {
+ 1215 0 tmp = interpolateString(lic.getUrl(), pomProperties);
+ 1216
} else {
- 1250 0 tmp += ": " + interpolateString(lic.getUrl(), pomProperties);
- 1251
+ 1217 0 tmp += ": " + interpolateString(lic.getUrl(), pomProperties);
+ 1218
}
- 1252
+ 1219
}
- 1253 0 if (tmp == null ) {
- 1254 0 continue ;
- 1255
+ 1220 0 if (tmp == null ) {
+ 1221 0 continue ;
+ 1222
}
- 1256 0 if (HTML_DETECTION_PATTERN.matcher(tmp).find()) {
- 1257 0 tmp = Jsoup.parse(tmp).text();
- 1258
+ 1223 0 if (HTML_DETECTION_PATTERN.matcher(tmp).find()) {
+ 1224 0 tmp = Jsoup.parse(tmp).text();
+ 1225
}
- 1259 0 if (license == null ) {
- 1260 0 license = tmp;
- 1261
+ 1226 0 if (license == null ) {
+ 1227 0 license = tmp;
+ 1228
} else {
- 1262 0 license += "\n" + tmp;
- 1263
+ 1229 0 license += "\n" + tmp;
+ 1230
}
- 1264 0 }
- 1265 0 if (license != null ) {
- 1266 0 dependency.setLicense(license);
- 1267
+ 1231 0 }
+ 1232 0 if (license != null ) {
+ 1233 0 dependency.setLicense(license);
+ 1234
}
- 1268
+ 1235
}
- 1269 1 }
- 1270
+ 1236 2 }
+ 1237
- 1271
+ 1238
- 1272
+ 1239
- 1273
+ 1240
- 1274
+ 1241
protected static class ClassNameInformation {
- 1275
+ 1242
- 1276
+ 1243
- 1277
+ 1244
- 1278
+ 1245
- 1279
+ 1246
- 1280
+ 1247
- 1281
+ 1248
- 1282
+ 1249
- 1283
+ 1250
- 1284
+ 1251
- 1285
+ 1252
- 1286
+ 1253
- 1287
+ 1254
- 1288
+ 1255
- 1289
+ 1256
- 1290
+ 1257
- 1291
+ 1258
- 1292
+ 1259
- 1293
+ 1260
- 1294
+ 1261
- 1295
+ 1262
- 1296 1535 ClassNameInformation(String className) {
- 1297 1535 name = className;
- 1298 1535 if (name.contains("/" )) {
- 1299 1535 final String[] tmp = className.toLowerCase().split("/" );
- 1300 1535 int start = 0;
- 1301 1535 int end = 3;
- 1302 1535 if ("com" .equals(tmp[0]) || "org" .equals(tmp[0])) {
- 1303 1535 start = 1;
- 1304 1535 end = 4;
- 1305
+ 1263 3070 ClassNameInformation(String className) {
+ 1264 3070 name = className;
+ 1265 3070 if (name.contains("/" )) {
+ 1266 3070 final String[] tmp = className.toLowerCase().split("/" );
+ 1267 3070 int start = 0;
+ 1268 3070 int end = 3;
+ 1269 3070 if ("com" .equals(tmp[0]) || "org" .equals(tmp[0])) {
+ 1270 3070 start = 1;
+ 1271 3070 end = 4;
+ 1272
}
- 1306 1535 if (tmp.length <= end) {
- 1307 345 end = tmp.length - 1;
- 1308
+ 1273 3070 if (tmp.length <= end) {
+ 1274 690 end = tmp.length - 1;
+ 1275
}
- 1309 7330 for (int i = start; i <= end; i++) {
- 1310 5795 packageStructure.add(tmp[i]);
- 1311
+ 1276 14660 for (int i = start; i <= end; i++) {
+ 1277 11590 packageStructure.add(tmp[i]);
+ 1278
}
- 1312 1535 } else {
- 1313 0 packageStructure.add(name);
- 1314
+ 1279 3070 } else {
+ 1280 0 packageStructure.add(name);
+ 1281
}
- 1315 1535 }
- 1316
+ 1282 3070 }
+ 1283
- 1317
+ 1284
- 1318
+ 1285
- 1319
+ 1286
private String name;
- 1320
+ 1287
- 1321
+ 1288
- 1322
+ 1289
- 1323
+ 1290
- 1324
+ 1291
- 1325
+ 1292
- 1326
+ 1293
public String getName() {
- 1327
+ 1294
return name;
- 1328
+ 1295
}
- 1329
+ 1296
- 1330
+ 1297
- 1331
+ 1298
- 1332
+ 1299
- 1333
+ 1300
- 1334
+ 1301
- 1335
+ 1302
public void setName(String name) {
- 1336
+ 1303
this .name = name;
- 1337
+ 1304
}
- 1338
+ 1305
- 1339
+ 1306
- 1340
+ 1307
- 1341 1535 private final ArrayList<String> packageStructure = new ArrayList<String>();
- 1342
+ 1308 3070 private final ArrayList<String> packageStructure = new ArrayList<String>();
+ 1309
- 1343
+ 1310
- 1344
+ 1311
- 1345
+ 1312
- 1346
+ 1313
- 1347
+ 1314
- 1348
+ 1315
public ArrayList<String> getPackageStructure() {
- 1349
+ 1316
return packageStructure;
- 1350
+ 1317
}
- 1351
+ 1318
}
- 1352
+ 1319
- 1353
+ 1320
- 1354
+ 1321
- 1355
+ 1322
- 1356
+ 1323
- 1357
+ 1324
- 1358
+ 1325
- 1359
+ 1326
private File getNextTempDirectory() throws AnalysisException {
- 1360 0 dirCount += 1;
- 1361 0 final File directory = new File(tempFileLocation, String.valueOf(dirCount));
- 1362
+ 1327 0 dirCount += 1;
+ 1328 0 final File directory = new File(tempFileLocation, String.valueOf(dirCount));
+ 1329
- 1363 0 if (directory.exists()) {
- 1364 0 return getNextTempDirectory();
- 1365
+ 1330 0 if (directory.exists()) {
+ 1331 0 return getNextTempDirectory();
+ 1332
}
- 1366 0 if (!directory.mkdirs()) {
- 1367 0 final String msg = String.format("Unable to create temp directory '%s'." , directory.getAbsolutePath());
- 1368 0 throw new AnalysisException(msg);
- 1369
+ 1333 0 if (!directory.mkdirs()) {
+ 1334 0 final String msg = String.format("Unable to create temp directory '%s'." , directory.getAbsolutePath());
+ 1335 0 throw new AnalysisException(msg);
+ 1336
}
- 1370 0 return directory;
- 1371
+ 1337 0 return directory;
+ 1338
}
- 1372
+ 1339
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.JavaScriptAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.JavaScriptAnalyzer.html
index fef2f1136..c920ab563 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.JavaScriptAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.JavaScriptAnalyzer.html
@@ -105,7 +105,7 @@
44
- 45 1 private static final Logger LOGGER = Logger.getLogger(JavaScriptAnalyzer.class .getName());
+ 45 2 private static final Logger LOGGER = Logger.getLogger(JavaScriptAnalyzer.class .getName());
46
47
@@ -124,14 +124,14 @@
54
- 55 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
+ 55 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
56
57
58
- 59 1 private static final Set<String> EXTENSIONS = newHashSet("js" );
+ 59 2 private static final Set<String> EXTENSIONS = newHashSet("js" );
60
61
@@ -148,7 +148,7 @@
@Override
67
public Set<String> getSupportedExtensions() {
- 68 2 return EXTENSIONS;
+ 68 4 return EXTENSIONS;
69
}
70
@@ -167,7 +167,7 @@
@Override
77
public String getName() {
- 78 1 return ANALYZER_NAME;
+ 78 2 return ANALYZER_NAME;
79
}
80
@@ -186,7 +186,7 @@
@Override
87
public AnalysisPhase getAnalysisPhase() {
- 88 1 return ANALYSIS_PHASE;
+ 88 2 return ANALYSIS_PHASE;
89
}
90
@@ -205,7 +205,7 @@
@Override
97
protected String getAnalyzerEnabledSettingKey() {
- 98 5 return Settings.KEYS.ANALYZER_JAVASCRIPT_ENABLED;
+ 98 10 return Settings.KEYS.ANALYZER_JAVASCRIPT_ENABLED;
99
}
100
@@ -275,6 +275,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NexusAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NexusAnalyzer.html
index 8786b6cec..2d13a5602 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NexusAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NexusAnalyzer.html
@@ -12,7 +12,7 @@
@@ -82,260 +82,275 @@
32
import org.owasp.dependencycheck.dependency.Dependency;
33
- import org.owasp.dependencycheck.utils.Settings;
+ import org.owasp.dependencycheck.dependency.Identifier;
34
-
+ import org.owasp.dependencycheck.utils.Settings;
35
-
+
36
-
+
37
-
+
38
-
+
39
-
+
40
-
- 41
-
- 42
-
- 43
-
- 44
-
- 45
-
- 46
+ 41
+
+ 42
+
+ 43
+
+ 44
+
+ 45
+
+ 46
+
47
-
+
48
-
+
49
- public class NexusAnalyzer extends AbstractFileTypeAnalyzer {
+
50
-
+ public class NexusAnalyzer extends AbstractFileTypeAnalyzer {
51
-
+
52
-
+
53
+
+ 54
- 54 1 private static final Logger LOGGER = Logger.getLogger(NexusAnalyzer.class .getName());
- 55
-
+ 55 2 private static final Logger LOGGER = Logger.getLogger(NexusAnalyzer.class .getName());
56
-
+
57
-
+
58
-
+
59
- private static final String ANALYZER_NAME = "Nexus Analyzer" ;
+
60
-
+ private static final String ANALYZER_NAME = "Nexus Analyzer" ;
61
-
+
62
-
+
63
+
+ 64
- 64 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
- 65
-
+ 65 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
66
-
+
67
-
+
68
+
+ 69
- 69 1 private static final Set<String> SUPPORTED_EXTENSIONS = newHashSet("jar" );
- 70
-
+ 70 2 private static final Set<String> SUPPORTED_EXTENSIONS = newHashSet("jar" );
71
-
+
72
-
+
73
-
+
74
- private NexusSearch searcher;
+
75
-
+ private NexusSearch searcher;
76
-
+
77
-
+
78
-
+
79
-
+
80
-
+
81
- @Override
+
82
+ @Override
+ 83
public void initializeFileTypeAnalyzer() throws Exception {
- 83 0 LOGGER.fine("Initializing Nexus Analyzer" );
- 84 0 LOGGER.fine(String.format("Nexus Analyzer enabled: %s" , isEnabled()));
- 85 0 if (isEnabled()) {
- 86 0 final String searchUrl = Settings.getString(Settings.KEYS.ANALYZER_NEXUS_URL);
- 87 0 LOGGER.fine(String.format("Nexus Analyzer URL: %s" , searchUrl));
- 88
+ 84 0 LOGGER.fine("Initializing Nexus Analyzer" );
+ 85 0 LOGGER.fine(String.format("Nexus Analyzer enabled: %s" , isEnabled()));
+ 86 0 if (isEnabled()) {
+ 87 0 final String searchUrl = Settings.getString(Settings.KEYS.ANALYZER_NEXUS_URL);
+ 88 0 LOGGER.fine(String.format("Nexus Analyzer URL: %s" , searchUrl));
+ 89
try {
- 89 0 searcher = new NexusSearch(new URL(searchUrl));
- 90 0 if (!searcher.preflightRequest()) {
- 91 0 LOGGER.warning("There was an issue getting Nexus status. Disabling analyzer." );
- 92 0 setEnabled(false );
- 93
+ 90 0 searcher = new NexusSearch(new URL(searchUrl));
+ 91 0 if (!searcher.preflightRequest()) {
+ 92 0 LOGGER.warning("There was an issue getting Nexus status. Disabling analyzer." );
+ 93 0 setEnabled(false );
+ 94
}
- 94 0 } catch (MalformedURLException mue) {
- 95
-
+ 95 0 } catch (MalformedURLException mue) {
96
+
+ 97
- 97 0 LOGGER.warning(String.format("Property %s not a valid URL. Nexus Analyzer disabled" , searchUrl));
- 98 0 setEnabled(false );
- 99 0 }
- 100
+ 98 0 LOGGER.warning(String.format("Property %s not a valid URL. Nexus Analyzer disabled" , searchUrl));
+ 99 0 setEnabled(false );
+ 100 0 }
+ 101
}
- 101 0 }
- 102
-
+ 102 0 }
103
-
+
104
-
+
105
-
+
106
-
+
107
-
+
108
- @Override
+
109
+ @Override
+ 110
public String getName() {
- 110 4 return ANALYZER_NAME;
- 111
- }
+ 111 8 return ANALYZER_NAME;
112
-
+ }
113
-
+
114
-
+
115
-
+
116
-
+
117
-
+
118
- @Override
+
119
+ @Override
+ 120
protected String getAnalyzerEnabledSettingKey() {
- 120 2 return Settings.KEYS.ANALYZER_NEXUS_ENABLED;
- 121
- }
+ 121 4 return Settings.KEYS.ANALYZER_NEXUS_ENABLED;
122
-
+ }
123
-
+
124
-
+
125
-
+
126
-
+
127
-
+
128
- @Override
+
129
+ @Override
+ 130
public AnalysisPhase getAnalysisPhase() {
- 130 1 return ANALYSIS_PHASE;
- 131
- }
+ 131 2 return ANALYSIS_PHASE;
132
-
- 133
-
- 134
-
- 135
-
- 136
-
- 137
-
- 138
- @Override
- 139
- public Set<String> getSupportedExtensions() {
- 140 0 return SUPPORTED_EXTENSIONS;
- 141
}
- 142
+ 133
- 143
+ 134
- 144
-
- 145
+ 135
+
+ 136
- 146
-
- 147
-
- 148
-
- 149
+ 137
+
+ 138
- 150
+ 139
@Override
+ 140
+ public Set<String> getSupportedExtensions() {
+ 141 0 return SUPPORTED_EXTENSIONS;
+ 142
+ }
+ 143
+
+ 144
+
+ 145
+
+ 146
+
+ 147
+
+ 148
+
+ 149
+
+ 150
+
151
- public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException {
+ @Override
152
+ public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException {
+ 153
try {
- 153 0 final MavenArtifact ma = searcher.searchSha1(dependency.getSha1sum());
- 154 0 if (ma.getGroupId() != null && !"" .equals(ma.getGroupId())) {
- 155 0 dependency.getVendorEvidence().addEvidence("nexus" , "groupid" , ma.getGroupId(), Confidence.HIGH);
- 156
+ 154 0 final MavenArtifact ma = searcher.searchSha1(dependency.getSha1sum());
+ 155 0 if (ma.getGroupId() != null && !"" .equals(ma.getGroupId())) {
+ 156 0 dependency.getVendorEvidence().addEvidence("nexus" , "groupid" , ma.getGroupId(), Confidence.HIGH);
+ 157
}
- 157 0 if (ma.getArtifactId() != null && !"" .equals(ma.getArtifactId())) {
- 158 0 dependency.getProductEvidence().addEvidence("nexus" , "artifactid" , ma.getArtifactId(), Confidence.HIGH);
- 159
+ 158 0 if (ma.getArtifactId() != null && !"" .equals(ma.getArtifactId())) {
+ 159 0 dependency.getProductEvidence().addEvidence("nexus" , "artifactid" , ma.getArtifactId(), Confidence.HIGH);
+ 160
}
- 160 0 if (ma.getVersion() != null && !"" .equals(ma.getVersion())) {
- 161 0 dependency.getVersionEvidence().addEvidence("nexus" , "version" , ma.getVersion(), Confidence.HIGH);
- 162
+ 161 0 if (ma.getVersion() != null && !"" .equals(ma.getVersion())) {
+ 162 0 dependency.getVersionEvidence().addEvidence("nexus" , "version" , ma.getVersion(), Confidence.HIGH);
+ 163
}
- 163 0 if (ma.getArtifactUrl() != null && !"" .equals(ma.getArtifactUrl())) {
- 164 0 dependency.addIdentifier("maven" , ma.toString(), ma.getArtifactUrl(), Confidence.HIGHEST);
- 165
+ 164 0 if (ma.getArtifactUrl() != null && !"" .equals(ma.getArtifactUrl())) {
+ 165 0 boolean found = false ;
+ 166 0 for (Identifier i : dependency.getIdentifiers()) {
+ 167 0 if ("maven" .equals(i.getType()) && i.getValue().equals(ma.toString())) {
+ 168 0 found = true ;
+ 169 0 i.setConfidence(Confidence.HIGHEST);
+ 170 0 i.setUrl(ma.getArtifactUrl());
+ 171 0 break ;
+ 172
+ }
+ 173 0 }
+ 174 0 if (!found) {
+ 175 0 dependency.addIdentifier("maven" , ma.toString(), ma.getArtifactUrl(), Confidence.HIGHEST);
+ 176
+ }
+ 177
}
- 166 0 } catch (IllegalArgumentException iae) {
- 167
+ 178 0 } catch (IllegalArgumentException iae) {
+ 179
- 168 0 LOGGER.info(String.format("invalid sha-1 hash on %s" , dependency.getFileName()));
- 169 0 } catch (FileNotFoundException fnfe) {
- 170
+ 180 0 LOGGER.info(String.format("invalid sha-1 hash on %s" , dependency.getFileName()));
+ 181 0 } catch (FileNotFoundException fnfe) {
+ 182
- 171 0 LOGGER.fine(String.format("Artifact not found in repository '%s'" , dependency.getFileName()));
- 172 0 LOGGER.log(Level.FINE, fnfe.getMessage(), fnfe);
- 173 0 } catch (IOException ioe) {
- 174
+ 183 0 LOGGER.fine(String.format("Artifact not found in repository '%s'" , dependency.getFileName()));
+ 184 0 LOGGER.log(Level.FINE, fnfe.getMessage(), fnfe);
+ 185 0 } catch (IOException ioe) {
+ 186
- 175 0 LOGGER.log(Level.FINE, "Could not connect to nexus repository" , ioe);
- 176 0 }
- 177 0 }
- 178
+ 187 0 LOGGER.log(Level.FINE, "Could not connect to nexus repository" , ioe);
+ 188 0 }
+ 189 0 }
+ 190
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NuspecAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NuspecAnalyzer.html
index 15b56cbdf..82dc4d9f6 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NuspecAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NuspecAnalyzer.html
@@ -107,7 +107,7 @@
45
- 46 1 private static final Logger LOGGER = Logger.getLogger(NuspecAnalyzer.class .getName());
+ 46 2 private static final Logger LOGGER = Logger.getLogger(NuspecAnalyzer.class .getName());
47
48
@@ -126,7 +126,7 @@
55
- 56 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
+ 56 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.INFORMATION_COLLECTION;
57
58
@@ -135,7 +135,7 @@
60
- 61 1 private static final Set<String> SUPPORTED_EXTENSIONS = newHashSet("nuspec" );
+ 61 2 private static final Set<String> SUPPORTED_EXTENSIONS = newHashSet("nuspec" );
62
63
@@ -169,7 +169,7 @@
@Override
78
public String getName() {
- 79 5 return ANALYZER_NAME;
+ 79 10 return ANALYZER_NAME;
80
}
81
@@ -188,7 +188,7 @@
@Override
88
protected String getAnalyzerEnabledSettingKey() {
- 89 6 return Settings.KEYS.ANALYZER_NUSPEC_ENABLED;
+ 89 12 return Settings.KEYS.ANALYZER_NUSPEC_ENABLED;
90
}
91
@@ -207,7 +207,7 @@
@Override
98
public AnalysisPhase getAnalysisPhase() {
- 99 2 return ANALYSIS_PHASE;
+ 99 4 return ANALYSIS_PHASE;
100
}
101
@@ -226,7 +226,7 @@
@Override
108
public Set<String> getSupportedExtensions() {
- 109 852 return SUPPORTED_EXTENSIONS;
+ 109 1704 return SUPPORTED_EXTENSIONS;
110
}
111
@@ -297,6 +297,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NvdCveAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NvdCveAnalyzer.html
index 1ee36bd4f..699d06be2 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NvdCveAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.NvdCveAnalyzer.html
@@ -129,9 +129,9 @@
56
public void open() throws SQLException, IOException, DatabaseException, ClassNotFoundException {
- 57 1 cveDB = new CveDB();
- 58 1 cveDB.open();
- 59 1 }
+ 57 2 cveDB = new CveDB();
+ 58 2 cveDB.open();
+ 59 2 }
60
61
@@ -144,9 +144,9 @@
@Override
65
public void close() {
- 66 1 cveDB.close();
- 67 1 cveDB = null ;
- 68 1 }
+ 66 2 cveDB.close();
+ 67 2 cveDB = null ;
+ 68 2 }
69
70
@@ -206,20 +206,20 @@
@Override
100
public void analyze(Dependency dependency, Engine engine) throws AnalysisException {
- 101 2 for (Identifier id : dependency.getIdentifiers()) {
- 102 2 if ("cpe" .equals(id.getType())) {
+ 101 4 for (Identifier id : dependency.getIdentifiers()) {
+ 102 4 if ("cpe" .equals(id.getType())) {
103
try {
- 104 2 final String value = id.getValue();
- 105 2 final List<Vulnerability> vulns = cveDB.getVulnerabilities(value);
- 106 2 dependency.getVulnerabilities().addAll(vulns);
+ 104 4 final String value = id.getValue();
+ 105 4 final List<Vulnerability> vulns = cveDB.getVulnerabilities(value);
+ 106 4 dependency.getVulnerabilities().addAll(vulns);
107 0 } catch (DatabaseException ex) {
108 0 throw new AnalysisException(ex);
- 109 2 }
+ 109 4 }
110
}
- 111 2 }
- 112 2 for (Identifier id : dependency.getSuppressedIdentifiers()) {
+ 111 4 }
+ 112 4 for (Identifier id : dependency.getSuppressedIdentifiers()) {
113 0 if ("cpe" .equals(id.getType())) {
114
try {
@@ -232,7 +232,7 @@
121
}
122 0 }
- 123 2 }
+ 123 4 }
124
125
@@ -249,7 +249,7 @@
@Override
131
public String getName() {
- 132 4 return "NVD CVE Analyzer" ;
+ 132 8 return "NVD CVE Analyzer" ;
133
}
134
@@ -268,7 +268,7 @@
@Override
141
public AnalysisPhase getAnalysisPhase() {
- 142 1 return AnalysisPhase.FINDING_ANALYSIS;
+ 142 2 return AnalysisPhase.FINDING_ANALYSIS;
143
}
144
@@ -287,12 +287,12 @@
@Override
151
public void initialize() throws Exception {
- 152 1 this .open();
- 153 1 }
+ 152 2 this .open();
+ 153 2 }
154
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.VulnerabilitySuppressionAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.VulnerabilitySuppressionAnalyzer.html
index 38f836318..8a91f9fe0 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.VulnerabilitySuppressionAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.VulnerabilitySuppressionAnalyzer.html
@@ -12,7 +12,7 @@
@@ -97,7 +97,7 @@
40
- 41 1 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.POST_FINDING_ANALYSIS;
+ 41 2 private static final AnalysisPhase ANALYSIS_PHASE = AnalysisPhase.POST_FINDING_ANALYSIS;
42
43
@@ -114,7 +114,7 @@
@Override
49
public String getName() {
- 50 4 return ANALYZER_NAME;
+ 50 8 return ANALYZER_NAME;
51
}
52
@@ -133,7 +133,7 @@
@Override
59
public AnalysisPhase getAnalysisPhase() {
- 60 1 return ANALYSIS_PHASE;
+ 60 2 return ANALYSIS_PHASE;
61
}
62
@@ -146,20 +146,20 @@
public void analyze(final Dependency dependency, final Engine engine) throws AnalysisException {
66
- 67 2 if (getRules() == null || getRules().size() <= 0) {
- 68 2 return ;
+ 67 4 if (getRules() == null || getRules().size() <= 0) {
+ 68 0 return ;
69
}
70
- 71 0 for (final SuppressionRule rule : getRules()) {
- 72 0 rule.process(dependency);
- 73 0 }
- 74 0 }
+ 71 4 for (final SuppressionRule rule : getRules()) {
+ 72 4 rule.process(dependency);
+ 73 4 }
+ 74 4 }
75
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.exception.AnalysisException.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.exception.AnalysisException.html
index 4bded4797..cdcf43b93 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.exception.AnalysisException.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.exception.AnalysisException.html
@@ -151,6 +151,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.exception.ArchiveExtractionException.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.exception.ArchiveExtractionException.html
index fa17f84e0..22bdce252 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.exception.ArchiveExtractionException.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.analyzer.exception.ArchiveExtractionException.html
@@ -151,6 +151,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.CpeMemoryIndex.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.CpeMemoryIndex.html
index cc4dbaaaa..48ec0ef77 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.CpeMemoryIndex.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.CpeMemoryIndex.html
@@ -135,14 +135,14 @@
59
- 60 1 private static final Logger LOGGER = Logger.getLogger(CpeMemoryIndex.class .getName());
+ 60 2 private static final Logger LOGGER = Logger.getLogger(CpeMemoryIndex.class .getName());
61
62
63
- 64 1 private static CpeMemoryIndex instance = new CpeMemoryIndex();
+ 64 2 private static CpeMemoryIndex instance = new CpeMemoryIndex();
65
66
@@ -169,7 +169,7 @@
77
public static CpeMemoryIndex getInstance() {
- 78 2 return instance;
+ 78 4 return instance;
79
}
80
@@ -244,22 +244,22 @@
115
public void open(CveDB cve) throws IndexException {
- 116 2 if (!openState) {
- 117 1 index = new RAMDirectory();
- 118 1 buildIndex(cve);
+ 116 4 if (!openState) {
+ 117 2 index = new RAMDirectory();
+ 118 2 buildIndex(cve);
119
try {
- 120 1 indexReader = DirectoryReader.open(index);
+ 120 2 indexReader = DirectoryReader.open(index);
121 0 } catch (IOException ex) {
122 0 throw new IndexException(ex);
- 123 1 }
- 124 1 indexSearcher = new IndexSearcher(indexReader);
- 125 1 searchingAnalyzer = createSearchingAnalyzer();
- 126 1 queryParser = new QueryParser(LuceneUtils.CURRENT_VERSION, Fields.DOCUMENT_KEY, searchingAnalyzer);
- 127 1 openState = true ;
+ 123 2 }
+ 124 2 indexSearcher = new IndexSearcher(indexReader);
+ 125 2 searchingAnalyzer = createSearchingAnalyzer();
+ 126 2 queryParser = new QueryParser(LuceneUtils.CURRENT_VERSION, Fields.DOCUMENT_KEY, searchingAnalyzer);
+ 127 2 openState = true ;
128
}
- 129 2 }
+ 129 4 }
130
131
@@ -302,9 +302,9 @@
@SuppressWarnings("unchecked" )
150
private Analyzer createIndexingAnalyzer() {
- 151 1 final Map fieldAnalyzers = new HashMap();
- 152 1 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer());
- 153 1 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers);
+ 151 2 final Map fieldAnalyzers = new HashMap();
+ 152 2 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer());
+ 153 2 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers);
154
}
155
@@ -323,15 +323,15 @@
@SuppressWarnings("unchecked" )
162
private Analyzer createSearchingAnalyzer() {
- 163 1 final Map fieldAnalyzers = new HashMap();
- 164 1 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer());
- 165 1 productSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION);
- 166 1 vendorSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION);
- 167 1 fieldAnalyzers.put(Fields.PRODUCT, productSearchFieldAnalyzer);
- 168 1 fieldAnalyzers.put(Fields.VENDOR, vendorSearchFieldAnalyzer);
+ 163 2 final Map fieldAnalyzers = new HashMap();
+ 164 2 fieldAnalyzers.put(Fields.DOCUMENT_KEY, new KeywordAnalyzer());
+ 165 2 productSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION);
+ 166 2 vendorSearchFieldAnalyzer = new SearchFieldAnalyzer(LuceneUtils.CURRENT_VERSION);
+ 167 2 fieldAnalyzers.put(Fields.PRODUCT, productSearchFieldAnalyzer);
+ 168 2 fieldAnalyzers.put(Fields.VENDOR, vendorSearchFieldAnalyzer);
169
- 170 1 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers);
+ 170 2 return new PerFieldAnalyzerWrapper(new FieldAnalyzer(LuceneUtils.CURRENT_VERSION), fieldAnalyzers);
171
}
172
@@ -356,13 +356,13 @@
182
public void saveEntry(String vendor, String product, IndexWriter indexWriter) throws CorruptIndexException, IOException {
- 183 21494 final Document doc = new Document();
- 184 21494 final Field v = new TextField(Fields.VENDOR, vendor, Field.Store.YES);
- 185 21494 final Field p = new TextField(Fields.PRODUCT, product, Field.Store.YES);
- 186 21494 doc.add(v);
- 187 21494 doc.add(p);
- 188 21494 indexWriter.addDocument(doc);
- 189 21494 }
+ 183 44272 final Document doc = new Document();
+ 184 44272 final Field v = new TextField(Fields.VENDOR, vendor, Field.Store.YES);
+ 185 44272 final Field p = new TextField(Fields.PRODUCT, product, Field.Store.YES);
+ 186 44272 doc.add(v);
+ 187 44272 doc.add(p);
+ 188 44272 indexWriter.addDocument(doc);
+ 189 44272 }
190
191
@@ -373,30 +373,30 @@
194
public void close() {
- 195 1 if (searchingAnalyzer != null ) {
- 196 1 searchingAnalyzer.close();
- 197 1 searchingAnalyzer = null ;
+ 195 2 if (searchingAnalyzer != null ) {
+ 196 2 searchingAnalyzer.close();
+ 197 2 searchingAnalyzer = null ;
198
}
- 199 1 if (indexReader != null ) {
+ 199 2 if (indexReader != null ) {
200
try {
- 201 1 indexReader.close();
+ 201 2 indexReader.close();
202 0 } catch (IOException ex) {
203 0 LOGGER.log(Level.FINEST, null , ex);
- 204 1 }
- 205 1 indexReader = null ;
+ 204 2 }
+ 205 2 indexReader = null ;
206
}
- 207 1 queryParser = null ;
- 208 1 indexSearcher = null ;
- 209 1 if (index != null ) {
- 210 1 index.close();
- 211 1 index = null ;
+ 207 2 queryParser = null ;
+ 208 2 indexSearcher = null ;
+ 209 2 if (index != null ) {
+ 210 2 index.close();
+ 211 2 index = null ;
212
}
- 213 1 openState = false ;
- 214 1 }
+ 213 2 openState = false ;
+ 214 2 }
215
216
@@ -413,53 +413,53 @@
222
private void buildIndex(CveDB cve) throws IndexException {
- 223 1 Analyzer analyzer = null ;
- 224 1 IndexWriter indexWriter = null ;
+ 223 2 Analyzer analyzer = null ;
+ 224 2 IndexWriter indexWriter = null ;
225
try {
- 226 1 analyzer = createIndexingAnalyzer();
- 227 1 final IndexWriterConfig conf = new IndexWriterConfig(LuceneUtils.CURRENT_VERSION, analyzer);
- 228 1 indexWriter = new IndexWriter(index, conf);
+ 226 2 analyzer = createIndexingAnalyzer();
+ 227 2 final IndexWriterConfig conf = new IndexWriterConfig(LuceneUtils.CURRENT_VERSION, analyzer);
+ 228 2 indexWriter = new IndexWriter(index, conf);
229
try {
- 230 1 final Set<Pair<String, String>> data = cve.getVendorProductList();
- 231 1 for (Pair<String, String> pair : data) {
- 232 21494 saveEntry(pair.getLeft(), pair.getRight(), indexWriter);
- 233 21494 }
+ 230 2 final Set<Pair<String, String>> data = cve.getVendorProductList();
+ 231 2 for (Pair<String, String> pair : data) {
+ 232 44272 saveEntry(pair.getLeft(), pair.getRight(), indexWriter);
+ 233 44272 }
234 0 } catch (DatabaseException ex) {
235 0 LOGGER.log(Level.FINE, null , ex);
236 0 throw new IndexException("Error reading CPE data" , ex);
- 237 1 }
+ 237 2 }
238 0 } catch (CorruptIndexException ex) {
239 0 throw new IndexException("Unable to close an in-memory index" , ex);
240 0 } catch (IOException ex) {
241 0 throw new IndexException("Unable to close an in-memory index" , ex);
242
} finally {
- 243 1 if (indexWriter != null ) {
+ 243 2 if (indexWriter != null ) {
244
try {
245
try {
- 246 1 indexWriter.commit();
+ 246 2 indexWriter.commit();
247
} finally {
- 248 1 indexWriter.close(true );
- 249 1 }
+ 248 2 indexWriter.close(true );
+ 249 2 }
250 0 } catch (CorruptIndexException ex) {
251 0 throw new IndexException("Unable to close an in-memory index" , ex);
252 0 } catch (IOException ex) {
253 0 throw new IndexException("Unable to close an in-memory index" , ex);
- 254 1 }
- 255 1 if (analyzer != null ) {
- 256 1 analyzer.close();
+ 254 2 }
+ 255 2 if (analyzer != null ) {
+ 256 2 analyzer.close();
257
}
258
}
259
}
- 260 1 }
+ 260 2 }
261
262
@@ -501,12 +501,12 @@
283
public TopDocs search(String searchString, int maxQueryResults) throws ParseException, IOException {
- 284 8 if (searchString == null || searchString.trim().isEmpty()) {
+ 284 16 if (searchString == null || searchString.trim().isEmpty()) {
285 0 throw new ParseException("Query is null or empty" );
286
}
- 287 8 final Query query = queryParser.parse(searchString);
- 288 8 return indexSearcher.search(query, maxQueryResults);
+ 287 16 final Query query = queryParser.parse(searchString);
+ 288 16 return indexSearcher.search(query, maxQueryResults);
289
}
290
@@ -553,7 +553,7 @@
312
public Document getDocument(int documentId) throws IOException {
- 313 54 return indexSearcher.doc(documentId);
+ 313 108 return indexSearcher.doc(documentId);
314
}
315
@@ -570,17 +570,17 @@
321
public int numDocs() {
- 322 1 if (indexReader == null ) {
+ 322 2 if (indexReader == null ) {
323 0 return -1;
324
}
- 325 1 return indexReader.numDocs();
+ 325 2 return indexReader.numDocs();
326
}
327
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.Fields.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.Fields.html
index 5c79f48f5..435dafe90 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.Fields.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.Fields.html
@@ -103,6 +103,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.IndexEntry.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.IndexEntry.html
index df24c6a28..074716292 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.IndexEntry.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.IndexEntry.html
@@ -302,19 +302,19 @@
144
public void parseName(String cpeName) throws UnsupportedEncodingException {
- 145 1 if (cpeName != null && cpeName.length() > 7) {
- 146 1 final String[] data = cpeName.substring(7).split(":" );
- 147 1 if (data.length >= 1) {
- 148 1 vendor = URLDecoder.decode(data[0].replace("+" , "%2B" ), "UTF-8" );
- 149 1 if (data.length >= 2) {
- 150 1 product = URLDecoder.decode(data[1].replace("+" , "%2B" ), "UTF-8" );
+ 145 2 if (cpeName != null && cpeName.length() > 7) {
+ 146 2 final String[] data = cpeName.substring(7).split(":" );
+ 147 2 if (data.length >= 1) {
+ 148 2 vendor = URLDecoder.decode(data[0].replace("+" , "%2B" ), "UTF-8" );
+ 149 2 if (data.length >= 2) {
+ 150 2 product = URLDecoder.decode(data[1].replace("+" , "%2B" ), "UTF-8" );
151
}
152
}
153
}
- 154 1 }
+ 154 2 }
155
156
@@ -332,21 +332,21 @@
@Override
164
public boolean equals(Object obj) {
- 165 336 if (obj == null ) {
+ 165 672 if (obj == null ) {
166 0 return false ;
167
}
- 168 336 if (getClass() != obj.getClass()) {
+ 168 672 if (getClass() != obj.getClass()) {
169 0 return false ;
170
}
- 171 336 final IndexEntry other = (IndexEntry) obj;
- 172 336 if ((this .vendor == null ) ? (other.vendor != null ) : !this .vendor.equals(other.vendor)) {
- 173 279 return false ;
+ 171 672 final IndexEntry other = (IndexEntry) obj;
+ 172 672 if ((this .vendor == null ) ? (other.vendor != null ) : !this .vendor.equals(other.vendor)) {
+ 173 558 return false ;
174
}
- 175 57 if ((this .product == null ) ? (other.product != null ) : !this .product.equals(other.product)) {
- 176 57 return false ;
+ 175 114 if ((this .product == null ) ? (other.product != null ) : !this .product.equals(other.product)) {
+ 176 114 return false ;
177
}
178 0 return true ;
@@ -375,6 +375,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.IndexException.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.IndexException.html
index 91a649f9b..553bc4b04 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.IndexException.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cpe.IndexException.html
@@ -151,6 +151,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cwe.CweDB.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cwe.CweDB.html
index b1d7396be..be9b40b80 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cwe.CweDB.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cwe.CweDB.html
@@ -85,7 +85,7 @@
34
- 35 1 private static final Logger LOGGER = Logger.getLogger(CweDB.class .getName());
+ 35 2 private static final Logger LOGGER = Logger.getLogger(CweDB.class .getName());
36
37
@@ -104,7 +104,7 @@
44
- 45 1 private static final HashMap<String, String> CWE = loadData();
+ 45 2 private static final HashMap<String, String> CWE = loadData();
46
47
@@ -119,13 +119,13 @@
52
private static HashMap<String, String> loadData() {
- 53 1 ObjectInputStream oin = null ;
+ 53 2 ObjectInputStream oin = null ;
54
try {
- 55 1 final String filePath = "data/cwe.hashmap.serialized" ;
- 56 1 final InputStream input = CweDB.class .getClassLoader().getResourceAsStream(filePath);
- 57 1 oin = new ObjectInputStream(input);
- 58 1 return (HashMap<String, String>) oin.readObject();
+ 55 2 final String filePath = "data/cwe.hashmap.serialized" ;
+ 56 2 final InputStream input = CweDB.class .getClassLoader().getResourceAsStream(filePath);
+ 57 2 oin = new ObjectInputStream(input);
+ 58 2 return (HashMap<String, String>) oin.readObject();
59 0 } catch (ClassNotFoundException ex) {
60 0 LOGGER.log(Level.WARNING, "Unable to load CWE data. This should not be an issue." );
61 0 LOGGER.log(Level.FINE, null , ex);
@@ -134,13 +134,13 @@
64 0 LOGGER.log(Level.FINE, null , ex);
65
} finally {
- 66 1 if (oin != null ) {
+ 66 2 if (oin != null ) {
67
try {
- 68 1 oin.close();
+ 68 2 oin.close();
69 0 } catch (IOException ex) {
70 0 LOGGER.log(Level.FINEST, null , ex);
- 71 2 }
+ 71 4 }
72
}
73
@@ -166,8 +166,8 @@
84
public static String getCweName(String cweId) {
- 85 4 if (cweId != null ) {
- 86 4 return CWE.get(cweId);
+ 85 18 if (cweId != null ) {
+ 86 18 return CWE.get(cweId);
87
}
88 0 return null ;
@@ -177,6 +177,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cwe.CweHandler.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cwe.CweHandler.html
index 3126a6968..1348d203e 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cwe.CweHandler.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.cwe.CweHandler.html
@@ -122,6 +122,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.AbstractTokenizingFilter.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.AbstractTokenizingFilter.html
index 044f8286b..4a9005cf4 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.AbstractTokenizingFilter.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.AbstractTokenizingFilter.html
@@ -85,7 +85,7 @@
34
- 35 11 private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class );
+ 35 17 private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class );
36
37
@@ -144,9 +144,9 @@
64
public AbstractTokenizingFilter(TokenStream stream) {
- 65 11 super (stream);
- 66 11 tokens = new LinkedList<String>();
- 67 11 }
+ 65 17 super (stream);
+ 66 17 tokens = new LinkedList<String>();
+ 67 17 }
68
69
@@ -161,20 +161,20 @@
74
protected boolean addTerm() {
- 75 32759 final boolean termAdded = tokens.size() > 0;
- 76 32777 if (termAdded) {
- 77 21691 final String term = tokens.pop();
- 78 21690 clearAttributes();
- 79 21690 termAtt.append(term);
+ 75 34893 final boolean termAdded = tokens.size() > 0;
+ 76 34890 if (termAdded) {
+ 77 22715 final String term = tokens.pop();
+ 78 22718 clearAttributes();
+ 79 22717 termAtt.append(term);
80
}
- 81 32766 return termAdded;
+ 81 34894 return termAdded;
82
}
83
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.AlphaNumericTokenizer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.AlphaNumericTokenizer.html
index 7dec0b2e7..e367f8eb4 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.AlphaNumericTokenizer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.AlphaNumericTokenizer.html
@@ -135,13 +135,13 @@
@Override
59
protected boolean isTokenChar(int c) {
- 60 501912 return Character.isLetter(c) || Character.isDigit(c);
+ 60 1036730 return Character.isLetter(c) || Character.isDigit(c);
61
}
62
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.DependencySimilarity.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.DependencySimilarity.html
index 2f3238297..6536f562c 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.DependencySimilarity.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.DependencySimilarity.html
@@ -112,6 +112,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.FieldAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.FieldAnalyzer.html
index 262b7fcd2..5a6aa1a5f 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.FieldAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.FieldAnalyzer.html
@@ -139,13 +139,13 @@
@Override
61
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
- 62 3 final Tokenizer source = new AlphaNumericTokenizer(version, reader);
+ 62 6 final Tokenizer source = new AlphaNumericTokenizer(version, reader);
63
- 64 3 TokenStream stream = source;
+ 64 6 TokenStream stream = source;
65
- 66 3 stream = new WordDelimiterFilter(stream,
+ 66 6 stream = new WordDelimiterFilter(stream,
67
WordDelimiterFilter.CATENATE_WORDS
68
@@ -162,17 +162,17 @@
| WordDelimiterFilter.STEM_ENGLISH_POSSESSIVE, null );
74
- 75 3 stream = new LowerCaseFilter(version, stream);
- 76 3 stream = new StopFilter(version, stream, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
+ 75 6 stream = new LowerCaseFilter(version, stream);
+ 76 6 stream = new StopFilter(version, stream, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
77
- 78 3 return new TokenStreamComponents(source, stream);
+ 78 6 return new TokenStreamComponents(source, stream);
79
}
80
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.LuceneUtils.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.LuceneUtils.html
index a93b156ac..519fb8155 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.LuceneUtils.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.LuceneUtils.html
@@ -83,7 +83,7 @@
33
- 34 1 public static final Version CURRENT_VERSION = Version.LUCENE_45;
+ 34 2 public static final Version CURRENT_VERSION = Version.LUCENE_45;
35
36
@@ -124,15 +124,15 @@
final CharSequence text) {
54
- 55 227 if (text == null || buf == null ) {
- 56 1 return ;
+ 55 454 if (text == null || buf == null ) {
+ 56 2 return ;
57
}
58
- 59 2333 for (int i = 0; i < text.length(); i++) {
- 60 2107 final char c = text.charAt(i);
- 61 2107 switch (c) {
+ 59 4666 for (int i = 0; i < text.length(); i++) {
+ 60 4214 final char c = text.charAt(i);
+ 61 4214 switch (c) {
62
case '+' :
63
@@ -169,17 +169,17 @@
case ':' :
79
case '\\' :
- 80 72 buf.append('\\' );
+ 80 144 buf.append('\\' );
81
default :
- 82 2107 buf.append(c);
+ 82 4214 buf.append(c);
83
break ;
84
}
85
}
- 86 226 }
+ 86 452 }
87
88
@@ -198,27 +198,27 @@
public static String escapeLuceneQuery(final CharSequence text) {
95
- 96 226 if (text == null ) {
- 97 1 return null ;
+ 96 452 if (text == null ) {
+ 97 2 return null ;
98
}
99
- 100 225 int size = text.length();
- 101 225 size = size >> 1;
- 102 225 final StringBuilder buf = new StringBuilder(size);
+ 100 450 int size = text.length();
+ 101 450 size = size >> 1;
+ 102 450 final StringBuilder buf = new StringBuilder(size);
103
- 104 225 appendEscapedLuceneQuery(buf, text);
+ 104 450 appendEscapedLuceneQuery(buf, text);
105
- 106 225 return buf.toString();
+ 106 450 return buf.toString();
107
}
108
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.SearchFieldAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.SearchFieldAnalyzer.html
index f30d01650..617256693 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.SearchFieldAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.SearchFieldAnalyzer.html
@@ -145,13 +145,13 @@
@Override
64
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
- 65 4 final Tokenizer source = new AlphaNumericTokenizer(version, reader);
+ 65 8 final Tokenizer source = new AlphaNumericTokenizer(version, reader);
66
- 67 4 TokenStream stream = source;
+ 67 8 TokenStream stream = source;
68
- 69 4 stream = new WordDelimiterFilter(stream,
+ 69 8 stream = new WordDelimiterFilter(stream,
70
WordDelimiterFilter.GENERATE_WORD_PARTS
71
@@ -166,14 +166,14 @@
| WordDelimiterFilter.STEM_ENGLISH_POSSESSIVE, null );
76
- 77 4 stream = new LowerCaseFilter(version, stream);
- 78 4 stream = new UrlTokenizingFilter(stream);
- 79 4 concatenatingFilter = new TokenPairConcatenatingFilter(stream);
- 80 4 stream = concatenatingFilter;
- 81 4 stream = new StopFilter(version, stream, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
+ 77 8 stream = new LowerCaseFilter(version, stream);
+ 78 8 stream = new UrlTokenizingFilter(stream);
+ 79 8 concatenatingFilter = new TokenPairConcatenatingFilter(stream);
+ 80 8 stream = concatenatingFilter;
+ 81 8 stream = new StopFilter(version, stream, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
82
- 83 4 return new TokenStreamComponents(source, stream);
+ 83 8 return new TokenStreamComponents(source, stream);
84
}
85
@@ -194,15 +194,15 @@
93
public void clear() {
- 94 2 if (concatenatingFilter != null ) {
- 95 2 concatenatingFilter.clear();
+ 94 4 if (concatenatingFilter != null ) {
+ 95 4 concatenatingFilter.clear();
96
}
- 97 2 }
+ 97 4 }
98
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.SearchVersionAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.SearchVersionAnalyzer.html
index 9ba309179..bfe4881d3 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.SearchVersionAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.SearchVersionAnalyzer.html
@@ -158,6 +158,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.TokenPairConcatenatingFilter.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.TokenPairConcatenatingFilter.html
index f8c66d45c..bbaefdc06 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.TokenPairConcatenatingFilter.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.TokenPairConcatenatingFilter.html
@@ -93,7 +93,7 @@
38
- 39 6 private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class );
+ 39 12 private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class );
40
41
@@ -160,9 +160,9 @@
72
public TokenPairConcatenatingFilter(TokenStream stream) {
- 73 6 super (stream);
- 74 6 words = new LinkedList<String>();
- 75 6 }
+ 73 12 super (stream);
+ 74 12 words = new LinkedList<String>();
+ 75 12 }
76
77
@@ -187,35 +187,35 @@
87
- 88 1540 while (input.incrementToken()) {
- 89 439 final String word = new String(termAtt.buffer(), 0, termAtt.length());
- 90 439 words.add(word);
- 91 439 }
+ 88 3080 while (input.incrementToken()) {
+ 89 878 final String word = new String(termAtt.buffer(), 0, termAtt.length());
+ 90 878 words.add(word);
+ 91 878 }
92
93
94
- 95 1101 if (previousWord != null && words.size() > 0) {
- 96 431 final String word = words.getFirst();
- 97 431 clearAttributes();
- 98 431 termAtt.append(previousWord).append(word);
- 99 431 previousWord = null ;
- 100 431 return true ;
+ 95 2202 if (previousWord != null && words.size() > 0) {
+ 96 862 final String word = words.getFirst();
+ 97 862 clearAttributes();
+ 98 862 termAtt.append(previousWord).append(word);
+ 99 862 previousWord = null ;
+ 100 862 return true ;
101
}
102
- 103 670 if (words.size() > 0) {
- 104 439 final String word = words.removeFirst();
- 105 439 clearAttributes();
- 106 439 termAtt.append(word);
- 107 439 previousWord = word;
- 108 439 return true ;
+ 103 1340 if (words.size() > 0) {
+ 104 878 final String word = words.removeFirst();
+ 105 878 clearAttributes();
+ 106 878 termAtt.append(word);
+ 107 878 previousWord = word;
+ 108 878 return true ;
109
}
- 110 231 return false ;
+ 110 462 return false ;
111
}
112
@@ -236,13 +236,13 @@
120
public void clear() {
- 121 3 previousWord = null ;
- 122 3 words.clear();
- 123 3 }
+ 121 6 previousWord = null ;
+ 122 6 words.clear();
+ 123 6 }
124
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.UrlTokenizingFilter.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.UrlTokenizingFilter.html
index 4718e3fa9..944378bbb 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.UrlTokenizingFilter.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.UrlTokenizingFilter.html
@@ -99,7 +99,7 @@
41
- 42 1 private static final Logger LOGGER = Logger.getLogger(UrlTokenizingFilter.class .getName());
+ 42 2 private static final Logger LOGGER = Logger.getLogger(UrlTokenizingFilter.class .getName());
43
44
@@ -136,22 +136,22 @@
@Override
60
public boolean incrementToken() throws IOException {
- 61 31383 final LinkedList<String> tokens = getTokens();
- 62 32815 final CharTermAttribute termAtt = getTermAtt();
- 63 32812 if (tokens.size() == 0 && input.incrementToken()) {
- 64 21697 final String text = new String(termAtt.buffer(), 0, termAtt.length());
- 65 21687 if (UrlStringUtils.containsUrl(text)) {
- 66 2 final String[] parts = text.split("\\s" );
- 67 4 for (String part : parts) {
- 68 2 if (UrlStringUtils.isUrl(part)) {
+ 61 34967 final LinkedList<String> tokens = getTokens();
+ 62 34971 final CharTermAttribute termAtt = getTermAtt();
+ 63 34973 if (tokens.size() == 0 && input.incrementToken()) {
+ 64 22705 final String text = new String(termAtt.buffer(), 0, termAtt.length());
+ 65 22705 if (UrlStringUtils.containsUrl(text)) {
+ 66 4 final String[] parts = text.split("\\s" );
+ 67 8 for (String part : parts) {
+ 68 4 if (UrlStringUtils.isUrl(part)) {
69
try {
- 70 2 final List<String> data = UrlStringUtils.extractImportantUrlData(part);
- 71 2 tokens.addAll(data);
+ 70 4 final List<String> data = UrlStringUtils.extractImportantUrlData(part);
+ 71 4 tokens.addAll(data);
72 0 } catch (MalformedURLException ex) {
73 0 LOGGER.log(Level.FINE, "error parsing " + part, ex);
74 0 tokens.add(part);
- 75 2 }
+ 75 4 }
76
} else {
77 0 tokens.add(part);
@@ -159,19 +159,19 @@
}
79
}
- 80 2 } else {
- 81 21680 tokens.add(text);
+ 80 4 } else {
+ 81 22707 tokens.add(text);
82
}
83
}
- 84 32732 return addTerm();
+ 84 34887 return addTerm();
85
}
86
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.VersionAnalyzer.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.VersionAnalyzer.html
index 81b105e1e..161e5739c 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.VersionAnalyzer.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.VersionAnalyzer.html
@@ -157,6 +157,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.VersionTokenizingFilter.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.VersionTokenizingFilter.html
index a4e875586..5c22fb8ab 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.VersionTokenizingFilter.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.lucene.VersionTokenizingFilter.html
@@ -195,6 +195,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nexus.MavenArtifact.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nexus.MavenArtifact.html
index 81f59a977..c3c2af97d 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nexus.MavenArtifact.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nexus.MavenArtifact.html
@@ -158,12 +158,12 @@
73
- 74 1 public MavenArtifact(String groupId, String artifactId, String version, String url) {
- 75 1 setGroupId(groupId);
- 76 1 setArtifactId(artifactId);
- 77 1 setVersion(version);
- 78 1 setArtifactUrl(url);
- 79 1 }
+ 74 2 public MavenArtifact(String groupId, String artifactId, String version, String url) {
+ 75 2 setGroupId(groupId);
+ 76 2 setArtifactId(artifactId);
+ 77 2 setVersion(version);
+ 78 2 setArtifactUrl(url);
+ 79 2 }
80
81
@@ -335,6 +335,6 @@
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nexus.NexusSearch.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nexus.NexusSearch.html
index 2a609a514..57d0ed938 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nexus.NexusSearch.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nexus.NexusSearch.html
@@ -125,7 +125,7 @@
54
- 55 1 private static final Logger LOGGER = Logger.getLogger(NexusSearch.class
+ 55 2 private static final Logger LOGGER = Logger.getLogger(NexusSearch.class
56
.getName());
57
@@ -142,25 +142,25 @@
63
- 64 4 public NexusSearch(URL rootURL) {
- 65 4 this .rootURL = rootURL;
+ 64 8 public NexusSearch(URL rootURL) {
+ 65 8 this .rootURL = rootURL;
66
try {
- 67 4 if (null != Settings.getString(Settings.KEYS.PROXY_URL)
+ 67 8 if (null != Settings.getString(Settings.KEYS.PROXY_SERVER)
68
&& Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY)) {
69 0 useProxy = true ;
70 0 LOGGER.fine("Using proxy" );
71
} else {
- 72 4 useProxy = false ;
- 73 4 LOGGER.fine("Not using proxy" );
+ 72 8 useProxy = false ;
+ 73 8 LOGGER.fine("Not using proxy" );
74
}
75 0 } catch (InvalidSettingException ise) {
76 0 useProxy = false ;
- 77 4 }
- 78 4 }
+ 77 8 }
+ 78 8 }
79
80
@@ -183,18 +183,18 @@
89
public MavenArtifact searchSha1(String sha1) throws IOException {
- 90 4 if (null == sha1 || !sha1.matches("^[0-9A-Fa-f]{40}$" )) {
- 91 2 throw new IllegalArgumentException("Invalid SHA1 format" );
+ 90 8 if (null == sha1 || !sha1.matches("^[0-9A-Fa-f]{40}$" )) {
+ 91 4 throw new IllegalArgumentException("Invalid SHA1 format" );
92
}
93
- 94 2 final URL url = new URL(rootURL, String.format("identify/sha1/%s" ,
+ 94 4 final URL url = new URL(rootURL, String.format("identify/sha1/%s" ,
95
sha1.toLowerCase()));
96
- 97 2 LOGGER.fine(String.format("Searching Nexus url %s" , url.toString()));
+ 97 4 LOGGER.fine(String.format("Searching Nexus url %s" , url.toString()));
98
99
@@ -207,55 +207,55 @@
103
- 104 2 final HttpURLConnection conn = URLConnectionFactory.createHttpURLConnection(url, useProxy);
+ 104 4 final HttpURLConnection conn = URLConnectionFactory.createHttpURLConnection(url, useProxy);
105
- 106 2 conn.setDoOutput(true );
+ 106 4 conn.setDoOutput(true );
107
108
109
- 110 2 conn.addRequestProperty("Accept" , "application/xml" );
- 111 2 conn.connect();
+ 110 4 conn.addRequestProperty("Accept" , "application/xml" );
+ 111 4 conn.connect();
112
- 113 2 if (conn.getResponseCode() == 200) {
+ 113 4 if (conn.getResponseCode() == 200) {
114
try {
- 115 1 final DocumentBuilder builder = DocumentBuilderFactory
+ 115 2 final DocumentBuilder builder = DocumentBuilderFactory
116
.newInstance().newDocumentBuilder();
- 117 1 final Document doc = builder.parse(conn.getInputStream());
- 118 1 final XPath xpath = XPathFactory.newInstance().newXPath();
- 119 1 final String groupId = xpath
+ 117 2 final Document doc = builder.parse(conn.getInputStream());
+ 118 2 final XPath xpath = XPathFactory.newInstance().newXPath();
+ 119 2 final String groupId = xpath
120
.evaluate(
121
"/org.sonatype.nexus.rest.model.NexusArtifact/groupId" ,
122
doc);
- 123 1 final String artifactId = xpath.evaluate(
+ 123 2 final String artifactId = xpath.evaluate(
124
"/org.sonatype.nexus.rest.model.NexusArtifact/artifactId" ,
125
doc);
- 126 1 final String version = xpath
+ 126 2 final String version = xpath
127
.evaluate(
128
"/org.sonatype.nexus.rest.model.NexusArtifact/version" ,
129
doc);
- 130 1 final String link = xpath
+ 130 2 final String link = xpath
131
.evaluate(
132
"/org.sonatype.nexus.rest.model.NexusArtifact/artifactLink" ,
133
doc);
- 134 1 return new MavenArtifact(groupId, artifactId, version, link);
+ 134 2 return new MavenArtifact(groupId, artifactId, version, link);
135 0 } catch (Throwable e) {
136
@@ -264,8 +264,8 @@
138 0 throw new IOException(e.getMessage(), e);
139
}
- 140 1 } else if (conn.getResponseCode() == 404) {
- 141 1 throw new FileNotFoundException("Artifact not found in Nexus" );
+ 140 2 } else if (conn.getResponseCode() == 404) {
+ 141 2 throw new FileNotFoundException("Artifact not found in Nexus" );
142
} else {
143 0 final String msg = String.format("Could not connect to Nexus received response code: %d %s" ,
@@ -293,27 +293,27 @@
public boolean preflightRequest() {
156
try {
- 157 4 final HttpURLConnection conn = URLConnectionFactory.createHttpURLConnection(new URL(rootURL, "status" ), useProxy);
- 158 4 conn.addRequestProperty("Accept" , "application/xml" );
- 159 4 conn.connect();
- 160 4 if (conn.getResponseCode() != 200) {
+ 157 8 final HttpURLConnection conn = URLConnectionFactory.createHttpURLConnection(new URL(rootURL, "status" ), useProxy);
+ 158 8 conn.addRequestProperty("Accept" , "application/xml" );
+ 159 8 conn.connect();
+ 160 8 if (conn.getResponseCode() != 200) {
161 0 LOGGER.log(Level.WARNING, "Expected 200 result from Nexus, got {0}" , conn.getResponseCode());
162 0 return false ;
163
}
- 164 4 final DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- 165 4 final Document doc = builder.parse(conn.getInputStream());
- 166 4 if (!"status" .equals(doc.getDocumentElement().getNodeName())) {
+ 164 8 final DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ 165 8 final Document doc = builder.parse(conn.getInputStream());
+ 166 8 if (!"status" .equals(doc.getDocumentElement().getNodeName())) {
167 0 LOGGER.log(Level.WARNING, "Expected root node name of status, got {0}" , doc.getDocumentElement().getNodeName());
168 0 return false ;
169
}
170 0 } catch (Throwable e) {
171 0 return false ;
- 172 4 }
+ 172 8 }
173
- 174 4 return true ;
+ 174 8 return true ;
175
}
176
@@ -324,6 +324,6 @@
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NugetPackage.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NugetPackage.html
index 5ecfbdf7c..bd3908378 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NugetPackage.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NugetPackage.html
@@ -377,6 +377,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NuspecParseException.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NuspecParseException.html
index 08af23164..a09d59319 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NuspecParseException.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NuspecParseException.html
@@ -153,6 +153,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NuspecParser.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NuspecParser.html
index 1bf44e4f1..dd1f84141 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NuspecParser.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.NuspecParser.html
@@ -93,6 +93,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.XPathNuspecParser.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.XPathNuspecParser.html
index d63e0b5f6..c124a8f2b 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.XPathNuspecParser.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nuget.XPathNuspecParser.html
@@ -99,8 +99,8 @@
41
private String getOrNull(Node n) {
- 42 3 if (n != null ) {
- 43 3 return n.getTextContent();
+ 42 6 if (n != null ) {
+ 43 6 return n.getTextContent();
44
} else {
45 0 return null ;
@@ -130,32 +130,32 @@
public NugetPackage parse(InputStream stream) throws NuspecParseException {
58
try {
- 59 3 final Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(stream);
- 60 2 final XPath xpath = XPathFactory.newInstance().newXPath();
- 61 2 final NugetPackage nuspec = new NugetPackage();
+ 59 6 final Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(stream);
+ 60 4 final XPath xpath = XPathFactory.newInstance().newXPath();
+ 61 4 final NugetPackage nuspec = new NugetPackage();
62
- 63 2 if (xpath.evaluate("/package/metadata/id" , d, XPathConstants.NODE) == null
+ 63 4 if (xpath.evaluate("/package/metadata/id" , d, XPathConstants.NODE) == null
64
|| xpath.evaluate("/package/metadata/version" , d, XPathConstants.NODE) == null
65
|| xpath.evaluate("/package/metadata/authors" , d, XPathConstants.NODE) == null
66
|| xpath.evaluate("/package/metadata/description" , d, XPathConstants.NODE) == null ) {
- 67 1 throw new NuspecParseException("Invalid Nuspec format" );
+ 67 2 throw new NuspecParseException("Invalid Nuspec format" );
68
}
69
- 70 1 nuspec.setId(xpath.evaluate("/package/metadata/id" , d));
- 71 1 nuspec.setVersion(xpath.evaluate("/package/metadata/version" , d));
- 72 1 nuspec.setAuthors(xpath.evaluate("/package/metadata/authors" , d));
- 73 1 nuspec.setOwners(getOrNull((Node) xpath.evaluate("/package/metadata/owners" , d, XPathConstants.NODE)));
- 74 1 nuspec.setLicenseUrl(getOrNull((Node) xpath.evaluate("/package/metadata/licenseUrl" , d, XPathConstants.NODE)));
- 75 1 nuspec.setTitle(getOrNull((Node) xpath.evaluate("/package/metadata/title" , d, XPathConstants.NODE)));
- 76 1 return nuspec;
- 77 2 } catch (Throwable e) {
- 78 2 throw new NuspecParseException("Unable to parse nuspec" , e);
+ 70 2 nuspec.setId(xpath.evaluate("/package/metadata/id" , d));
+ 71 2 nuspec.setVersion(xpath.evaluate("/package/metadata/version" , d));
+ 72 2 nuspec.setAuthors(xpath.evaluate("/package/metadata/authors" , d));
+ 73 2 nuspec.setOwners(getOrNull((Node) xpath.evaluate("/package/metadata/owners" , d, XPathConstants.NODE)));
+ 74 2 nuspec.setLicenseUrl(getOrNull((Node) xpath.evaluate("/package/metadata/licenseUrl" , d, XPathConstants.NODE)));
+ 75 2 nuspec.setTitle(getOrNull((Node) xpath.evaluate("/package/metadata/title" , d, XPathConstants.NODE)));
+ 76 2 return nuspec;
+ 77 4 } catch (Throwable e) {
+ 78 4 throw new NuspecParseException("Unable to parse nuspec" , e);
79
}
80
@@ -164,6 +164,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.ConnectionFactory.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.ConnectionFactory.html
index 986399504..7695c96cb 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.ConnectionFactory.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.ConnectionFactory.html
@@ -111,7 +111,7 @@
47
- 48 1 private static final Logger LOGGER = Logger.getLogger(ConnectionFactory.class .getName());
+ 48 2 private static final Logger LOGGER = Logger.getLogger(ConnectionFactory.class .getName());
49
50
@@ -134,28 +134,28 @@
59
- 60 1 private static Driver driver = null ;
+ 60 2 private static Driver driver = null ;
61
62
63
- 64 1 private static String connectionString = null ;
+ 64 2 private static String connectionString = null ;
65
66
67
- 68 1 private static String userName = null ;
+ 68 2 private static String userName = null ;
69
70
71
- 72 1 private static String password = null ;
+ 72 2 private static String password = null ;
73
74
@@ -186,68 +186,68 @@
public static synchronized void initialize() throws DatabaseException {
87
- 88 7 if (connectionString != null ) {
- 89 6 return ;
+ 88 14 if (connectionString != null ) {
+ 89 12 return ;
90
}
- 91 1 Connection conn = null ;
+ 91 2 Connection conn = null ;
92
try {
93
- 94 1 final String driverName = Settings.getString(Settings.KEYS.DB_DRIVER_NAME, "" );
- 95 1 if (!driverName.isEmpty()) {
- 96 1 LOGGER.log(Level.FINE, "Loading driver: {0}" , driverName);
- 97 1 final String driverPath = Settings.getString(Settings.KEYS.DB_DRIVER_PATH, "" );
+ 94 2 final String driverName = Settings.getString(Settings.KEYS.DB_DRIVER_NAME, "" );
+ 95 2 if (!driverName.isEmpty()) {
+ 96 2 LOGGER.log(Level.FINE, "Loading driver: {0}" , driverName);
+ 97 2 final String driverPath = Settings.getString(Settings.KEYS.DB_DRIVER_PATH, "" );
98
try {
- 99 1 if (!driverPath.isEmpty()) {
+ 99 2 if (!driverPath.isEmpty()) {
100 0 LOGGER.log(Level.FINE, "Loading driver from: {0}" , driverPath);
101 0 driver = DriverLoader.load(driverName, driverPath);
102
} else {
- 103 1 driver = DriverLoader.load(driverName);
+ 103 2 driver = DriverLoader.load(driverName);
104
}
105 0 } catch (DriverLoadException ex) {
106 0 LOGGER.log(Level.FINE, "Unable to load database driver" , ex);
107 0 throw new DatabaseException("Unable to load database driver" );
- 108 1 }
+ 108 2 }
109
}
- 110 1 userName = Settings.getString(Settings.KEYS.DB_USER, "dcuser" );
+ 110 2 userName = Settings.getString(Settings.KEYS.DB_USER, "dcuser" );
111
- 112 1 password = Settings.getString(Settings.KEYS.DB_PASSWORD, "DC-Pass1337!" );
+ 112 2 password = Settings.getString(Settings.KEYS.DB_PASSWORD, "DC-Pass1337!" );
113
try {
- 114 1 connectionString = getConnectionString();
+ 114 2 connectionString = getConnectionString();
115 0 } catch (IOException ex) {
116 0 LOGGER.log(Level.FINE,
117
"Unable to retrieve the database connection string" , ex);
118 0 throw new DatabaseException("Unable to retrieve the database connection string" );
- 119 1 }
- 120 1 boolean shouldCreateSchema = false ;
+ 119 2 }
+ 120 2 boolean shouldCreateSchema = false ;
121
try {
- 122 1 if (connectionString.startsWith("jdbc:h2:file:" )) {
- 123 1 shouldCreateSchema = !dbSchemaExists();
- 124 1 LOGGER.log(Level.FINE, "Need to create DB Structure: {0}" , shouldCreateSchema);
+ 122 2 if (connectionString.startsWith("jdbc:h2:file:" )) {
+ 123 2 shouldCreateSchema = !dbSchemaExists();
+ 124 2 LOGGER.log(Level.FINE, "Need to create DB Structure: {0}" , shouldCreateSchema);
125
}
126 0 } catch (IOException ioex) {
127 0 LOGGER.log(Level.FINE, "Unable to verify database exists" , ioex);
128 0 throw new DatabaseException("Unable to verify database exists" );
- 129 1 }
- 130 1 LOGGER.log(Level.FINE, "Loading database connection" );
- 131 1 LOGGER.log(Level.FINE, "Connection String: {0}" , connectionString);
- 132 1 LOGGER.log(Level.FINE, "Database User: {0}" , userName);
+ 129 2 }
+ 130 2 LOGGER.log(Level.FINE, "Loading database connection" );
+ 131 2 LOGGER.log(Level.FINE, "Connection String: {0}" , connectionString);
+ 132 2 LOGGER.log(Level.FINE, "Database User: {0}" , userName);
133
134
try {
- 135 1 conn = DriverManager.getConnection(connectionString, userName, password);
+ 135 2 conn = DriverManager.getConnection(connectionString, userName, password);
136 0 } catch (SQLException ex) {
137 0 if (ex.getMessage().contains("java.net.UnknownHostException" ) && connectionString.contains("AUTO_SERVER=TRUE;" )) {
138 0 connectionString = connectionString.replace("AUTO_SERVER=TRUE;" , "" );
@@ -268,10 +268,10 @@
150 0 throw new DatabaseException("Unable to connect to the database" );
151
}
- 152 1 }
+ 152 2 }
153
- 154 1 if (shouldCreateSchema) {
+ 154 2 if (shouldCreateSchema) {
155
try {
156 0 createTables(conn);
@@ -283,27 +283,27 @@
} else {
162
try {
- 163 1 ensureSchemaVersion(conn);
+ 163 2 ensureSchemaVersion(conn);
164 0 } catch (DatabaseException dex) {
165 0 LOGGER.log(Level.FINE, null , dex);
166 0 throw new DatabaseException("Database schema does not match this version of dependency-check" );
- 167 1 }
+ 167 2 }
168
}
169
} finally {
- 170 1 if (conn != null ) {
+ 170 2 if (conn != null ) {
171
try {
- 172 1 conn.close();
+ 172 2 conn.close();
173 0 } catch (SQLException ex) {
174 0 LOGGER.log(Level.FINE, "An error occurred closing the connection" , ex);
- 175 1 }
+ 175 2 }
176
}
177
}
- 178 1 }
+ 178 2 }
179
180
@@ -352,16 +352,16 @@
208
public static Connection getConnection() throws DatabaseException {
- 209 6 initialize();
- 210 6 Connection conn = null ;
+ 209 12 initialize();
+ 210 12 Connection conn = null ;
211
try {
- 212 6 conn = DriverManager.getConnection(connectionString, userName, password);
+ 212 12 conn = DriverManager.getConnection(connectionString, userName, password);
213 0 } catch (SQLException ex) {
214 0 LOGGER.log(Level.FINE, null , ex);
215 0 throw new DatabaseException("Unable to connect to the database" );
- 216 6 }
- 217 6 return conn;
+ 216 12 }
+ 217 12 return conn;
218
}
219
@@ -382,12 +382,12 @@
227
private static String getConnectionString() throws IOException {
- 228 1 final String connStr = Settings.getString(Settings.KEYS.DB_CONNECTION_STRING, "jdbc:h2:file:%s;AUTO_SERVER=TRUE" );
- 229 1 if (connStr.contains("%s" )) {
- 230 1 final String directory = getDataDirectory().getCanonicalPath();
- 231 1 final File dataFile = new File(directory, "cve." + DB_SCHEMA_VERSION);
- 232 1 LOGGER.log(Level.FINE, String.format("File path for H2 file: '%s'" , dataFile.toString()));
- 233 1 return String.format(connStr, dataFile.getAbsolutePath());
+ 228 2 final String connStr = Settings.getString(Settings.KEYS.DB_CONNECTION_STRING, "jdbc:h2:file:%s;AUTO_SERVER=TRUE" );
+ 229 2 if (connStr.contains("%s" )) {
+ 230 2 final String directory = getDataDirectory().getCanonicalPath();
+ 231 2 final File dataFile = new File(directory, "cve." + DB_SCHEMA_VERSION);
+ 232 2 LOGGER.log(Level.FINE, String.format("File path for H2 file: '%s'" , dataFile.toString()));
+ 233 2 return String.format(connStr, dataFile.getAbsolutePath());
234
}
235 0 return connStr;
@@ -411,15 +411,15 @@
245
public static File getDataDirectory() throws IOException {
- 246 2 final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY);
- 247 2 if (!path.exists()) {
+ 246 4 final File path = Settings.getDataFile(Settings.KEYS.DATA_DIRECTORY);
+ 247 4 if (!path.exists()) {
248 0 if (!path.mkdirs()) {
249 0 throw new IOException("Unable to create NVD CVE Data directory" );
250
}
251
}
- 252 2 return path;
+ 252 4 return path;
253
}
254
@@ -438,10 +438,10 @@
261
private static boolean dbSchemaExists() throws IOException {
- 262 1 final File dir = getDataDirectory();
- 263 1 final String name = String.format("cve.%s.h2.db" , DB_SCHEMA_VERSION);
- 264 1 final File file = new File(dir, name);
- 265 1 return file.exists();
+ 262 2 final File dir = getDataDirectory();
+ 263 2 final String name = String.format("cve.%s.h2.db" , DB_SCHEMA_VERSION);
+ 264 2 final File file = new File(dir, name);
+ 265 2 return file.exists();
266
}
267
@@ -522,19 +522,19 @@
317
private static void ensureSchemaVersion(Connection conn) throws DatabaseException {
- 318 1 ResultSet rs = null ;
- 319 1 CallableStatement cs = null ;
+ 318 2 ResultSet rs = null ;
+ 319 2 CallableStatement cs = null ;
320
try {
- 321 1 cs = conn.prepareCall("SELECT value FROM properties WHERE id = 'version'" );
- 322 1 rs = cs.executeQuery();
- 323 1 if (rs.next()) {
- 324 1 final boolean isWrongSchema = !DB_SCHEMA_VERSION.equals(rs.getString(1));
- 325 1 if (isWrongSchema) {
+ 321 2 cs = conn.prepareCall("SELECT value FROM properties WHERE id = 'version'" );
+ 322 2 rs = cs.executeQuery();
+ 323 2 if (rs.next()) {
+ 324 2 final boolean isWrongSchema = !DB_SCHEMA_VERSION.equals(rs.getString(1));
+ 325 2 if (isWrongSchema) {
326 0 throw new DatabaseException("Incorrect database schema; unable to continue" );
327
}
- 328 1 } else {
+ 328 2 } else {
329 0 throw new DatabaseException("Database schema is missing" );
330
}
@@ -543,14 +543,14 @@
333 0 throw new DatabaseException("Unable to check the database schema version" );
334
} finally {
- 335 1 DBUtils.closeResultSet(rs);
- 336 1 DBUtils.closeStatement(cs);
- 337 1 }
- 338 1 }
+ 335 2 DBUtils.closeResultSet(rs);
+ 336 2 DBUtils.closeStatement(cs);
+ 337 2 }
+ 338 2 }
339
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.CorruptDatabaseException.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.CorruptDatabaseException.html
index 83f4c669f..8e491b1f2 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.CorruptDatabaseException.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.CorruptDatabaseException.html
@@ -121,6 +121,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DatabaseException.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DatabaseException.html
index 9db35ceb4..5ac2754e3 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DatabaseException.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DatabaseException.html
@@ -137,6 +137,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DatabaseProperties.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DatabaseProperties.html
index 0feeb0749..289c86729 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DatabaseProperties.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DatabaseProperties.html
@@ -99,7 +99,7 @@
41
- 42 1 private static final Logger LOGGER = Logger.getLogger(DatabaseProperties.class .getName());
+ 42 2 private static final Logger LOGGER = Logger.getLogger(DatabaseProperties.class .getName());
43
44
@@ -158,10 +158,10 @@
71
- 72 3 DatabaseProperties(CveDB cveDB) {
- 73 3 this .cveDB = cveDB;
- 74 3 loadProperties();
- 75 3 }
+ 72 6 DatabaseProperties(CveDB cveDB) {
+ 73 6 this .cveDB = cveDB;
+ 74 6 loadProperties();
+ 75 6 }
76
77
@@ -172,8 +172,8 @@
80
private void loadProperties() {
- 81 3 this .properties = cveDB.getProperties();
- 82 3 }
+ 81 6 this .properties = cveDB.getProperties();
+ 82 6 }
83
84
@@ -323,6 +323,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverLoadException.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverLoadException.html
index c5795115f..363170ece 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverLoadException.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverLoadException.html
@@ -137,6 +137,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverLoader.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverLoader.html
index 7fac7a7de..db6621742 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverLoader.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverLoader.html
@@ -102,7 +102,7 @@
42
- 43 1 private static final Logger LOGGER = Logger.getLogger(DriverLoader.class .getName());
+ 43 2 private static final Logger LOGGER = Logger.getLogger(DriverLoader.class .getName());
44
45
@@ -133,8 +133,8 @@
58
public static Driver load(String className) throws DriverLoadException {
- 59 3 final ClassLoader loader = DriverLoader.class .getClassLoader();
- 60 3 return load(className, loader);
+ 59 6 final ClassLoader loader = DriverLoader.class .getClassLoader();
+ 60 6 return load(className, loader);
61
}
62
@@ -167,56 +167,56 @@
76
public static Driver load(String className, String pathToDriver) throws DriverLoadException {
- 77 4 final URLClassLoader parent = (URLClassLoader) ClassLoader.getSystemClassLoader();
- 78 4 final ArrayList<URL> urls = new ArrayList<URL>();
- 79 4 final String[] paths = pathToDriver.split(File.pathSeparator);
- 80 9 for (String path : paths) {
- 81 5 final File file = new File(path);
- 82 5 if (file.isDirectory()) {
- 83 2 final File[] files = file.listFiles();
+ 77 8 final URLClassLoader parent = (URLClassLoader) ClassLoader.getSystemClassLoader();
+ 78 8 final ArrayList<URL> urls = new ArrayList<URL>();
+ 79 8 final String[] paths = pathToDriver.split(File.pathSeparator);
+ 80 18 for (String path : paths) {
+ 81 10 final File file = new File(path);
+ 82 10 if (file.isDirectory()) {
+ 83 4 final File[] files = file.listFiles();
84
- 85 34 for (File f : files) {
+ 85 68 for (File f : files) {
86
try {
- 87 32 urls.add(f.toURI().toURL());
+ 87 64 urls.add(f.toURI().toURL());
88 0 } catch (MalformedURLException ex) {
89 0 final String msg = String.format("Unable to load database driver '%s'; invalid path provided '%s'" ,
90
className, f.getAbsoluteFile());
91 0 LOGGER.log(Level.FINE, msg, ex);
92 0 throw new DriverLoadException(msg, ex);
- 93 32 }
+ 93 64 }
94
}
- 95 2 } else if (file.exists()) {
+ 95 4 } else if (file.exists()) {
96
try {
- 97 2 urls.add(file.toURI().toURL());
+ 97 4 urls.add(file.toURI().toURL());
98 0 } catch (MalformedURLException ex) {
99 0 final String msg = String.format("Unable to load database driver '%s'; invalid path provided '%s'" ,
100
className, file.getAbsoluteFile());
101 0 LOGGER.log(Level.FINE, msg, ex);
102 0 throw new DriverLoadException(msg, ex);
- 103 2 }
+ 103 4 }
104
}
105
}
- 106 4 final URLClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() {
+ 106 8 final URLClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() {
107
@Override
108
public URLClassLoader run() {
- 109 4 return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent);
+ 109 8 return new URLClassLoader(urls.toArray(new URL[urls.size()]), parent);
110
}
111
});
112
- 113 4 return load(className, loader);
+ 113 8 return load(className, loader);
114
}
115
@@ -241,19 +241,19 @@
private static Driver load(String className, ClassLoader loader) throws DriverLoadException {
125
try {
- 126 7 final Class c = Class.forName(className, true , loader);
+ 126 14 final Class c = Class.forName(className, true , loader);
127
- 128 4 final Driver driver = (Driver) c.newInstance();
- 129 4 final Driver shim = new DriverShim(driver);
+ 128 8 final Driver driver = (Driver) c.newInstance();
+ 129 8 final Driver shim = new DriverShim(driver);
130
- 131 4 DriverManager.registerDriver(shim);
- 132 4 return shim;
- 133 3 } catch (ClassNotFoundException ex) {
- 134 3 final String msg = String.format("Unable to load database driver '%s'" , className);
- 135 3 LOGGER.log(Level.FINE, msg, ex);
- 136 3 throw new DriverLoadException(msg, ex);
+ 131 8 DriverManager.registerDriver(shim);
+ 132 8 return shim;
+ 133 6 } catch (ClassNotFoundException ex) {
+ 134 6 final String msg = String.format("Unable to load database driver '%s'" , className);
+ 135 6 LOGGER.log(Level.FINE, msg, ex);
+ 136 6 throw new DriverLoadException(msg, ex);
137 0 } catch (InstantiationException ex) {
138 0 final String msg = String.format("Unable to load database driver '%s'" , className);
139 0 LOGGER.log(Level.FINE, msg, ex);
@@ -274,6 +274,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverShim.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverShim.html
index 7b7b14f75..f296748c6 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverShim.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.nvdcve.DriverShim.html
@@ -105,7 +105,7 @@
44
- 45 1 private static final Logger LOGGER = Logger.getLogger(DriverShim.class .getName());
+ 45 2 private static final Logger LOGGER = Logger.getLogger(DriverShim.class .getName());
46
47
@@ -156,7 +156,7 @@
@Override
70
public boolean acceptsURL(String url) throws SQLException {
- 71 2 return this .driver.acceptsURL(url);
+ 71 4 return this .driver.acceptsURL(url);
72
}
73
@@ -388,13 +388,13 @@
@Override
201
public String toString() {
- 202 7 return "DriverShim{" + "driver=" + driver + '}' ;
+ 202 14 return "DriverShim{" + "driver=" + driver + '}' ;
203
}
204
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.CachedWebDataSource.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.CachedWebDataSource.html
index ba4f025b9..af22cf90a 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.CachedWebDataSource.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.CachedWebDataSource.html
@@ -93,6 +93,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.NvdCveInfo.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.NvdCveInfo.html
index 04f543cce..abf56f4d7 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.NvdCveInfo.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.NvdCveInfo.html
@@ -293,6 +293,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.NvdCveUpdater.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.NvdCveUpdater.html
index 09771c7f5..e68e3dafb 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.NvdCveUpdater.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.NvdCveUpdater.html
@@ -129,6 +129,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.StandardUpdate.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.StandardUpdate.html
index 77306e694..c61b6be10 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.StandardUpdate.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.StandardUpdate.html
@@ -90,7 +90,7 @@
36
import org.owasp.dependencycheck.data.update.exception.UpdateException;
37
- import org.owasp.dependencycheck.data.update.task.CallableDownloadTask;
+ import org.owasp.dependencycheck.data.update.task.DownloadTask;
38
import org.owasp.dependencycheck.data.update.task.ProcessTask;
39
@@ -240,7 +240,7 @@
122 0 final Set<Future<Future<ProcessTask>>> downloadFutures = new HashSet<Future<Future<ProcessTask>>>(maxUpdates);
123 0 for (NvdCveInfo cve : updateable) {
124 0 if (cve.getNeedsUpdate()) {
- 125 0 final CallableDownloadTask call = new CallableDownloadTask(cve, processExecutor, cveDB, Settings.getInstance());
+ 125 0 final DownloadTask call = new DownloadTask(cve, processExecutor, cveDB, Settings.getInstance());
126 0 downloadFutures.add(downloadExecutors.submit(call));
127
}
@@ -546,6 +546,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.UpdateService.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.UpdateService.html
index 94b62d921..126c29d5a 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.UpdateService.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.UpdateService.html
@@ -121,6 +121,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.UpdateableNvdCve.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.UpdateableNvdCve.html
index d98727a3c..6579347e2 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.UpdateableNvdCve.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.UpdateableNvdCve.html
@@ -85,7 +85,7 @@
34
- 35 12 public class UpdateableNvdCve implements java.lang.Iterable<NvdCveInfo>, Iterator<NvdCveInfo> {
+ 35 24 public class UpdateableNvdCve implements java.lang.Iterable<NvdCveInfo>, Iterator<NvdCveInfo> {
36
37
@@ -94,7 +94,7 @@
39
- 40 5 private Map<String, NvdCveInfo> collection = new TreeMap<String, NvdCveInfo>();
+ 40 10 private Map<String, NvdCveInfo> collection = new TreeMap<String, NvdCveInfo>();
41
42
@@ -127,13 +127,13 @@
56
public boolean isUpdateNeeded() {
- 57 3 for (NvdCveInfo item : this ) {
- 58 4 if (item.getNeedsUpdate()) {
- 59 1 return true ;
+ 57 6 for (NvdCveInfo item : this ) {
+ 58 8 if (item.getNeedsUpdate()) {
+ 59 2 return true ;
60
}
- 61 3 }
- 62 2 return false ;
+ 61 6 }
+ 62 4 return false ;
63
}
64
@@ -160,8 +160,8 @@
75
public void add(String id, String url, String oldUrl) throws MalformedURLException, DownloadFailedException {
- 76 1 add(id, url, oldUrl, false );
- 77 1 }
+ 76 2 add(id, url, oldUrl, false );
+ 77 2 }
78
79
@@ -188,14 +188,14 @@
90
public void add(String id, String url, String oldUrl, boolean needsUpdate) throws MalformedURLException, DownloadFailedException {
- 91 9 final NvdCveInfo item = new NvdCveInfo();
- 92 9 item.setNeedsUpdate(needsUpdate);
- 93 9 item.setId(id);
- 94 9 item.setUrl(url);
- 95 9 item.setOldSchemaVersionUrl(oldUrl);
- 96 9 item.setTimestamp(Downloader.getLastModified(new URL(url)));
- 97 9 collection.put(id, item);
- 98 9 }
+ 91 18 final NvdCveInfo item = new NvdCveInfo();
+ 92 18 item.setNeedsUpdate(needsUpdate);
+ 93 18 item.setId(id);
+ 94 18 item.setUrl(url);
+ 95 18 item.setOldSchemaVersionUrl(oldUrl);
+ 96 18 item.setTimestamp(Downloader.getLastModified(new URL(url)));
+ 97 18 collection.put(id, item);
+ 98 18 }
99
100
@@ -206,8 +206,8 @@
103
public void clear() {
- 104 1 collection.clear();
- 105 1 }
+ 104 2 collection.clear();
+ 105 2 }
106
107
@@ -233,7 +233,7 @@
118
- 119 5 private Iterator<Entry<String, NvdCveInfo>> iterableContent = null ;
+ 119 10 private Iterator<Entry<String, NvdCveInfo>> iterableContent = null ;
120
121
@@ -256,8 +256,8 @@
@Override
130
public Iterator<NvdCveInfo> iterator() {
- 131 4 iterableContent = collection.entrySet().iterator();
- 132 4 return this ;
+ 131 8 iterableContent = collection.entrySet().iterator();
+ 132 8 return this ;
133
}
134
@@ -282,7 +282,7 @@
@Override
144
public boolean hasNext() {
- 145 10 return iterableContent.hasNext();
+ 145 20 return iterableContent.hasNext();
146
}
147
@@ -307,7 +307,7 @@
@Override
157
public NvdCveInfo next() {
- 158 7 return iterableContent.next().getValue();
+ 158 14 return iterableContent.next().getValue();
159
}
160
@@ -328,8 +328,8 @@
@Override
168
public void remove() {
- 169 1 iterableContent.remove();
- 170 1 }
+ 169 2 iterableContent.remove();
+ 170 2 }
171
172
@@ -346,7 +346,7 @@
178
NvdCveInfo get(String key) {
- 179 2 return collection.get(key);
+ 179 4 return collection.get(key);
180
}
181
@@ -362,6 +362,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.exception.InvalidDataException.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.exception.InvalidDataException.html
index f08e061d9..f28fb3d0a 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.exception.InvalidDataException.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.exception.InvalidDataException.html
@@ -119,6 +119,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.exception.UpdateException.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.exception.UpdateException.html
index 30013babe..45e19ec3c 100644
--- a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.exception.UpdateException.html
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.exception.UpdateException.html
@@ -155,6 +155,6 @@
}
-
+
diff --git a/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.task.DownloadTask.html b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.task.DownloadTask.html
new file mode 100644
index 000000000..c84c973fd
--- /dev/null
+++ b/dependency-check-core/cobertura/org.owasp.dependencycheck.data.update.task.DownloadTask.html
@@ -0,0 +1,444 @@
+
+
+
+
+Coverage Report
+
+
+
+
+Note: failures are anticipated and checked for with assertions while errors are unanticipated.
Note: failures are anticipated and checked for with assertions while errors are unanticipated.