Coverage Report - org.owasp.dependencycheck.dependency.Dependency
 
Classes in this File Line Coverage Branch Coverage Complexity
Dependency
61%
85/138
21%
31/144
2.627
 
 1  
 /*
 2  
  * This file is part of dependency-check-core.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  *
 16  
  * Copyright (c) 2012 Jeremy Long. All Rights Reserved.
 17  
  */
 18  
 package org.owasp.dependencycheck.dependency;
 19  
 
 20  
 import java.io.File;
 21  
 import java.io.IOException;
 22  
 import java.io.Serializable;
 23  
 import java.security.NoSuchAlgorithmException;
 24  
 import java.util.Set;
 25  
 import java.util.SortedSet;
 26  
 import java.util.TreeSet;
 27  
 import java.util.logging.Level;
 28  
 import java.util.logging.Logger;
 29  
 import org.owasp.dependencycheck.data.nexus.MavenArtifact;
 30  
 import org.owasp.dependencycheck.utils.Checksum;
 31  
 import org.owasp.dependencycheck.utils.FileUtils;
 32  
 
 33  
 /**
 34  
  * A program dependency. This object is one of the core components within DependencyCheck. It is used to collect
 35  
  * information about the dependency in the form of evidence. The Evidence is then used to determine if there are any
 36  
  * known, published, vulnerabilities associated with the program dependency.
 37  
  *
 38  
  * @author Jeremy Long <jeremy.long@owasp.org>
 39  
  */
 40  2
 public class Dependency implements Serializable, Comparable<Dependency> {
 41  
 
 42  
     /**
 43  
      * The logger.
 44  
      */
 45  1
     private static final Logger LOGGER = Logger.getLogger(Dependency.class.getName());
 46  
     /**
 47  
      * The actual file path of the dependency on disk.
 48  
      */
 49  
     private String actualFilePath;
 50  
     /**
 51  
      * The file path to display.
 52  
      */
 53  
     private String filePath;
 54  
     /**
 55  
      * The file name of the dependency.
 56  
      */
 57  
     private String fileName;
 58  
     /**
 59  
      * The file extension of the dependency.
 60  
      */
 61  
     private String fileExtension;
 62  
     /**
 63  
      * The md5 hash of the dependency.
 64  
      */
 65  
     private String md5sum;
 66  
     /**
 67  
      * The SHA1 hash of the dependency.
 68  
      */
 69  
     private String sha1sum;
 70  
     /**
 71  
      * A list of Identifiers.
 72  
      */
 73  
     private Set<Identifier> identifiers;
 74  
     /**
 75  
      * A collection of vendor evidence.
 76  
      */
 77  
     private final EvidenceCollection vendorEvidence;
 78  
     /**
 79  
      * A collection of product evidence.
 80  
      */
 81  
     private final EvidenceCollection productEvidence;
 82  
     /**
 83  
      * A collection of version evidence.
 84  
      */
 85  
     private final EvidenceCollection versionEvidence;
 86  
 
 87  
     /**
 88  
      * Constructs a new Dependency object.
 89  
      */
 90  40
     public Dependency() {
 91  40
         vendorEvidence = new EvidenceCollection();
 92  40
         productEvidence = new EvidenceCollection();
 93  40
         versionEvidence = new EvidenceCollection();
 94  40
         identifiers = new TreeSet<Identifier>();
 95  40
         vulnerabilities = new TreeSet<Vulnerability>(new VulnerabilityComparator());
 96  40
         suppressedIdentifiers = new TreeSet<Identifier>();
 97  40
         suppressedVulnerabilities = new TreeSet<Vulnerability>(new VulnerabilityComparator());
 98  40
     }
 99  
 
 100  
     /**
 101  
      * Constructs a new Dependency object.
 102  
      *
 103  
      * @param file the File to create the dependency object from.
 104  
      */
 105  
     public Dependency(File file) {
 106  17
         this();
 107  17
         this.actualFilePath = file.getPath();
 108  17
         this.filePath = this.actualFilePath;
 109  17
         this.fileName = file.getName();
 110  17
         this.fileExtension = FileUtils.getFileExtension(fileName);
 111  17
         determineHashes(file);
 112  17
     }
 113  
 
 114  
     /**
 115  
      * Returns the file name of the dependency.
 116  
      *
 117  
      * @return the file name of the dependency
 118  
      */
 119  
     public String getFileName() {
 120  
         return this.fileName;
 121  
     }
 122  
 
 123  
     /**
 124  
      * Returns the file name of the dependency with the backslash escaped for use in JavaScript. This is a complete hack
 125  
      * as I could not get the replace to work in the template itself.
 126  
      *
 127  
      * @return the file name of the dependency with the backslash escaped for use in JavaScript
 128  
      */
 129  
     public String getFileNameForJavaScript() {
 130  0
         return this.fileName.replace("\\", "\\\\");
 131  
     }
 132  
 
 133  
     /**
 134  
      * Sets the file name of the dependency.
 135  
      *
 136  
      * @param fileName the file name of the dependency
 137  
      */
 138  
     public void setFileName(String fileName) {
 139  
         this.fileName = fileName;
 140  
     }
 141  
 
 142  
     /**
 143  
      * Sets the actual file path of the dependency on disk.
 144  
      *
 145  
      * @param actualFilePath the file path of the dependency
 146  
      */
 147  
     public void setActualFilePath(String actualFilePath) {
 148  2
         this.actualFilePath = actualFilePath;
 149  2
         if (this.sha1sum == null) {
 150  2
             final File file = new File(this.actualFilePath);
 151  2
             determineHashes(file);
 152  
         }
 153  2
     }
 154  
 
 155  
     /**
 156  
      * Gets the file path of the dependency.
 157  
      *
 158  
      * @return the file path of the dependency
 159  
      */
 160  
     public String getActualFilePath() {
 161  
         return this.actualFilePath;
 162  
     }
 163  
 
 164  
     /**
 165  
      * Gets a reference to the File object.
 166  
      *
 167  
      * @return the File object
 168  
      */
 169  
     public File getActualFile() {
 170  7
         return new File(this.actualFilePath);
 171  
     }
 172  
 
 173  
     /**
 174  
      * Sets the file path of the dependency.
 175  
      *
 176  
      * @param filePath the file path of the dependency
 177  
      */
 178  
     public void setFilePath(String filePath) {
 179  
         this.filePath = filePath;
 180  
     }
 181  
 
 182  
     /**
 183  
      * The file name to display in reports.
 184  
      */
 185  40
     private String displayName = null;
 186  
 
 187  
     /**
 188  
      * Sets the file name to display in reports.
 189  
      *
 190  
      * @param displayName the name to display
 191  
      */
 192  
     public void setDisplayFileName(String displayName) {
 193  
         this.displayName = displayName;
 194  
     }
 195  
 
 196  
     /**
 197  
      * Returns the file name to display in reports; if no display file name has been set it will default to the actual
 198  
      * file name.
 199  
      *
 200  
      * @return the file name to display
 201  
      */
 202  
     public String getDisplayFileName() {
 203  0
         if (displayName == null) {
 204  0
             return this.fileName;
 205  
         }
 206  0
         return this.displayName;
 207  
     }
 208  
 
 209  
     /**
 210  
      * <p>
 211  
      * Gets the file path of the dependency.</p>
 212  
      * <p>
 213  
      * <b>NOTE:</b> This may not be the actual path of the file on disk. The actual path of the file on disk can be
 214  
      * obtained via the getActualFilePath().</p>
 215  
      *
 216  
      * @return the file path of the dependency
 217  
      */
 218  
     public String getFilePath() {
 219  
         return this.filePath;
 220  
     }
 221  
 
 222  
     /**
 223  
      * Sets the file name of the dependency.
 224  
      *
 225  
      * @param fileExtension the file name of the dependency
 226  
      */
 227  
     public void setFileExtension(String fileExtension) {
 228  
         this.fileExtension = fileExtension;
 229  
     }
 230  
 
 231  
     /**
 232  
      * Gets the file extension of the dependency.
 233  
      *
 234  
      * @return the file extension of the dependency
 235  
      */
 236  
     public String getFileExtension() {
 237  
         return this.fileExtension;
 238  
     }
 239  
 
 240  
     /**
 241  
      * Returns the MD5 Checksum of the dependency file.
 242  
      *
 243  
      * @return the MD5 Checksum
 244  
      */
 245  
     public String getMd5sum() {
 246  
         return this.md5sum;
 247  
     }
 248  
 
 249  
     /**
 250  
      * Sets the MD5 Checksum of the dependency.
 251  
      *
 252  
      * @param md5sum the MD5 Checksum
 253  
      */
 254  
     public void setMd5sum(String md5sum) {
 255  
         this.md5sum = md5sum;
 256  
     }
 257  
 
 258  
     /**
 259  
      * Returns the SHA1 Checksum of the dependency.
 260  
      *
 261  
      * @return the SHA1 Checksum
 262  
      */
 263  
     public String getSha1sum() {
 264  
         return this.sha1sum;
 265  
     }
 266  
 
 267  
     /**
 268  
      * Sets the SHA1 Checksum of the dependency.
 269  
      *
 270  
      * @param sha1sum the SHA1 Checksum
 271  
      */
 272  
     public void setSha1sum(String sha1sum) {
 273  
         this.sha1sum = sha1sum;
 274  
     }
 275  
 
 276  
     /**
 277  
      * Returns a List of Identifiers.
 278  
      *
 279  
      * @return an ArrayList of Identifiers
 280  
      */
 281  
     public Set<Identifier> getIdentifiers() {
 282  
         return this.identifiers;
 283  
     }
 284  
 
 285  
     /**
 286  
      * Sets a List of Identifiers.
 287  
      *
 288  
      * @param identifiers A list of Identifiers
 289  
      */
 290  
     public void setIdentifiers(Set<Identifier> identifiers) {
 291  
         this.identifiers = identifiers;
 292  
     }
 293  
 
 294  
     /**
 295  
      * Adds an entry to the list of detected Identifiers for the dependency file.
 296  
      *
 297  
      * @param type the type of identifier (such as CPE)
 298  
      * @param value the value of the identifier
 299  
      * @param url the URL of the identifier
 300  
      */
 301  
     public void addIdentifier(String type, String value, String url) {
 302  11
         final Identifier i = new Identifier(type, value, url);
 303  11
         this.identifiers.add(i);
 304  11
     }
 305  
 
 306  
     /**
 307  
      * Adds an entry to the list of detected Identifiers for the dependency file.
 308  
      *
 309  
      * @param type the type of identifier (such as CPE)
 310  
      * @param value the value of the identifier
 311  
      * @param url the URL of the identifier
 312  
      * @param confidence the confidence in the Identifier being accurate
 313  
      */
 314  
     public void addIdentifier(String type, String value, String url, Confidence confidence) {
 315  4
         final Identifier i = new Identifier(type, value, url);
 316  4
         i.setConfidence(confidence);
 317  4
         this.identifiers.add(i);
 318  4
     }
 319  
 
 320  
     /**
 321  
      * Adds the maven artifact as evidence.
 322  
      *
 323  
      * @param source The source of the evidence
 324  
      * @param mavenArtifact The maven artifact
 325  
      * @param confidence The confidence level of this evidence
 326  
      */
 327  
     public void addAsEvidence(String source, MavenArtifact mavenArtifact, Confidence confidence) {
 328  4
         if (mavenArtifact.getGroupId() != null && !mavenArtifact.getGroupId().isEmpty()) {
 329  3
             this.getVendorEvidence().addEvidence(source, "groupid", mavenArtifact.getGroupId(), confidence);
 330  
         }
 331  4
         if (mavenArtifact.getArtifactId() != null && !mavenArtifact.getArtifactId().isEmpty()) {
 332  3
             this.getProductEvidence().addEvidence(source, "artifactid", mavenArtifact.getArtifactId(), confidence);
 333  
         }
 334  4
         if (mavenArtifact.getVersion() != null && !mavenArtifact.getVersion().isEmpty()) {
 335  3
             this.getVersionEvidence().addEvidence(source, "version", mavenArtifact.getVersion(), confidence);
 336  
         }
 337  4
         if (mavenArtifact.getArtifactUrl() != null && !mavenArtifact.getArtifactUrl().isEmpty()) {
 338  3
             boolean found = false;
 339  3
             for (Identifier i : this.getIdentifiers()) {
 340  0
                 if ("maven".equals(i.getType()) && i.getValue().equals(mavenArtifact.toString())) {
 341  0
                     found = true;
 342  0
                     i.setConfidence(Confidence.HIGHEST);
 343  0
                     i.setUrl(mavenArtifact.getArtifactUrl());
 344  0
                     LOGGER.fine(String.format("Already found identifier %s. Confidence set to highest", i.getValue()));
 345  0
                     break;
 346  
                 }
 347  0
             }
 348  3
             if (!found) {
 349  3
                 LOGGER.fine(String.format("Adding new maven identifier %s", mavenArtifact.toString()));
 350  3
                 this.addIdentifier("maven", mavenArtifact.toString(), mavenArtifact.getArtifactUrl(), Confidence.HIGHEST);
 351  
             }
 352  
         }
 353  4
     }
 354  
 
 355  
     /**
 356  
      * Adds an entry to the list of detected Identifiers for the dependency file.
 357  
      *
 358  
      * @param identifier the identifier to add
 359  
      */
 360  
     public void addIdentifier(Identifier identifier) {
 361  4
         this.identifiers.add(identifier);
 362  4
     }
 363  
 
 364  
     /**
 365  
      * A set of identifiers that have been suppressed.
 366  
      */
 367  
     private Set<Identifier> suppressedIdentifiers;
 368  
 
 369  
     /**
 370  
      * Get the value of suppressedIdentifiers.
 371  
      *
 372  
      * @return the value of suppressedIdentifiers
 373  
      */
 374  
     public Set<Identifier> getSuppressedIdentifiers() {
 375  
         return suppressedIdentifiers;
 376  
     }
 377  
 
 378  
     /**
 379  
      * Set the value of suppressedIdentifiers.
 380  
      *
 381  
      * @param suppressedIdentifiers new value of suppressedIdentifiers
 382  
      */
 383  
     public void setSuppressedIdentifiers(Set<Identifier> suppressedIdentifiers) {
 384  
         this.suppressedIdentifiers = suppressedIdentifiers;
 385  
     }
 386  
 
 387  
     /**
 388  
      * Adds an identifier to the list of suppressed identifiers.
 389  
      *
 390  
      * @param identifier an identifier that was suppressed.
 391  
      */
 392  
     public void addSuppressedIdentifier(Identifier identifier) {
 393  4
         this.suppressedIdentifiers.add(identifier);
 394  4
     }
 395  
 
 396  
     /**
 397  
      * A set of vulnerabilities that have been suppressed.
 398  
      */
 399  
     private SortedSet<Vulnerability> suppressedVulnerabilities;
 400  
 
 401  
     /**
 402  
      * Get the value of suppressedVulnerabilities.
 403  
      *
 404  
      * @return the value of suppressedVulnerabilities
 405  
      */
 406  
     public SortedSet<Vulnerability> getSuppressedVulnerabilities() {
 407  
         return suppressedVulnerabilities;
 408  
     }
 409  
 
 410  
     /**
 411  
      * Set the value of suppressedVulnerabilities.
 412  
      *
 413  
      * @param suppressedVulnerabilities new value of suppressedVulnerabilities
 414  
      */
 415  
     public void setSuppressedVulnerabilities(SortedSet<Vulnerability> suppressedVulnerabilities) {
 416  
         this.suppressedVulnerabilities = suppressedVulnerabilities;
 417  
     }
 418  
 
 419  
     /**
 420  
      * Adds a vulnerability to the set of suppressed vulnerabilities.
 421  
      *
 422  
      * @param vulnerability the vulnerability that was suppressed
 423  
      */
 424  
     public void addSuppressedVulnerability(Vulnerability vulnerability) {
 425  3
         this.suppressedVulnerabilities.add(vulnerability);
 426  3
     }
 427  
 
 428  
     /**
 429  
      * Returns the evidence used to identify this dependency.
 430  
      *
 431  
      * @return an EvidenceCollection.
 432  
      */
 433  
     public EvidenceCollection getEvidence() {
 434  11
         return EvidenceCollection.merge(this.productEvidence, this.vendorEvidence, this.versionEvidence);
 435  
     }
 436  
 
 437  
     /**
 438  
      * Returns the evidence used to identify this dependency.
 439  
      *
 440  
      * @return an EvidenceCollection.
 441  
      */
 442  
     public Set<Evidence> getEvidenceForDisplay() {
 443  0
         return EvidenceCollection.mergeForDisplay(this.productEvidence, this.vendorEvidence, this.versionEvidence);
 444  
     }
 445  
 
 446  
     /**
 447  
      * Returns the evidence used to identify this dependency.
 448  
      *
 449  
      * @return an EvidenceCollection.
 450  
      */
 451  
     public EvidenceCollection getEvidenceUsed() {
 452  1
         return EvidenceCollection.mergeUsed(this.productEvidence, this.vendorEvidence, this.versionEvidence);
 453  
     }
 454  
 
 455  
     /**
 456  
      * Gets the Vendor Evidence.
 457  
      *
 458  
      * @return an EvidenceCollection.
 459  
      */
 460  
     public EvidenceCollection getVendorEvidence() {
 461  
         return this.vendorEvidence;
 462  
     }
 463  
 
 464  
     /**
 465  
      * Gets the Product Evidence.
 466  
      *
 467  
      * @return an EvidenceCollection.
 468  
      */
 469  
     public EvidenceCollection getProductEvidence() {
 470  
         return this.productEvidence;
 471  
     }
 472  
 
 473  
     /**
 474  
      * Gets the Version Evidence.
 475  
      *
 476  
      * @return an EvidenceCollection.
 477  
      */
 478  
     public EvidenceCollection getVersionEvidence() {
 479  
         return this.versionEvidence;
 480  
     }
 481  
 
 482  
     /**
 483  
      * The description of the JAR file.
 484  
      */
 485  
     private String description;
 486  
 
 487  
     /**
 488  
      * Get the value of description.
 489  
      *
 490  
      * @return the value of description
 491  
      */
 492  
     public String getDescription() {
 493  
         return description;
 494  
     }
 495  
 
 496  
     /**
 497  
      * Set the value of description.
 498  
      *
 499  
      * @param description new value of description
 500  
      */
 501  
     public void setDescription(String description) {
 502  
         this.description = description;
 503  
     }
 504  
 
 505  
     /**
 506  
      * The license that this dependency uses.
 507  
      */
 508  
     private String license;
 509  
 
 510  
     /**
 511  
      * Get the value of license.
 512  
      *
 513  
      * @return the value of license
 514  
      */
 515  
     public String getLicense() {
 516  
         return license;
 517  
     }
 518  
 
 519  
     /**
 520  
      * Set the value of license.
 521  
      *
 522  
      * @param license new value of license
 523  
      */
 524  
     public void setLicense(String license) {
 525  
         this.license = license;
 526  
     }
 527  
 
 528  
     /**
 529  
      * A list of vulnerabilities for this dependency.
 530  
      */
 531  
     private SortedSet<Vulnerability> vulnerabilities;
 532  
 
 533  
     /**
 534  
      * Get the list of vulnerabilities.
 535  
      *
 536  
      * @return the list of vulnerabilities
 537  
      */
 538  
     public SortedSet<Vulnerability> getVulnerabilities() {
 539  
         return vulnerabilities;
 540  
     }
 541  
 
 542  
     /**
 543  
      * Set the value of vulnerabilities.
 544  
      *
 545  
      * @param vulnerabilities new value of vulnerabilities
 546  
      */
 547  
     public void setVulnerabilities(SortedSet<Vulnerability> vulnerabilities) {
 548  
         this.vulnerabilities = vulnerabilities;
 549  
     }
 550  
 
 551  
     /**
 552  
      * Determines the sha1 and md5 sum for the given file.
 553  
      *
 554  
      * @param file the file to create checksums for
 555  
      */
 556  
     private void determineHashes(File file) {
 557  19
         String md5 = null;
 558  19
         String sha1 = null;
 559  
         try {
 560  19
             md5 = Checksum.getMD5Checksum(file);
 561  16
             sha1 = Checksum.getSHA1Checksum(file);
 562  3
         } catch (IOException ex) {
 563  3
             final String msg = String.format("Unable to read '%s' to determine hashes.", file.getName());
 564  3
             LOGGER.log(Level.WARNING, msg);
 565  3
             LOGGER.log(Level.FINE, null, ex);
 566  0
         } catch (NoSuchAlgorithmException ex) {
 567  0
             final String msg = "Unable to use MD5 of SHA1 checksums.";
 568  0
             LOGGER.log(Level.WARNING, msg);
 569  0
             LOGGER.log(Level.FINE, null, ex);
 570  19
         }
 571  19
         this.setMd5sum(md5);
 572  19
         this.setSha1sum(sha1);
 573  19
     }
 574  
 
 575  
     /**
 576  
      * Adds a vulnerability to the dependency.
 577  
      *
 578  
      * @param vulnerability a vulnerability outlining a vulnerability.
 579  
      */
 580  
     public void addVulnerability(Vulnerability vulnerability) {
 581  3
         this.vulnerabilities.add(vulnerability);
 582  3
     }
 583  
 
 584  
     /**
 585  
      * A collection of related dependencies.
 586  
      */
 587  40
     private Set<Dependency> relatedDependencies = new TreeSet<Dependency>();
 588  
 
 589  
     /**
 590  
      * Get the value of relatedDependencies.
 591  
      *
 592  
      * @return the value of relatedDependencies
 593  
      */
 594  
     public Set<Dependency> getRelatedDependencies() {
 595  
         return relatedDependencies;
 596  
     }
 597  
 
 598  
     /**
 599  
      * Set the value of relatedDependencies.
 600  
      *
 601  
      * @param relatedDependencies new value of relatedDependencies
 602  
      */
 603  
     public void setRelatedDependencies(Set<Dependency> relatedDependencies) {
 604  
         this.relatedDependencies = relatedDependencies;
 605  
     }
 606  
 
 607  
     /**
 608  
      * Adds a related dependency.
 609  
      *
 610  
      * @param dependency a reference to the related dependency
 611  
      */
 612  
     public void addRelatedDependency(Dependency dependency) {
 613  0
         relatedDependencies.add(dependency);
 614  0
     }
 615  
 
 616  
     /**
 617  
      * Implementation of the Comparable<Dependency> interface. The comparison is solely based on the file name.
 618  
      *
 619  
      * @param o a dependency to compare
 620  
      * @return an integer representing the natural ordering
 621  
      */
 622  
     public int compareTo(Dependency o) {
 623  2
         return this.getFilePath().compareToIgnoreCase(o.getFilePath());
 624  
     }
 625  
 
 626  
     /**
 627  
      * Implementation of the equals method.
 628  
      *
 629  
      * @param obj the object to compare
 630  
      * @return true if the objects are equal, otherwise false
 631  
      */
 632  
     @Override
 633  
     public boolean equals(Object obj) {
 634  0
         if (obj == null) {
 635  0
             return false;
 636  
         }
 637  0
         if (getClass() != obj.getClass()) {
 638  0
             return false;
 639  
         }
 640  0
         final Dependency other = (Dependency) obj;
 641  0
         if ((this.actualFilePath == null) ? (other.actualFilePath != null) : !this.actualFilePath.equals(other.actualFilePath)) {
 642  0
             return false;
 643  
         }
 644  0
         if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
 645  0
             return false;
 646  
         }
 647  0
         if ((this.fileName == null) ? (other.fileName != null) : !this.fileName.equals(other.fileName)) {
 648  0
             return false;
 649  
         }
 650  0
         if ((this.fileExtension == null) ? (other.fileExtension != null) : !this.fileExtension.equals(other.fileExtension)) {
 651  0
             return false;
 652  
         }
 653  0
         if ((this.md5sum == null) ? (other.md5sum != null) : !this.md5sum.equals(other.md5sum)) {
 654  0
             return false;
 655  
         }
 656  0
         if ((this.sha1sum == null) ? (other.sha1sum != null) : !this.sha1sum.equals(other.sha1sum)) {
 657  0
             return false;
 658  
         }
 659  0
         if (this.identifiers != other.identifiers && (this.identifiers == null || !this.identifiers.equals(other.identifiers))) {
 660  0
             return false;
 661  
         }
 662  0
         if (this.vendorEvidence != other.vendorEvidence && (this.vendorEvidence == null || !this.vendorEvidence.equals(other.vendorEvidence))) {
 663  0
             return false;
 664  
         }
 665  0
         if (this.productEvidence != other.productEvidence && (this.productEvidence == null || !this.productEvidence.equals(other.productEvidence))) {
 666  0
             return false;
 667  
         }
 668  0
         if (this.versionEvidence != other.versionEvidence && (this.versionEvidence == null || !this.versionEvidence.equals(other.versionEvidence))) {
 669  0
             return false;
 670  
         }
 671  0
         if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
 672  0
             return false;
 673  
         }
 674  0
         if ((this.license == null) ? (other.license != null) : !this.license.equals(other.license)) {
 675  0
             return false;
 676  
         }
 677  0
         if (this.vulnerabilities != other.vulnerabilities && (this.vulnerabilities == null || !this.vulnerabilities.equals(other.vulnerabilities))) {
 678  0
             return false;
 679  
         }
 680  0
         if (this.relatedDependencies != other.relatedDependencies
 681  
                 && (this.relatedDependencies == null || !this.relatedDependencies.equals(other.relatedDependencies))) {
 682  0
             return false;
 683  
         }
 684  0
         return true;
 685  
     }
 686  
 
 687  
     /**
 688  
      * Generates the HashCode.
 689  
      *
 690  
      * @return the HashCode
 691  
      */
 692  
     @Override
 693  
     public int hashCode() {
 694  28
         int hash = 3;
 695  28
         hash = 47 * hash + (this.actualFilePath != null ? this.actualFilePath.hashCode() : 0);
 696  28
         hash = 47 * hash + (this.filePath != null ? this.filePath.hashCode() : 0);
 697  28
         hash = 47 * hash + (this.fileName != null ? this.fileName.hashCode() : 0);
 698  28
         hash = 47 * hash + (this.fileExtension != null ? this.fileExtension.hashCode() : 0);
 699  28
         hash = 47 * hash + (this.md5sum != null ? this.md5sum.hashCode() : 0);
 700  28
         hash = 47 * hash + (this.sha1sum != null ? this.sha1sum.hashCode() : 0);
 701  28
         hash = 47 * hash + (this.identifiers != null ? this.identifiers.hashCode() : 0);
 702  28
         hash = 47 * hash + (this.vendorEvidence != null ? this.vendorEvidence.hashCode() : 0);
 703  28
         hash = 47 * hash + (this.productEvidence != null ? this.productEvidence.hashCode() : 0);
 704  28
         hash = 47 * hash + (this.versionEvidence != null ? this.versionEvidence.hashCode() : 0);
 705  28
         hash = 47 * hash + (this.description != null ? this.description.hashCode() : 0);
 706  28
         hash = 47 * hash + (this.license != null ? this.license.hashCode() : 0);
 707  28
         hash = 47 * hash + (this.vulnerabilities != null ? this.vulnerabilities.hashCode() : 0);
 708  28
         hash = 47 * hash + (this.relatedDependencies != null ? this.relatedDependencies.hashCode() : 0);
 709  28
         return hash;
 710  
     }
 711  
 
 712  
     /**
 713  
      * Standard toString() implementation showing the filename, actualFilePath, and filePath.
 714  
      *
 715  
      * @return the string representation of the file
 716  
      */
 717  
     @Override
 718  
     public String toString() {
 719  0
         return "Dependency{ fileName='" + fileName + "', actualFilePath='" + actualFilePath + "', filePath='" + filePath + "'}";
 720  
     }
 721  
 }