KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > oyster > exception > ErrorStorage


1 package org.enhydra.oyster.exception;
2
3 /**
4  * Title: Oyster Project
5  * Description: Creating S/MIME email transport capabilities.
6  * Copyright: Copyright (c) 2001
7  * @Author Vladimir Radisic
8  * @Version 2.1.5
9  */

10
11 /**
12  * ErrorStorage is used for storing SMIME error mesages used in construction
13  * of the SMIMEException.
14  */

15 public class ErrorStorage
16 {
17   /**
18    * Returns error message text according to the given input number parameter.
19    * @param errNumber0 error number
20    * @return error message text coresponding to given error number
21    */

22   public static String JavaDoc getErrorMesage(int errNumber0) {
23     String JavaDoc errMsg = "";
24     switch (errNumber0) {
25 // org.enhydra.oyster.der.DERObject class
26
case 1000:
27         errMsg = "SMIME Error 1000: Identifier octet in DER encoding value " +
28                  "can't be negative!";
29         break;
30       case 1001:
31         errMsg = "SMIME Error 1001: Identifier octet in DER encoding value " +
32                  "must be less than 255!";
33         break;
34       case 1002:
35         errMsg = "SMIME Error 1002: Complex Identifier octets in DER encoding" +
36                  " value are not suported in this version of DERObject!";
37         break;
38       case 1003:
39         errMsg = "SMIME Error 1003: Can't use addContent method with Null DER" +
40                  " object!";
41         break;
42       case 1004:
43         errMsg = "SMIME Error 1004: Content of DER object must be present. Use"+
44                  " addContent method or other constructor!";
45         break;
46 // org.enhydra.oyster.der.DERClassContextSpecificPr class
47
case 1005:
48         errMsg = "SMIME Error 1005: Content could be added only once in "+
49                  "primitive DERClassContextSpecific object!";
50         break;
51 // org.enhydra.oyster.der.DERBitString class
52
case 1006:
53         errMsg = "SMIME Error 1006: Number of unused bits must be in range " +
54                  "0-7!";
55         break;
56       case 1007:
57         errMsg = "SMIME Error 1007: BitString can contain only characters 0 " +
58                  "or 1!";
59         break;
60 // org.enhydra.oyster.der.DERObjectIdentifier
61
case 1008:
62         errMsg = "SMIME Error 1008: No dots in \"DOT_SEPARATED_ARRAY\" " +
63                  "construction!";
64         break;
65       case 1009:
66         errMsg = "SMIME Error 1009: Allowable types of construction are: " +
67                  "\"DOT_SEPARATED_ARRAY\" and \"NAME_STRING\"!";
68         break;
69       case 1010:
70         errMsg = "Unknown type of Object identifier!";
71         break;
72 // org.enhydra.oyster.crypto.SymmetricEncryption
73
case 1011:
74         errMsg = "SMIME Error 1011: Number of bytes in imported symmetric Key" +
75                  " is incorect!";
76         break;
77 // org.enhydra.oyster.crypto.SymmetricEncryption,
78
// org.enhydra.oyster.crypto.DESede3CBCParameter,
79
// org.enhydra.oyster.crypto.RC2CBCParameter
80
case 1012:
81         errMsg = "SMIME Error 1012: Number of bytes in imported IV must be 8!";
82         break;
83 // org.enhydra.oyster.crypto.Algorithm,
84
// org.enhydra.oyster.cms.CMSEnvelopedDataSource
85
case 1013:
86         errMsg = "SMIME Error 1013: Allowed algorithm names are: DES_EDE3_CBC,"+
87                  " RC2_CBC or DES!";
88         break;
89 // org.enhydra.oyster.crypto.Algorithm
90
// org.enhydra.oyster.crypto.RC2CBCParameter
91
case 1014:
92         errMsg = "SMIME Error 1014: Key size in bits for RC2 algorithm must " +
93                  "be 40, 64 or 128!";
94         break;
95 // org.enhydra.oyster.crypto.Algorithm
96
case 1015:
97         errMsg = "SMIME Error 1015: Key size in bits for DESede3 algorithm " +
98                  "must be 128 or 192!";
99         break;
100       case 1016:
101         errMsg = "SMIME Error 1016: Key size in bits for DES algorithm must " +
102                  "be 56!";
103         break;
104 // org.enhydra.oyster.cms.Attribute
105
case 1017:
106         errMsg = "SMIME Error 1017: No value for specified attribute!";
107         break;
108 // org.enhydra.oyster.cms.ContentInfo
109
// org.enhydra.oyster.cms.EncapsulatedContentInfo
110
// org.enhydra.oyster.cms.EncryptedContentInfo
111
// org.enhydra.oyster.cms.EnvelopedData
112
// org.enhydra.oyster.cms.SignedData
113
case 1018:
114         errMsg = "SMIME Error 1018: Order of adding components is unproper!";
115         break;
116 // org.enhydra.oyster.cms.CMSVersion
117
case 1019:
118         errMsg = "SMIME Error 1019: CMS Version must be 0,1,2,3 or 4!";
119         break;
120 // org.enhydra.oyster.cms.CapabilitiesAttribute
121
case 1020:
122         errMsg = "SMIME Error 1020: Unknown type of Capabilities Attributes!";
123         break;
124 // org.enhydra.oyster.cms.IssuerName
125
case 1021:
126         errMsg = "SMIME Error 1021: Function addAllRelativeDN was already " +
127                  "performed!";
128         break;
129 // org.enhydra.oyster.cms.KeyTransRecipientInfo
130
case 1022:
131         errMsg = "SMIME Error 1022: Recipient is alredy added!";
132         break;
133 // org.enhydra.oyster.cms.RelativeDistinguishedName
134
case 1023:
135         errMsg = "SMIME Error 1023: This function can not be performed twice " +
136                  "for one object!";
137         break;
138       case 1024:
139         errMsg = "SMIME Error 1024: This function can be performed only with" +
140                  " the simplest constructor!";
141         break;
142 // org.enhydra.oyster.cms.SignedAttributes
143
case 1025:
144         errMsg = "SMIME Error 1025: No attribute was added!";
145         break;
146 // org.enhydra.oyster.cms.SignerInfos
147
case 1026:
148         errMsg = "SMIME Error 1026: Missing owner's certificate!";
149         break;
150       case 1027:
151         errMsg = "SMIME Error 1027: Missing owner's private key!";
152         break;
153 // org.enhydra.oyster.cms.CMSSignedDataSource
154
case 1028:
155         errMsg = "SMIME Error 1028: Serial numbers of capabilities parameter " +
156                  "must be between 0 and 5!";
157         break;
158       case 1029:
159         errMsg = "SMIME Error 1029: Neither the same group of capabilities can " +
160                  "be add twice, nor any group can be added after DEFAULT type!";
161         break;
162       case 1030:
163         errMsg = "SMIME Error 1030: Type of set capabilities attributes must " +
164                  "be: SIGNATURE, SYMMETRIC or ENCIPHER!";
165         break;
166       case 1031:
167         errMsg = "SMIME Error 1031: Allowed signing algorithms are: " +
168                  "SHA1_WITH_RSA, MD2_WITH_RSA, MD5_WITH_RSA or SHA1_WITH_DSA!";
169         break;
170 // org.enhydra.oyster.util.Base64ForMime
171
case 1032:
172         errMsg = "SMIME Error 1032: Line breaks must be grather than 0 and " +
173                  "less than or equal to 76!";
174         break;
175 // org.enhydra.oyster.util.ByteArrayComparator
176
case 1033:
177         errMsg = "SMIME Error 1033: Searching array is bigger than / or equal to" +
178                  " lookup array!";
179 //org.enhydra.oyster.smime.EnvelopedSMIME
180
//org.enhydra.oyster.smime.BaseSignedSMIMEObject
181
case 1034:
182         errMsg = "SMIME Error 1034: File does not exist!";
183         break;
184 //org.enhydra.oyster.smime.EnvelopedSMIME
185
case 1035:
186         errMsg = "SMIME Error 1035: Parameter content shouldn't be null in " +
187                  "setContent method!";
188         break;
189 //org.enhydra.oyster.smime.BaseSMIMEObject
190
case 1036:
191         errMsg = "SMIME Error 1036: Unknown type Content-Transfer-Encoding!"+
192                  " Allowable types are: 7bit, quoted-printable and base64!";
193         break;
194 // org.enhydra.oyster.util.PFXUtils
195
case 1037:
196         errMsg = "SMIME Error 1037: Problem with aliases in pfx or p12 file!";
197         break;
198       case 1038:
199         errMsg = "SMIME Error 1038: Problem with extracting certificate chain" +
200                  " from .pfx or .p12 file!";
201         break;
202 // org.enhydra.oyster.mail.EnvelopedAndSignedBodyPart
203
case 1039:
204         errMsg = "SMIME Error 1039: At least one recipient must be added " +
205                  "before performing signing() method!";
206         break;
207 // org.enhydra.oyster.mail.SignedAndEnvelopedBodyPart
208
case 1040:
209         errMsg = "SMIME Error 1040: At least one signer must be added before " +
210                  "performing enveloping() method!";
211         break;
212 //org.enhydra.oyster.smime.BaseSMIMEObject
213
case 1041:
214         errMsg = "SMIME Error 1041: FROM address or name of SMTP host is null!";
215         break;
216       case 1042:
217         errMsg = "SMIME Error 1042: Type must be TO, CC, or BCC!";
218         break;
219       case 1043:
220         errMsg = "SMIME Error 1043: One of recipients must be declared as TO " +
221                  "recipient!";
222         break;
223       case 1044:
224         errMsg = "SMIME Error 1044: There is no message for enveloping/signing!";
225         break;
226 //org.enhydra.oyster.smime.BaseSignedSMIMEObject
227
case 1045:
228         errMsg = "SMIME Error 1045: Method setCapabilities can be performed " +
229                  "only three times for one signer!";
230         break;
231 //org.enhydra.oyster.smime.SignedAndEnvelopedSMIME
232
case 1046:
233         errMsg = "SMIME Error 1046: Parameters for message protection order" +
234                  " must be SIGN_FIRST or ENCRYPT_FIRST";
235         break;
236 //-- unused -----------------------------------
237
// case 1047:
238
// errMsg = "SMIME Error 1047: Explicit (external) signing type is not " +
239
// "implemented yet. Use implicit (internal) signing!";
240
// break;
241
//org.enhydra.oyster.smime.BaseSMIMEObject
242
case 1048:
243         errMsg = "SMIME Error 1048: Content type must be \"text/plain\" or " +
244                   "\"text/html\"!";
245         break;
246       case 1049:
247         errMsg = "SMIME Error 1049: Content of message couldn't be added twice!";
248         break;
249
250       case 1999:
251         errMsg = "SMIME Error 1999: Caused by non SMIMEException!";
252         break;
253       default:
254         errMsg = "SMIME Error 9999: Unknown Error type: " + errNumber0 + "!";
255     }
256     return errMsg;
257   }
258 }
Popular Tags