Skip to content

Commit

Permalink
Remove debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
amvanbaren committed Sep 20, 2024
1 parent a14f640 commit 9574246
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 59 deletions.
12 changes: 0 additions & 12 deletions server/src/main/java/org/eclipse/openvsx/LocalRegistryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -791,13 +791,9 @@ public ExtensionJson toExtensionVersionJson(ExtensionVersion extVersion, String

var json = extVersion.toExtensionJson();
if(extension.getReplacement() != null) {
// TODO remove when done debugging
logger.info("Add replacement to JSON");
var replacementId = extension.getReplacement().getId();
var replacement = repositories.findLatestReplacement(replacementId, targetPlatform, false, onlyActive);
if(replacement != null) {
// TODO remove when done debugging
logger.info("Found active replacement in DB");
json.replacement = new ExtensionReplacementJson();
json.replacement.url = UrlUtil.createApiUrl(webuiUrl, "extension", replacement.getExtension().getNamespace().getName(), replacement.getExtension().getName());
json.replacement.displayName = StringUtils.isNotEmpty(replacement.getDisplayName())
Expand Down Expand Up @@ -876,13 +872,9 @@ public ExtensionJson toExtensionVersionJson(

var extension = extVersion.getExtension();
if(extension.getReplacement() != null) {
// TODO remove when done debugging
logger.info("Add replacement to JSON");
var replacementId = extension.getReplacement().getId();
var replacement = repositories.findLatestReplacement(replacementId, targetPlatformParam, false, true);
if(replacement != null) {
// TODO remove when done debugging
logger.info("Found active replacement in DB");
json.replacement = new ExtensionReplacementJson();
json.replacement.url = UrlUtil.createApiUrl(serverUrl, "api", replacement.getExtension().getNamespace().getName(), replacement.getExtension().getName());
json.replacement.displayName = StringUtils.isNotEmpty(replacement.getDisplayName())
Expand Down Expand Up @@ -966,13 +958,9 @@ public ExtensionJson toExtensionVersionJsonV2(

var extension = extVersion.getExtension();
if(extension.getReplacement() != null) {
// TODO remove when done debugging
logger.info("Add replacement to JSON");
var replacementId = extension.getReplacement().getId();
var replacement = repositories.findLatestReplacement(replacementId, targetPlatformParam, false, true);
if(replacement != null) {
// TODO remove when done debugging
logger.info("Found active replacement in DB");
json.replacement = new ExtensionReplacementJson();
json.replacement.url = UrlUtil.createApiUrl(serverUrl, "api", replacement.getExtension().getNamespace().getName(), replacement.getExtension().getName());
json.replacement.displayName = StringUtils.isNotEmpty(replacement.getDisplayName())
Expand Down
2 changes: 0 additions & 2 deletions server/src/main/java/org/eclipse/openvsx/admin/AdminAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ public ResponseEntity<ExtensionJson> getExtension(@PathVariable String namespace
json.name = extension.getName();
json.allVersions = Collections.emptyMap();
json.allTargetPlatformVersions = Collections.emptyList();
// TODO remove after done debugging
logger.info("Admin extension | deprecated: {} | downloadable: {}", extension.isDeprecated(), extension.isDownloadable());
json.deprecated = extension.isDeprecated();
json.active = extension.isActive();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import org.eclipse.openvsx.json.SearchEntryJson;
import org.eclipse.openvsx.util.TargetPlatform;
import org.eclipse.openvsx.util.TimeUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;
import java.time.LocalDateTime;
Expand All @@ -29,8 +27,6 @@
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "targetPlatform", "version" })})
public class ExtensionVersion implements Serializable {

private static final Logger LOGGER = LoggerFactory.getLogger(ExtensionVersion.class);

public static final Comparator<ExtensionVersion> SORT_COMPARATOR =
Comparator.comparing(ExtensionVersion::getSemanticVersion)
.thenComparing(ExtensionVersion::isUniversalTargetPlatform, Comparator.reverseOrder())
Expand Down Expand Up @@ -186,8 +182,6 @@ public ExtensionJson toExtensionJson() {
json.bundledExtensions = toExtensionReferenceJson(this.getBundledExtensions());
}

// TODO remove when done debugging
LOGGER.info("toExtensionJson | deprecated: {} | downloadable: {}", extension.isDeprecated(), extension.isDownloadable());
json.deprecated = extension.isDeprecated();
json.downloadable = extension.isDownloadable();
return json;
Expand Down Expand Up @@ -222,8 +216,6 @@ public SearchEntryJson toSearchEntryJson() {
entry.timestamp = TimeUtil.toUTCString(this.getTimestamp());
entry.displayName = this.getDisplayName();
entry.description = this.getDescription();
// TODO remove when done debugging
LOGGER.info("toSearchEntryJson | deprecated: {}", extension.isDeprecated());
entry.deprecated = extension.isDeprecated();
return entry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ private void processMaliciousExtensions(JsonNode json) {
for(var item : node) {
logger.info("malicious: {}", item.asText());
var extensionId = NamingUtil.fromExtensionId(item.asText());
// TODO remove after done debugging
if(extensionId == null) {
logger.error("failed to parse extension id: {}", item.asText());
continue;
}

// TODO remove after done debugging
logger.info("extension id: {} | namespace: {} | extension: {}", item.asText(), extensionId.namespace(), extensionId.extension());
if(extensionId != null && repositories.hasExtension(extensionId.namespace(), extensionId.extension())) {
logger.info("delete malicious extension");
admin.deleteExtension(extensionId.namespace(), extensionId.extension(), adminUser);
Expand All @@ -82,13 +74,9 @@ private void processDeprecatedExtensions(JsonNode json) {
logger.info("deprecated: {}", field.getKey());
var extensionId = NamingUtil.fromExtensionId(field.getKey());
if(extensionId == null) {
// TODO remove after done debugging
logger.error("failed to parse extension id: {}", field.getKey());
return;
}

// TODO remove after done debugging
logger.info("extension id: {} | namespace: {} | extension: {}", field.getKey(), extensionId.namespace(), extensionId.extension());
var value = field.getValue();
if(value.isBoolean()) {
service.updateExtension(extensionId, value.asBoolean(), null, true);
Expand All @@ -98,15 +86,6 @@ private void processDeprecatedExtensions(JsonNode json) {
? NamingUtil.fromExtensionId(replacement.get("id").asText())
: null;

// TODO remove after done debugging
if(replacement != null && replacement.isObject()) {
if(replacementId == null) {
logger.error("failed to parse replacement id: '{}'", replacement.get("id").asText());
} else {
logger.info("extension id: {} | namespace: {} | extension: {}", replacement.get("id").asText(), replacementId.namespace(), replacementId.extension());
}
}

var disallowInstall = value.has("disallowInstall") && value.get("disallowInstall").asBoolean(false);
service.updateExtension(extensionId, true, replacementId, !disallowInstall);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,8 @@ public UserData createExtensionControlUser() {

@Transactional
public void updateExtension(ExtensionId extensionId, boolean deprecated, ExtensionId replacementId, boolean downloadable) {
// TODO remove when done debugging
logger.info(
"Update extension: {}.{} | deprecated: {} | replacement: {} | downloadable: {}",
extensionId.namespace(), extensionId.extension(),
deprecated,
replacementId != null ? replacementId.namespace() + "." + replacementId.extension() : null,
downloadable
);

var extension = repositories.findExtension(extensionId.extension(), extensionId.namespace());
if(extension == null) {
// TODO remove when done debugging
logger.error("Extension not found: {}.{}", extensionId.namespace(), extensionId.extension());
return;
}

Expand All @@ -120,11 +109,6 @@ public void updateExtension(ExtensionId extensionId, boolean deprecated, Extensi
extension.setDownloadable(downloadable);
if(replacementId != null) {
var replacement = repositories.findExtension(replacementId.extension(), replacementId.namespace());
// TODO remove when done debugging
if(replacement == null) {
logger.info("Replacement not found: {}.{}", replacementId.namespace(), replacementId.extension());
}

extension.setReplacement(replacement);
}
if(deprecated != wasDeprecated) {
Expand Down

0 comments on commit 9574246

Please sign in to comment.