Skip to content

Commit 9d6cf08

Browse files
committed
refactor: use recently introduced StringSubstitutor.setEnableUndefinedVariableException()
Follow-up to #1182
1 parent 7550a60 commit 9d6cf08

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/main/java/ru/mystamps/web/feature/report/ReportServiceImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ public String prepareDailyStatistics(AdminDailyReport report) {
7373
put(ctx, "invalid_csrf_cnt", report.getInvalidCsrfCounter());
7474
put(ctx, "bad_request_cnt", -1L); // FIXME: #122
7575

76-
return new StringSubstitutor(ctx).replace(template);
76+
StringSubstitutor substitutor = new StringSubstitutor(ctx);
77+
substitutor.setEnableUndefinedVariableException(true);
78+
return substitutor.replace(template);
7779
}
7880

7981
private static void put(Map<String, String> ctx, String key, long value) {

src/main/java/ru/mystamps/web/feature/site/MailServiceImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ private String getTextOfActivationMail(SendUsersActivationDto activation) {
135135
ctx.put("expire_after_days", String.valueOf(CronService.PURGE_AFTER_DAYS));
136136

137137
StringSubstitutor substitutor = new StringSubstitutor(ctx);
138+
substitutor.setEnableUndefinedVariableException(true);
138139
return substitutor.replace(template);
139140
}
140141

@@ -151,6 +152,7 @@ private String getSubjectOfDailyStatisticsMail(AdminDailyReport report) {
151152
ctx.put("total_changes", String.valueOf(report.countTotalChanges()));
152153

153154
StringSubstitutor substitutor = new StringSubstitutor(ctx);
155+
substitutor.setEnableUndefinedVariableException(true);
154156
return substitutor.replace(template);
155157
}
156158

0 commit comments

Comments
 (0)