1 16 package org.outerj.daisy.frontend.components.userregistrar; 17 18 import org.outerj.daisy.repository.LocalizedException; 19 20 import java.util.Locale ; 21 import java.util.ResourceBundle ; 22 import java.text.MessageFormat ; 23 24 public class RegistrarException extends Exception implements LocalizedException { 25 private String key; 26 private Object [] params; 27 28 public RegistrarException(String key, Object [] params) { 29 this.key = key; 30 this.params = params; 31 } 32 33 public String getMessage() { 34 return getMessage(Locale.US); 35 } 36 37 public String getMessage(Locale locale) { 38 ResourceBundle bundle = ResourceBundle.getBundle("org/outerj/daisy/frontend/components/userregistrar/messages", locale); 39 return MessageFormat.format(bundle.getString(key), params); 40 } 41 } 42 | Popular Tags |