01: /**
02: * $Id: NetFileException.java,v 1.8 2005/11/30 11:26:34 ss150821 Exp $
03: * Copyright 2002 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.netfile.servlet.java1;
14:
15: public class NetFileException extends java.lang.Exception {
16: String[] sa_message;
17: public static String KEY_IDENTIFIER_PREFIX = "\n";
18:
19: //Exception codes used for Win hosts
20: public static final int NETFILE_CLASSNOTFOUND = 5;
21: public static final int NETFILE_WINERROR_CODE = 7;
22: public static final int NETFILE_CREATEERROR = 8;
23: public static final int NETFILE_SMBCLIENT_NOTFOUND = 4;
24: public static final int NETFILE_INVALID_DOMAIN = 2;
25: public static final int NETFILE_SERVER_NOTIN_DOMAIN = 9;
26: public static final int NETFILE_UNKNOWN_HOST_EXCEPTION = 11;
27:
28: private int excepCode;
29:
30: public NetFileException() {
31: super ();
32: }
33:
34: /** Creates new NetFileException */
35: public NetFileException(String[] sa_message) {
36: super ("Exception in NetFile Servlet");
37: this .sa_message = sa_message;
38: }
39:
40: public NetFileException(String s_message) {
41: super (s_message);
42: this .sa_message = new String[] { s_message };
43: }
44:
45: public NetFileException(Throwable e) {
46: super (e.getMessage());
47: this .sa_message = new String[] { e.getMessage() };
48: }
49:
50: public String getMessage(NetFileResource nfr_locale_bundle) {
51: StringBuffer sb_message = new StringBuffer();
52: for (int i = 0; i < sa_message.length; ++i) {
53: if (sa_message[i].startsWith(KEY_IDENTIFIER_PREFIX)) {
54: sb_message.append(nfr_locale_bundle
55: .getString(sa_message[i].substring(1,
56: sa_message[i].length())));
57: } else {
58: sb_message.append(sa_message[i]);
59: }
60: }
61: return sb_message.toString();
62: }
63:
64: public NetFileException(int arg, String comment) {
65: super (comment);
66: excepCode = arg;
67: this .sa_message = new String[] { comment };
68: }
69:
70: public int getErrorCode() {
71: return excepCode;
72: }
73:
74: public void setErrorCode(int errorCode) {
75: excepCode = errorCode;
76: }
77:
78: }
|