Skip to content

Commit dea92f1

Browse files
committed
Reuse body variable
1 parent 152274e commit dea92f1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

myconext-server/src/main/java/myconext/sms/SMSServiceImpl.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
@SuppressWarnings("unchecked")
2323
public class SMSServiceImpl implements SMSService {
2424

25+
private static final Log LOG = LogFactory.getLog(SMSServiceImpl.class);
26+
2527
private final String url;
2628
public final String route;
2729
private final String templateNl;
2830
private final String templateEn;
2931
private final RestTemplate restTemplate = new RestTemplate();
3032
private final MultiValueMap<String, String> headers = new HttpHeaders();
31-
private static final Log LOG = LogFactory.getLog(SMSServiceImpl.class);
3233

3334

3435
@SneakyThrows
@@ -58,8 +59,11 @@ public String send(String mobile, String code, Locale locale) {
5859
"recipients", List.of(mobile)
5960
);
6061

61-
RequestEntity<?> requestEntity = new RequestEntity(body, headers, HttpMethod.POST, URI.create(url));
62-
LOG.info(String.format("SMS url : %s, route : %s body: %s", url, route, requestEntity.getBody()));
62+
RequestEntity<?> requestEntity = new RequestEntity<>(body, headers, HttpMethod.POST, URI.create(url));
63+
LOG.info(String.format("Sending SMS with url : %s, route : %s body: %s",
64+
url,
65+
route,
66+
body));
6367
restTemplate.exchange(requestEntity, Void.class);
6468
return format;
6569
}

0 commit comments

Comments
 (0)