1 5 package org.exoplatform.commons.exception; 6 7 import java.util.ResourceBundle ; 8 import org.exoplatform.commons.utils.Formater; 9 15 public class ExoMessageException extends ExoException { 16 private static Formater ft_ = Formater.getDefaultFormater() ; 17 18 private String messageKey_ ; 19 private Object [] args_ ; 20 21 public ExoMessageException(String messageKey) { 22 messageKey_ = messageKey ; 23 } 24 25 public ExoMessageException(String messageKey, Object [] args) { 26 messageKey_ = messageKey ; 27 args_ = args ; 28 } 29 30 public String getMessageKey() { return messageKey_ ; } 31 32 public Object [] getArguments() { return args_ ; } 33 34 public String getMessage(ResourceBundle res) { 35 if(args_ == null) { 36 return res.getString(messageKey_) ; 37 } 38 return ft_.format(res.getString(messageKey_) , args_) ; 39 } 40 41 public String getExceptionDescription() { 42 return "Usually, this is not a critical exception. The exception is raised " + 43 "when unexpected condition such wrong input, object not found...." + 44 "The application should not crashed and it should continue working"; 45 } 46 47 public String getErrorCode() { return "EXO ERROR: " ; } 48 } | Popular Tags |