Merge pull request 'Fix jit mail template not found issue' (#314) from rajitha/device-mgt-core:jit-template into master

Reviewed-on: community/device-mgt-core#314
master
Navod Zoysa 10 months ago
commit 6ae7a527c0

@ -1231,17 +1231,17 @@ public class UserManagementServiceImpl implements UserManagementService {
} }
private String getTemplateName(String deviceType, String prefix, String separator) throws NoSuchFileException { private String getTemplateName(String deviceType, String prefix, String separator) throws NoSuchFileException {
String templateName = deviceType + separator + prefix + ".vm"; String templateName = deviceType + separator + prefix;
List<String> templatePathSegments = List<String> templatePathSegments =
Arrays.asList(CarbonUtils.getCarbonHome(), "repository", "resources", "email-templates", templateName); Arrays.asList(CarbonUtils.getCarbonHome(), "repository", "resources", "email-templates", templateName + ".vm");
File template = new File(String.join(File.separator, templatePathSegments)); File template = new File(String.join(File.separator, templatePathSegments));
if (template.exists()) { if (template.exists()) {
return templateName; return templateName;
} }
String defaultTemplateName = "default" + separator + prefix + ".vm"; String defaultTemplateName = "default" + separator + prefix;
List<String> defaultTemplatePathSegments = List<String> defaultTemplatePathSegments =
Arrays.asList(CarbonUtils.getCarbonHome(), "repository", "resources", "email-templates", defaultTemplateName); Arrays.asList(CarbonUtils.getCarbonHome(), "repository", "resources", "email-templates", defaultTemplateName + ".vm");
File defaultTemplate = new File(String.join(File.separator, defaultTemplatePathSegments)); File defaultTemplate = new File(String.join(File.separator, defaultTemplatePathSegments));
if (defaultTemplate.exists()) { if (defaultTemplate.exists()) {

Loading…
Cancel
Save