diff --git a/forms/account-api/src/main/java/org/keycloak/account/AccountProvider.java b/forms/account-api/src/main/java/org/keycloak/account/AccountProvider.java index f5bcbb2838..6e5511e193 100755 --- a/forms/account-api/src/main/java/org/keycloak/account/AccountProvider.java +++ b/forms/account-api/src/main/java/org/keycloak/account/AccountProvider.java @@ -19,37 +19,37 @@ import org.keycloak.provider.Provider; */ public interface AccountProvider extends Provider { - AccountProvider setUriInfo(UriInfo uriInfo); + AccountProvider setUriInfo(UriInfo uriInfo); - AccountProvider setHttpHeaders(HttpHeaders httpHeaders); + AccountProvider setHttpHeaders(HttpHeaders httpHeaders); - Response createResponse(AccountPages page); + Response createResponse(AccountPages page); - AccountProvider setError(String message, Object... parameters); + AccountProvider setError(String message, Object ... parameters); - AccountProvider setErrors(List messages); + AccountProvider setErrors(List messages); - AccountProvider setSuccess(String message, Object... parameters); + AccountProvider setSuccess(String message, Object ... parameters); - AccountProvider setWarning(String message, Object... parameters); + AccountProvider setWarning(String message, Object ... parameters); - AccountProvider setUser(UserModel user); + AccountProvider setUser(UserModel user); - AccountProvider setProfileFormData(MultivaluedMap formData); + AccountProvider setProfileFormData(MultivaluedMap formData); - AccountProvider setStatus(Response.Status status); + AccountProvider setStatus(Response.Status status); - AccountProvider setRealm(RealmModel realm); + AccountProvider setRealm(RealmModel realm); - AccountProvider setReferrer(String[] referrer); + AccountProvider setReferrer(String[] referrer); - AccountProvider setEvents(List events); + AccountProvider setEvents(List events); - AccountProvider setSessions(List sessions); + AccountProvider setSessions(List sessions); - AccountProvider setPasswordSet(boolean passwordSet); + AccountProvider setPasswordSet(boolean passwordSet); - AccountProvider setStateChecker(String stateChecker); + AccountProvider setStateChecker(String stateChecker); - AccountProvider setFeatures(boolean social, boolean events, boolean passwordUpdateSupported); + AccountProvider setFeatures(boolean social, boolean events, boolean passwordUpdateSupported); } diff --git a/forms/account-freemarker/src/main/java/org/keycloak/account/freemarker/FreeMarkerAccountProvider.java b/forms/account-freemarker/src/main/java/org/keycloak/account/freemarker/FreeMarkerAccountProvider.java index 282853197d..cb3949a492 100755 --- a/forms/account-freemarker/src/main/java/org/keycloak/account/freemarker/FreeMarkerAccountProvider.java +++ b/forms/account-freemarker/src/main/java/org/keycloak/account/freemarker/FreeMarkerAccountProvider.java @@ -115,7 +115,7 @@ public class FreeMarkerAccountProvider implements AccountProvider { Locale locale = LocaleHelper.getLocale(realm, user, uriInfo, headers); Properties messagesBundle; try { - messagesBundle = theme.getMessages(locale); + messagesBundle = theme.getMessages(locale); attributes.put("msg", new MessageFormatterMethod(locale, messagesBundle)); } catch (IOException e) { logger.warn("Failed to load messages", e); @@ -204,46 +204,45 @@ public class FreeMarkerAccountProvider implements AccountProvider { return this; } - protected void setMessage(MessageType type, String message, Object... parameters) { - messageType = type; - messages = new ArrayList<>(); - messages.add(new FormMessage(null, message, parameters)); - } + protected void setMessage(MessageType type, String message, Object... parameters) { + messageType = type; + messages = new ArrayList<>(); + messages.add(new FormMessage(null, message, parameters)); + } - protected String formatMessage(FormMessage message, Properties messagesBundle, Locale locale) { - if (message == null) - return null; - if (messagesBundle.containsKey(message.getMessage())) { - return new MessageFormat(messagesBundle.getProperty(message.getMessage()), locale) - .format(message.getParameters()); - } else { - return message.getMessage(); - } - } + protected String formatMessage(FormMessage message, Properties messagesBundle, Locale locale) { + if (message == null) + return null; + if (messagesBundle.containsKey(message.getMessage())) { + return new MessageFormat(messagesBundle.getProperty(message.getMessage()), locale).format(message.getParameters()); + } else { + return message.getMessage(); + } + } - @Override - public AccountProvider setErrors(List messages) { - this.messageType = MessageType.ERROR; - this.messages = new ArrayList<>(messages); - return this; - } + @Override + public AccountProvider setErrors(List messages) { + this.messageType = MessageType.ERROR; + this.messages = new ArrayList<>(messages); + return this; + } @Override public AccountProvider setError(String message, Object ... parameters) { - setMessage(MessageType.ERROR, message, parameters); + setMessage(MessageType.ERROR, message, parameters); return this; } @Override public AccountProvider setSuccess(String message, Object ... parameters) { - setMessage(MessageType.SUCCESS, message, parameters); + setMessage(MessageType.SUCCESS, message, parameters); return this; } @Override public AccountProvider setWarning(String message, Object ... parameters) { - setMessage(MessageType.WARNING, message, parameters); + setMessage(MessageType.WARNING, message, parameters); return this; } diff --git a/forms/common-freemarker/src/main/java/org/keycloak/freemarker/beans/MessageType.java b/forms/common-freemarker/src/main/java/org/keycloak/freemarker/beans/MessageType.java index a404c7e2ea..12ec23cdba 100644 --- a/forms/common-freemarker/src/main/java/org/keycloak/freemarker/beans/MessageType.java +++ b/forms/common-freemarker/src/main/java/org/keycloak/freemarker/beans/MessageType.java @@ -11,7 +11,7 @@ package org.keycloak.freemarker.beans; * @author Vlastimil Elias (velias at redhat dot com) */ public enum MessageType { - - SUCCESS, WARNING, ERROR + + SUCCESS, WARNING, ERROR }