|
21 | 21 | import java.net.MalformedURLException; |
22 | 22 | import java.net.URL; |
23 | 23 | import java.nio.charset.StandardCharsets; |
| 24 | +import java.util.Arrays; |
24 | 25 | import javax.annotation.concurrent.ThreadSafe; |
| 26 | + |
25 | 27 | import org.owasp.dependencycheck.Engine; |
26 | 28 | import org.owasp.dependencycheck.data.nvdcve.CveDB; |
27 | 29 | import org.owasp.dependencycheck.data.nvdcve.DatabaseException; |
@@ -167,13 +169,21 @@ public boolean update(Engine engine) throws UpdateException { |
167 | 169 | * github documentation site or accessing the local database. |
168 | 170 | */ |
169 | 171 | protected boolean shouldUpdate(final long lastChecked, final long now, final DatabaseProperties properties, |
170 | | - String currentVersion) throws UpdateException { |
| 172 | + String currentVersion) throws UpdateException { |
171 | 173 | //check every 30 days if we know there is an update, otherwise check every 7 days |
172 | 174 | final int checkRange = 30; |
173 | 175 | if (!DateUtil.withinDateRange(lastChecked, now, checkRange)) { |
174 | 176 | LOGGER.debug("Checking web for new version."); |
175 | | - final String currentRelease = getCurrentReleaseVersion(); |
176 | | - if (currentRelease != null) { |
| 177 | + final String publishedData = getCurrentReleaseVersion(); |
| 178 | + if (publishedData != null) { |
| 179 | + final String[] parts = publishedData.split("\n"); |
| 180 | + if (parts.length > 1) { |
| 181 | + final String message = String.join("\n", Arrays.copyOfRange(parts, 1, parts.length)).trim(); |
| 182 | + LOGGER.warn("\n\n*********************************************************\n" |
| 183 | + + message |
| 184 | + + "\n*********************************************************\n"); |
| 185 | + } |
| 186 | + final String currentRelease = parts[0].trim(); |
177 | 187 | final DependencyVersion v = new DependencyVersion(currentRelease); |
178 | 188 | if (v.getVersionParts() != null && v.getVersionParts().size() >= 3) { |
179 | 189 | updateToVersion = v.toString(); |
|
0 commit comments