Skip to content

Commit d8d6c1d

Browse files
author
amvanbaren
committed
Use format specifiers
Format specifiers should be used instead of string concatenation.
1 parent 1b6b2bc commit d8d6c1d

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

server/src/main/java/org/eclipse/openvsx/eclipse/EclipseService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ private EclipseProfile parseEclipseProfile(ResponseEntity<String> response) {
274274
try {
275275
if (json.startsWith("[\"")) {
276276
var error = objectMapper.readValue(json, TYPE_LIST_STRING);
277-
logger.error("Profile request failed:\n" + json);
277+
logger.error("Profile request failed:\n{}", json);
278278
throw new ErrorResultException("Request to the Eclipse Foundation server failed: " + error,
279279
HttpStatus.INTERNAL_SERVER_ERROR);
280280
} else if (json.startsWith("[")) {
@@ -394,7 +394,7 @@ private PublisherAgreement parseAgreementResponse(ResponseEntity<String> respons
394394
PublisherAgreementResponse agreementResponse;
395395
if (json.startsWith("[\"")) {
396396
var error = objectMapper.readValue(json, TYPE_LIST_STRING);
397-
logger.error("Publisher agreement request failed:\n" + json);
397+
logger.error("Publisher agreement request failed:\n{}", json);
398398
throw new ErrorResultException("Request to the Eclipse Foundation server failed: " + error,
399399
HttpStatus.INTERNAL_SERVER_ERROR);
400400
} else if (json.startsWith("[")) {

server/src/main/java/org/eclipse/openvsx/eclipse/PublisherComplianceChecker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private void deactivateExtensions(List<PersonalAccessToken> accessTokens) {
104104
entityManager.merge(version);
105105
var extension = version.getExtension();
106106
affectedExtensions.add(extension);
107-
logger.info("Deactivated: " + accessToken.getUser().getLoginName() + " - " + NamingUtil.toLogFormat(version));
107+
logger.info("Deactivated: {} - {}", accessToken.getUser().getLoginName(), NamingUtil.toLogFormat(version));
108108
}
109109
}
110110

server/src/main/java/org/eclipse/openvsx/migration/OrphanNamespaceMigration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ public void fixOrphanNamespaces() {
7272
});
7373

7474
if (count[0] > 0)
75-
logger.info("Deleted " + count[0] + " namespaces that were orphaned and empty.");
75+
logger.info("Deleted {} namespaces that were orphaned and empty.", count[0]);
7676
if (count[1] > 0)
77-
logger.info("Assigned explicit members to " + count[1] + " orphaned namespaces.");
77+
logger.info("Assigned explicit members to {} orphaned namespaces.", count[1]);
7878
if (count[2] > 0)
79-
logger.info("Found " + count[2] + " orphaned namespaces that could not be fixed.");
79+
logger.info("Found {} orphaned namespaces that could not be fixed.", count[2]);
8080
}
8181
}

server/src/main/java/org/eclipse/openvsx/search/ElasticSearchService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void initSearchIndex(ApplicationStartedEvent event) {
100100
stopWatch.start();
101101
updateSearchIndex(clearOnStart);
102102
stopWatch.stop();
103-
logger.info("Initialized search index in " + stopWatch.getTotalTimeMillis() + " ms");
103+
logger.info("Initialized search index in {} ms", stopWatch.getTotalTimeMillis());
104104
}
105105

106106
/**
@@ -118,7 +118,7 @@ public void updateSearchIndex() {
118118
stopWatch.start();
119119
updateSearchIndex(false);
120120
stopWatch.stop();
121-
logger.info("Updated search index in " + stopWatch.getTotalTimeMillis() + " ms");
121+
logger.info("Updated search index in {} ms", stopWatch.getTotalTimeMillis());
122122
}
123123

124124
/**

server/src/main/java/org/eclipse/openvsx/storage/StorageMigration.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ public void findResources(ApplicationStartedEvent event) {
8484
if (!resourceQueue.isEmpty()) {
8585
for (var i = 0; i < migrations.size(); i++) {
8686
if (migrationCount[i] > 0) {
87-
logger.info("Migrating " + migrationCount[i] + " resources from "
88-
+ migrations.get(i) + " to " + storageType + ".");
87+
logger.info("Migrating {} resources from {} to {}.", migrationCount[i], migrations.get(i), storageType);
8988
}
9089
}
9190
var duration = Duration.of(migrationDelay, ChronoUnit.MILLIS);
@@ -114,7 +113,7 @@ public void migrateResources() {
114113

115114
var remainingCount = resourceQueue.size();
116115
if (remainingCount > 0 && remainingCount % 1000 == 0) {
117-
logger.info("Remaining resources to migrate: " + remainingCount);
116+
logger.info("Remaining resources to migrate: {}", remainingCount);
118117
}
119118
}
120119
}

0 commit comments

Comments
 (0)