Skip to content

UrlUpdater creates error entries for HTTP status 200ย #1634

@hohwille

Description

@hohwille

Actual behavior

HTTP status 200 is OK and means success. However, the URL Updater sometimes treats that as error:

https://github.com/devonfw/ide-urls/blob/5a9d6ce981e8893d10b06501177731f6cf01eb92/python/python/3.10.0/status.json#L20-L33

Reproduce

scan ide-urls for "code" : 200.

Expected behavior

HTTP status 200 gets treated as success and not as error.

IDEasy status

current UrlUpdater workflow

Related/Dependent issues

No response

Comments/Hints

Maybe the checksum changed?

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?

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...

doUpdateStatusJson(isSuccess(response), response.statusCode(), edition, urlVersion, url, urlDownloadFile, true);

I do not see how this is possible:

protected boolean isSuccess(HttpResponse<?> response) {
if (response == null) {
return false;
}
return response.statusCode() == 200;
}

Needs to be debugged.

Metadata

Metadata

Assignees

Labels

urlside-urls repo and related processes and featuresworkflowGitHub actions (CI,CD,update urls/CVEs)

Type

Projects

Status

๐Ÿ†• New

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions