Class EngineVersionCheck
java.lang.Object
org.owasp.dependencycheck.data.update.EngineVersionCheck
- All Implemented Interfaces:
CachedWebDataSource
Checks the gh-pages dependency-check site to determine the current released
version number. If the released version number is greater than the running
version number a warning is printed recommending that an upgrade be
performed.
- Author:
- Jeremy Long
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructs a new engine version check utility.protectedEngineVersionCheck(Settings settings) Constructs a new engine version check utility for testing. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringRetrieves the current released version number from the github documentation site.protected StringGetter for updateToVersion - only used for testing.booleanDeletes any locally cached data.protected voidsetUpdateToVersion(String version) Setter for updateToVersion - only used for testing.protected booleanshouldUpdate(long lastChecked, long now, DatabaseProperties properties, String currentVersion) Determines if a new version of the dependency-check engine has been released.booleanDownloads the current released version number and compares it to the running engine's version number.
-
Field Details
-
ENGINE_VERSION_CHECKED_ON
The property key indicating when the last version check occurred.- See Also:
-
CURRENT_ENGINE_RELEASE
The property key indicating when the last version check occurred.- See Also:
-
-
Constructor Details
-
EngineVersionCheck
Constructs a new engine version check utility for testing.- Parameters:
settings- the configured settings
-
EngineVersionCheck
public EngineVersionCheck()Constructs a new engine version check utility.
-
-
Method Details
-
getUpdateToVersion
Getter for updateToVersion - only used for testing. Represents the version retrieved from the database.- Returns:
- the version to test
-
setUpdateToVersion
Setter for updateToVersion - only used for testing. Represents the version retrieved from the database.- Parameters:
version- the version to test
-
update
Downloads the current released version number and compares it to the running engine's version number. If the released version number is newer a warning is printed recommending an upgrade.- Specified by:
updatein interfaceCachedWebDataSource- Parameters:
engine- a reference to the dependency-check engine- Returns:
- returns false as no updates are made to the database that would require compaction
- Throws:
UpdateException- thrown if the local database properties could not be updated
-
shouldUpdate
protected boolean shouldUpdate(long lastChecked, long now, DatabaseProperties properties, String currentVersion) throws UpdateException Determines if a new version of the dependency-check engine has been released.- Parameters:
lastChecked- the epoch time of the last version checknow- the current epoch timeproperties- the database properties objectcurrentVersion- the current version of dependency-check- Returns:
trueif a newer version of the database has been released; otherwisefalse- Throws:
UpdateException- thrown if there is an error connecting to the github documentation site or accessing the local database.
-
getCurrentReleaseVersion
Retrieves the current released version number from the github documentation site.- Returns:
- the current released version number
-
purge
Description copied from interface:CachedWebDataSourceDeletes any locally cached data.- Specified by:
purgein interfaceCachedWebDataSource- Parameters:
engine- a reference to the dependency-check engine- Returns:
trueif the purge was successful; otherwisefalse
-