01: /* WarningException.java
02:
03: {{IS_NOTE
04: Purpose:
05:
06: Description:
07:
08: History:
09: Mon Oct 27 10:19:59 2003, Created by tomyeh
10: }}IS_NOTE
11:
12: Copyright (C) 2003 Potix Corporation. All Rights Reserved.
13:
14: {{IS_RIGHT
15: This program is distributed under GPL Version 2.0 in the hope that
16: it will be useful, but WITHOUT ANY WARRANTY.
17: }}IS_RIGHT
18: */
19: package org.zkoss.lang;
20:
21: import org.zkoss.mesg.Messageable;
22:
23: /**
24: * The warning exception.
25: *
26: * @author tomyeh
27: */
28: public class WarningException extends SystemException implements
29: Warning {
30: public WarningException(String msg, Throwable cause) {
31: super (msg, cause);
32: updateCode(cause);
33: }
34:
35: public WarningException(Throwable cause) {
36: super (cause);
37: updateCode(cause);
38: }
39:
40: public WarningException(int code, Object[] fmtArgs, Throwable cause) {
41: super (code, fmtArgs, cause);
42: }
43:
44: public WarningException(int code, Object fmtArg, Throwable cause) {
45: super (code, fmtArg, cause);
46: }
47:
48: public WarningException(int code, Object[] fmtArgs) {
49: super (code, fmtArgs);
50: }
51:
52: public WarningException(int code, Object fmtArg) {
53: super (code, fmtArg);
54: }
55:
56: public WarningException(int code, Throwable cause) {
57: super (code, cause);
58: }
59:
60: public WarningException(int code) {
61: super (code);
62: }
63:
64: private void updateCode(Throwable cause) {
65: if (!(cause instanceof Messageable))
66: throw new IllegalArgumentException(
67: "cause of WarningException must be Messageable: "
68: + (cause != null ? cause.getClass() : null));
69: _code = ((Messageable) cause).getCode();
70: }
71: }
|