01: package com.sun.portal.desktop.deployment;
02:
03: import com.sun.portal.desktop.DesktopException;
04:
05: public class ParFileException extends DesktopException {
06:
07: public ParFileException(String key) {
08: super (Par.getLocalizedString(key));
09: }
10:
11: public ParFileException(String key, Throwable e) {
12: super (Par.getLocalizedString(key), e);
13: }
14:
15: public ParFileException(String key, java.lang.Object[] token) {
16: super (Par.getLocalizedString(key, token));
17: }
18:
19: public ParFileException(String key, Throwable e,
20: java.lang.Object[] token) {
21: super (Par.getLocalizedString(key, token), e);
22: }
23:
24: // ParFileException implements getMessage() in order to make
25: // it display prettier when used for command line errors, while
26: // including the wrapped exception.
27:
28: public String getMessage() {
29: StringBuffer buf = new StringBuffer();
30:
31: String str = super .getMessage();
32: if (str.endsWith(".")) {
33: str = str.substring(0, str.length() - 1);
34: }
35: buf.append(str);
36: Throwable cause = getCause();
37: if (cause != null) {
38: if (cause instanceof ParFileException) {
39: buf.append("; ");
40: buf.append(cause.getMessage());
41: } else {
42: buf.append(" (");
43: buf.append(cause.toString());
44: buf.append(").");
45: }
46: } else {
47: buf.append(".");
48: }
49:
50: return buf.toString();
51: }
52: }
|