Skip to content

Commit fb2040a

Browse files
committed
Use correct syntax for String.format().
The `{}` is not valid for `String.format()`. Use `%s` instead.
1 parent 3a8f851 commit fb2040a

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

service/src/main/java/org/folio/rest/workflow/controller/WorkflowController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@RequestMapping("/workflows")
3535
public class WorkflowController {
3636

37-
private final static Log LOG = LogFactory.getLog(WorkflowController.class);
37+
private static final Log LOG = LogFactory.getLog(WorkflowController.class);
3838

3939
private WorkflowEngineService workflowEngineService;
4040

@@ -73,7 +73,7 @@ public JsonNode searchWorkflows(
7373
@RequestParam(defaultValue="20") Integer limit,
7474
@TenantHeader String tenant
7575
) {
76-
LOG.debug(String.format("Performing CQL search: {}, offset, limit", query, offset, limit));
76+
LOG.debug(String.format("Performing CQL search: %s, %s, %s", query, offset, limit));
7777
return workflowCqlService.findByCql(query, offset, limit);
7878
}
7979

@@ -92,7 +92,7 @@ public Workflow activateWorkflow(
9292
@TenantHeader String tenant,
9393
@TokenHeader String token
9494
) throws WorkflowEngineServiceException, WorkflowNotFoundException {
95-
LOG.info(String.format("Activating: {}", id));
95+
LOG.info(String.format("Activating: %s", id));
9696

9797
workflowEngineService.exists(id);
9898

@@ -105,7 +105,7 @@ public Workflow deactivateWorkflow(
105105
@TenantHeader String tenant,
106106
@TokenHeader String token
107107
) throws WorkflowEngineServiceException, WorkflowNotFoundException {
108-
LOG.info(String.format("Deactivating: {}", id));
108+
LOG.info(String.format("Deactivating: %s", id));
109109

110110
workflowEngineService.exists(id);
111111

@@ -118,7 +118,7 @@ public ResponseEntity<Object> deleteWorkflow(
118118
@TenantHeader String tenant,
119119
@TokenHeader String token
120120
) throws WorkflowEngineServiceException, WorkflowNotFoundException {
121-
LOG.info(String.format("Deleting: {}", id));
121+
LOG.info(String.format("Deleting: %s", id));
122122

123123
workflowEngineService.exists(id);
124124

@@ -134,7 +134,7 @@ public JsonNode workflowHistory(
134134
@TenantHeader String tenant,
135135
@TokenHeader String token
136136
) throws WorkflowEngineServiceException {
137-
LOG.debug(String.format("Retrieving History: {}", id));
137+
LOG.debug(String.format("Retrieving History: %s", id));
138138
return workflowEngineService.history(id, tenant, token);
139139
}
140140

@@ -145,7 +145,7 @@ public JsonNode startWorkflow(
145145
@TokenHeader String token,
146146
@RequestBody JsonNode context
147147
) throws WorkflowEngineServiceException {
148-
LOG.info(String.format("Starting: {} with context {}", id, context));
148+
LOG.info(String.format("Starting: %s with context %s", id, context));
149149
return workflowEngineService.start(id, tenant, token, context);
150150
}
151151

service/src/main/java/org/folio/rest/workflow/service/WorkflowEngineService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ private Workflow sendWorkflowRequest(WorkflowDto workflow, String requestPath, S
244244

245245
HttpEntity<WorkflowDto> entity = new HttpEntity<>(workflow, headers(tenant, token));
246246
String url = String.format(requestPath, okapiUrl, basePath);
247-
LOG.debug(String.format("Send Okapi workflow engine request {} {}", HttpMethod.POST, url));
247+
LOG.debug(String.format("Send Okapi workflow engine request %s %s", HttpMethod.POST, url));
248248

249249
try {
250250
ResponseEntity<Workflow> response = exchange(url, HttpMethod.POST, entity, Workflow.class);
@@ -254,7 +254,7 @@ private Workflow sendWorkflowRequest(WorkflowDto workflow, String requestPath, S
254254

255255
if (responseWorkflow != null) {
256256
String deploymentId = responseWorkflow.getDeploymentId();
257-
LOG.info(String.format("Workflow is active = {}, deploymentID = {}", Boolean.TRUE.equals(responseWorkflow.getActive()), deploymentId));
257+
LOG.info(String.format("Workflow is active = %s, deploymentID = %s", Boolean.TRUE.equals(responseWorkflow.getActive()), deploymentId));
258258
return workflowRepo.save(responseWorkflow);
259259
}
260260
}
@@ -267,7 +267,7 @@ private Workflow sendWorkflowRequest(WorkflowDto workflow, String requestPath, S
267267

268268
private HttpHeaders headers(String tenant, String token) {
269269
HttpHeaders requestHeaders = new HttpHeaders();
270-
LOG.debug(String.format("Request Headers: tenant '{}' and token '{}'.", tenant, token));
270+
LOG.debug(String.format("Request Headers: tenant '%s' and token '%s'.", tenant, token));
271271

272272
if (tenant != null) {
273273
requestHeaders.add(tenantHeaderName, tenant);
@@ -282,7 +282,7 @@ private HttpHeaders headers(String tenant, String token) {
282282
}
283283

284284
private <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> request, Class<T> responseType) {
285-
LOG.debug(String.format("Exchange for {} {} {}", responseType.getSimpleName(), method, url));
285+
LOG.debug(String.format("Exchange for %s %s %s", responseType.getSimpleName(), method, url));
286286
return this.restTemplate.exchange(url, method, request, responseType, (Object[]) new String[0]);
287287
}
288288

service/src/main/java/org/folio/rest/workflow/service/WorkflowImportService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ private void verifyVersion(JsonNode json) {
534534
String version = json.get(VERSION).asString();
535535

536536
if (!VERSION_PATTERN_1_0.matcher(version).find()) {
537-
LOG.warn(String.format("Unknown version '{}', attempting import anyway.", version));
537+
LOG.warn(String.format("Unknown version '%s', attempting import anyway.", version));
538538
}
539539
} else {
540540
LOG.warn("No version is specified, attempting import anyway.");
@@ -547,7 +547,7 @@ private void verifyVersion(JsonNode json) {
547547
* @param name The name of the unknown file or directory.
548548
*/
549549
private void warnOnUnknownFileOrDir(String name) {
550-
LOG.warn(String.format("Ignoring unknown file or directory: '{}'.", name));
550+
LOG.warn(String.format("Ignoring unknown file or directory: '%s'.", name));
551551
}
552552

553553
}

0 commit comments

Comments
 (0)