Source:
<code>public void setSettings(@RequestBody SettingsDto settings) { String host = settings.getHost(); String port = settings.getPort(); String username = settings.getUsername(); String password = settings.getPassword(); String days = settings.getLogPurgeTime(); String purgeEnabled = settings.getLogPurgeEnable(); StringBuilder exceptionMessage = new StringBuilder(); if (isBlank(host)) { exceptionMessage .append(String.format(REQUIRED_FORMAT, MAIL_HOST_PROPERTY)) .append(NEW_LINE); } if (isBlank(port)) { exceptionMessage .append(String.format(REQUIRED_FORMAT, MAIL_PORT_PROPERTY)) .append(NEW_LINE); } else if (!isNumeric(port)) { exceptionMessage .append(String.format(NUMERIC_FORMAT, MAIL_PORT_PROPERTY)) .append(NEW_LINE); } <START> if (isBlank(username)) { <END> exceptionMessage .append(String.format(REQUIRED_FORMAT, MAIL_USERNAME_PROPERTY)) .append(NEW_LINE); } if (isBlank(password)) { exceptionMessage .append(String.format(REQUIRED_FORMAT, MAIL_PASSWORD_PROPERTY)) .append(NEW_LINE); } if (TRUE.equals(purgeEnabled) && (!isNumeric(days))) { exceptionMessage .append(String.format(NUMERIC_FORMAT, MAIL_LOG_PURGE_TIME_PROPERY)) .append(NEW_LINE); } if (exceptionMessage.length() > 0) { throw new IllegalStateException(exceptionMessage.toString()); } settingsFacade.saveConfigProperties(EMAIL_PROPERTIES_FILE_NAME, settings.toProperties()); settingsFacade.saveRawConfig(EMAIL_ADDITIONAL_PROPERTIES_FILE_NAME, settings.getAdditionalProps()); if (emailPurger != null) { emailPurger.handleSettingsChange(); } mailSender.setHost(host); mailSender.setPort(Integer.valueOf(port)); mailSender.setUsername(username); mailSender.setPassword(password); mailSender.setJavaMailProperties(settings.getAdditionalProps()); }</code><technical_language>required</technical_language>

Target:
public void setSettings(@RequestBody SettingsDto settings) { String host = settings.getHost(); String port = settings.getPort(); String username = settings.getUsername(); String password = settings.getPassword(); String days = settings.getLogPurgeTime(); String purgeEnabled = settings.getLogPurgeEnable(); StringBuilder exceptionMessage = new StringBuilder(); if (isBlank(host)) { exceptionMessage .append(String.format(REQUIRED_FORMAT, MAIL_HOST_PROPERTY)) .append(NEW_LINE); } if (isBlank(port)) { exceptionMessage .append(String.format(REQUIRED_FORMAT, MAIL_PORT_PROPERTY)) .append(NEW_LINE); } else if (!isNumeric(port)) { exceptionMessage .append(String.format(NUMERIC_FORMAT, MAIL_PORT_PROPERTY)) .append(NEW_LINE); } if (TRUE.equals(purgeEnabled) && (!isNumeric(days))) { exceptionMessage .append(String.format(NUMERIC_FORMAT, MAIL_LOG_PURGE_TIME_PROPERY)) .append(NEW_LINE); } if (exceptionMessage.length() > 0) { throw new IllegalStateException(exceptionMessage.toString()); } OutputStream os = new ByteArrayOutputStream(); try { settings.getAdditionalProps().store(os, "AdditionalEmailProperties"); } catch (IOException e) { throw new MotechException("Error parsing additional email properties", e); } settingsFacade.saveConfigProperties(EMAIL_PROPERTIES_FILE_NAME, settings.toProperties()); settingsFacade.saveRawConfig(EMAIL_ADDITIONAL_PROPERTIES_FILE_NAME, new String(os.toString())); if (emailPurger != null) { emailPurger.handleSettingsChange(); } mailSender.setHost(host); mailSender.setPort(Integer.valueOf(port)); mailSender.setUsername(username); mailSender.setPassword(password); mailSender.setJavaMailProperties(settings.getAdditionalProps()); }