Fix display error message
This commit is contained in:
parent
8cdd640132
commit
01c6597129
@ -1,5 +1,6 @@
|
||||
package jscl.text;
|
||||
|
||||
import org.solovyev.common.msg.AbstractMessage;
|
||||
import org.solovyev.common.msg.Message;
|
||||
import org.solovyev.common.msg.MessageLevel;
|
||||
import org.solovyev.common.msg.MessageType;
|
||||
@ -55,7 +56,7 @@ public class ParseException extends Exception implements Message {
|
||||
@Override
|
||||
public String getLocalizedMessage(@Nonnull Locale locale) {
|
||||
final ResourceBundle rb = ResourceBundle.getBundle("jscl/text/msg/messages", locale);
|
||||
return rb.getString(getMessageCode());
|
||||
return AbstractMessage.makeMessage(locale, rb.getString(getMessageCode()), parameters, MessageType.error);
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
|
@ -118,14 +118,16 @@ public abstract class AbstractMessage implements Message {
|
||||
*/
|
||||
@Nonnull
|
||||
public String getLocalizedMessage(@Nonnull Locale locale) {
|
||||
String result = null;
|
||||
|
||||
final String messagePattern = getMessagePattern(locale);
|
||||
if (!Strings.isEmpty(messagePattern)) {
|
||||
result = Messages.prepareMessage(locale, messagePattern, parameters);
|
||||
return makeMessage(locale, getMessagePattern(locale), parameters, messageLevel);
|
||||
}
|
||||
|
||||
return Strings.getNotEmpty(result, messageLevel.getName() + ": message code = " + messageCode);
|
||||
@Nonnull
|
||||
public static String makeMessage(@Nonnull Locale locale, @Nullable String format, @Nonnull List<?> parameters, @Nonnull MessageLevel messageLevel) {
|
||||
if (!Strings.isEmpty(format)) {
|
||||
return Messages.prepareMessage(locale, format, parameters);
|
||||
}
|
||||
|
||||
return messageLevel.getName() + ": message code = " + format;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
Loading…
Reference in New Issue
Block a user