-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Actual behavior
HTTP status 200 is OK and means success. However, the URL Updater sometimes treats that as error:
Reproduce
scan ide-urls for "code" : 200.
Expected behavior
HTTP status 200 gets treated as success and not as error.
IDEasy status
current UrlUpdater workflowRelated/Dependent issues
No response
Comments/Hints
Maybe the checksum changed?
IDEasy/url-updater/src/main/java/com/devonfw/tools/ide/url/updater/AbstractUrlUpdater.java
Lines 430 to 460 in 5e9ba72
| boolean success = isValidDownload(url, toolWithEdition, version, response); | |
| boolean update = false; | |
| if (success) { | |
| UrlChecksum urlChecksum = null; | |
| if (urlDownloadFile != null) { | |
| urlChecksum = urlVersion.getChecksum(urlDownloadFile.getName()); | |
| if (urlChecksum != null) { | |
| logger.warn("Checksum is already existing for: {}, skipping.", url); | |
| update = true; | |
| } | |
| } | |
| if (checksum == null || checksum.isEmpty()) { | |
| String contentType = response.headers().firstValue("content-type").orElse("undefined"); | |
| checksum = doGenerateChecksum(doGetResponseAsStream(url), url, edition, version, contentType); | |
| } | |
| // we only use getOrCreate here to avoid creating empty file if doGenerateChecksum fails | |
| if (urlChecksum == null) { | |
| if (urlDownloadFile == null) { | |
| urlDownloadFile = urlVersion.getOrCreateUrls(os, architecture); | |
| } | |
| urlChecksum = urlVersion.getOrCreateChecksum(urlDownloadFile.getName()); | |
| } | |
| success = isChecksumStillValid(checksum, urlChecksum, toolWithEdition, version, url); | |
| if (success) { | |
| urlDownloadFile.addUrl(url); | |
| } | |
| } | |
| doUpdateStatusJson(success, statusCode, edition, urlVersion, url, urlDownloadFile, update); |
But results in checksum cannot be found in the logs.
Maybe the content-type is wrong?
IDEasy/url-updater/src/main/java/com/devonfw/tools/ide/url/updater/AbstractUrlUpdater.java
Lines 374 to 388 in 5e9ba72
| private boolean isValidDownload(String url, String toolWithEdition, String version, HttpResponse<?> response) { | |
| if (isSuccess(response)) { | |
| String contentType = response.headers().firstValue("content-type").orElse("undefined"); | |
| boolean isValidContentType = isValidContentType(contentType); | |
| if (!isValidContentType) { | |
| logger.error("For toolWithEdition {} and version {} the download has an invalid content type {} for URL {}", toolWithEdition, version, | |
| contentType, url); | |
| return false; | |
| } | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } |
But For toolWithEdition can only be found once in the logs comming from a JUnit test.
However, we are updating an existing release...
IDEasy/url-updater/src/main/java/com/devonfw/tools/ide/url/updater/AbstractUrlUpdater.java
Line 800 in 5e9ba72
| doUpdateStatusJson(isSuccess(response), response.statusCode(), edition, urlVersion, url, urlDownloadFile, true); |
I do not see how this is possible:
IDEasy/url-updater/src/main/java/com/devonfw/tools/ide/url/updater/AbstractUrlUpdater.java
Lines 332 to 338 in 5e9ba72
| protected boolean isSuccess(HttpResponse<?> response) { | |
| if (response == null) { | |
| return false; | |
| } | |
| return response.statusCode() == 200; | |
| } |
Needs to be debugged.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status