KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > boot > CodedException


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.boot;
21
22 /**
23  * Extended {@link Exception} that also requires a integer error code.
24  *
25  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
26  */

27 public class CodedException extends Exception JavaDoc {
28     private int code;
29
30     /**
31      * Constructor.
32      *
33      * @param code error code
34      *
35      */

36     public CodedException(int code) {
37         super();
38         init(code);
39     }
40
41     /**
42      * Constructor.
43      *
44      * @param code error code
45      * @param message
46      * @param cause
47      */

48     public CodedException(int code, String JavaDoc message, Throwable JavaDoc cause) {
49         super(message, cause);
50         init(code);
51     }
52
53     /**
54      * Constructor.
55      *
56      * @param code error code
57      * @param message
58      */

59     public CodedException(int code, String JavaDoc message) {
60         super(message);
61         init(code);
62     }
63
64     /**
65      * Constructor.
66      *
67      * @param code error code
68      * @param cause
69      */

70     public CodedException(int code, Throwable JavaDoc cause) {
71         super(cause);
72         init(code);
73     }
74
75     /**
76      * Get the error code
77      *
78      * @return error code
79      */

80     public int getCode() {
81         return code;
82     }
83
84     /**
85      * Set the error code
86      *
87      * @param code error code
88      */

89     public void setCode(int code) {
90         this.code = code;
91     }
92     
93     void init(int code) {
94         this.code = code;
95     }
96 }
97
Popular Tags