1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.apache.commons.i18n;
24
25 import java.text.MessageFormat;
26 import java.util.Locale;
27
28 import org.apache.commons.i18n.bundles.ErrorBundle;
29
30 public class LocalizedRuntimeException extends RuntimeException {
31 private ErrorBundle errorMessage;
32
33 public LocalizedRuntimeException(ErrorBundle errorMessage, Throwable throwable) {
34 super(errorMessage.getSummary(Locale.getDefault(), throwable.getMessage()), throwable);
35 this.errorMessage = errorMessage;
36 }
37
38 public LocalizedRuntimeException(ErrorBundle errorMessage) {
39 super(errorMessage.getSummary(
40 Locale.getDefault(),
41 MessageFormat.format(
42 MessageManager.INTERNAL_MESSAGES.getString(MessageManager.MESSAGE_ENTRY_NOT_FOUND),
43 new String[] { errorMessage.getId(), ErrorBundle.SUMMARY })));
44 this.errorMessage = errorMessage;
45 }
46
47 public ErrorBundle getErrorMessage() {
48 return errorMessage;
49 }
50 }