KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > smb > server > SMBSrvException


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.filesys.smb.server;
18
19 import org.alfresco.filesys.smb.SMBErrorText;
20
21 /**
22  * SMB exception class
23  * <p>
24  * This class holds the detail of an SMB network error. The SMB error class and error code are
25  * available to give extra detail about the error condition.
26  */

27 public class SMBSrvException extends Exception JavaDoc
28 {
29     private static final long serialVersionUID = 3976733662123341368L;
30
31     // SMB error class
32

33     protected int m_errorclass;
34
35     // SMB error code
36

37     protected int m_errorcode;
38
39     /**
40      * Construct an SMB exception with the specified error class/error code.
41      */

42     public SMBSrvException(int errclass, int errcode)
43     {
44         super(SMBErrorText.ErrorString(errclass, errcode));
45         m_errorclass = errclass;
46         m_errorcode = errcode;
47     }
48
49     /**
50      * Construct an SMB exception with the specified error class/error code and additional text
51      * error message.
52      */

53     public SMBSrvException(int errclass, int errcode, String JavaDoc msg)
54     {
55         super(msg);
56         m_errorclass = errclass;
57         m_errorcode = errcode;
58     }
59
60     /**
61      * Construct an SMB exception using the error class/error code in the SMB packet
62      */

63     protected SMBSrvException(SMBSrvPacket pkt)
64     {
65         super(SMBErrorText.ErrorString(pkt.getErrorClass(), pkt.getErrorCode()));
66         m_errorclass = pkt.getErrorClass();
67         m_errorcode = pkt.getErrorCode();
68     }
69
70     /**
71      * Return the error class for this SMB exception.
72      *
73      * @return SMB error class.
74      */

75     public int getErrorClass()
76     {
77         return m_errorclass;
78     }
79
80     /**
81      * Return the error code for this SMB exception
82      *
83      * @return SMB error code
84      */

85     public int getErrorCode()
86     {
87         return m_errorcode;
88     }
89
90     /**
91      * Return the error text for the SMB exception
92      *
93      * @return Error text string.
94      */

95     public String JavaDoc getErrorText()
96     {
97         return SMBErrorText.ErrorString(m_errorclass, m_errorcode);
98     }
99 }
Popular Tags