package com.fitbank.exception; import java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; /** * * */ public abstract class ExceptionManager { private ResourceBundle messages; private Locale locale; public void setLocale(Locale pLocale) { locale = pLocale; messages = ResourceBundle.getBundle("userMessages", locale); } abstract public String getUserMessage(Throwable pException); abstract public String getCode(Throwable pException); protected String getMessage(String pKey) { try { return messages.getString(pKey); } catch (Throwable e) { return null; } } protected String getMessage(String pKey, Object... pParameters) { try { String msg = this.getMessage(pKey); return MessageFormat.format(msg, pParameters); } catch (Throwable e) { return null; } } }