Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / class / Novell.Directory.Ldap / Novell.Directory.Ldap / LdapException.cs
1 /******************************************************************************
2 * The MIT License
3 * Copyright (c) 2003 Novell Inc.  www.novell.com
4
5 * Permission is hereby granted, free of charge, to any person obtaining  a copy
6 * of this software and associated documentation files (the Software), to deal
7 * in the Software without restriction, including  without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
9 * copies of the Software, and to  permit persons to whom the Software is 
10 * furnished to do so, subject to the following conditions:
11
12 * The above copyright notice and this permission notice shall be included in 
13 * all copies or substantial portions of the Software.
14
15 * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *******************************************************************************/
23 //
24 // Novell.Directory.Ldap.LdapException.cs
25 //
26 // Author:
27 //   Sunil Kumar (Sunilk@novell.com)
28 //
29 // (C) 2003 Novell, Inc (http://www.novell.com)
30 //
31
32 using System;
33 using Novell.Directory.Ldap.Utilclass;
34
35 namespace Novell.Directory.Ldap
36 {
37         
38         /// <summary>  Thrown to indicate that an Ldap exception has occurred. This is a general
39         /// exception which includes a message and an Ldap result code.
40         /// 
41         /// An LdapException can result from physical problems (such as
42         /// network errors) as well as problems with Ldap operations detected
43         /// by the server. For example, if an Ldap add operation fails because of a
44         /// duplicate entry, the server returns a result code.
45         /// 
46         /// Five possible sources of information are available from LdapException:
47         /// <dl>
48         /// <dt>Result Code:</dt>
49         /// <dd>The <code>getResultCode</code> method returns a result code,
50         /// which can be compared against standard Ldap result codes. </dd>
51         /// <dt>Message:</dt>
52         /// <dd>The <code>getMessage</code> method returns a localized message
53         /// from the message resource that corresponds to the result code.
54         /// </dd>
55         /// <dt>Ldap server Message:</dt>
56         /// <dd>The <code>getLdapErrorMessage</code> method returns any error
57         /// message received from the Ldap server.</dd>
58         /// <dt>Matched DN:</dt>
59         /// <dd>The <code>getMatchedDN</code> method retrieves the part of a
60         /// submitted distinguished name which could be matched by the server</dd>
61         /// <dt>Root Cause:</dt>
62         /// <dd>The <code>getCause</code> method returns the a nested exception
63         /// that was the original cause for the error. </dd>
64         /// </dl>
65         /// 
66         /// The <code>toString</code> method returns a string containing all
67         /// the above sources of information, if they have a value.
68         /// 
69         /// Exceptions generated by the API, i.e. that are not a result
70         /// of a server response, can be identified as <tt>instanceof
71         /// {@link LdapLocalException}</tt>
72         /// 
73         /// The following table lists the standard Ldap result codes.
74         /// See RFC2251 for a discussion of the meanings of the result codes.
75         /// The corresponding ASN.1 definition from RFC2251 is provided in parentheses.
76         /// <table>
77         /// <tr>
78         /// <td><b>Value</b></td>
79         /// <td><b>Result Code</b></td>
80         /// </tr>
81         /// <tr><td> 0</td><td>{@link #SUCCESS} (success) </td></tr>
82         /// <tr><td> 1</td><td>{@link #OPERATIONS_ERROR} (operationsError) </td></tr>
83         /// <tr><td> 2</td><td>{@link #PROTOCOL_ERROR} (protocolError) </td></tr>
84         /// <tr><td> 3</td><td>{@link #TIME_LIMIT_EXCEEDED} (timeLimitExceeded) </td></tr>
85         /// <tr><td> 4</td><td>{@link #SIZE_LIMIT_EXCEEDED} (sizeLimitExceeded) </td></tr>
86         /// <tr><td> 5</td><td>{@link #COMPARE_FALSE} (compareFalse) </td></tr>
87         /// <tr><td> 6</td><td>{@link #COMPARE_TRUE} (compareTrue) </td></tr>
88         /// <tr><td> 7</td><td>{@link #AUTH_METHOD_NOT_SUPPORTED} (authMethodNotSupported) </td></tr>
89         /// <tr><td> 8</td><td>{@link #STRONG_AUTH_REQUIRED} (strongAuthRequired) </td></tr>
90         /// <tr><td> 10</td><td>{@link #REFERRAL} (referral) </td></tr>
91         /// <tr><td> 11</td><td>{@link #ADMIN_LIMIT_EXCEEDED} (adminLimitExceeded) </td></tr>
92         /// <tr><td> 12</td><td>{@link #UNAVAILABLE_CRITICAL_EXTENSION} (unavailableCriticalExtension) </td></tr>
93         /// <tr><td> 13</td><td>{@link #CONFIDENTIALITY_REQUIRED} (confidentialityRequired) </td></tr>
94         /// <tr><td> 14</td><td>{@link #SASL_BIND_IN_PROGRESS} (saslBindInProgress) </td></tr>
95         /// <tr><td> 16</td><td>{@link #NO_SUCH_ATTRIBUTE} (noSuchAttribute) </td></tr>
96         /// <tr><td> 17</td><td>{@link #UNDEFINED_ATTRIBUTE_TYPE} (undefinedAttributeType) </td></tr>
97         /// <tr><td> 18</td><td>{@link #INAPPROPRIATE_MATCHING} (inappropriateMatching) </td></tr>
98         /// <tr><td> 19</td><td>{@link #CONSTRAINT_VIOLATION} (constraintViolation) </td></tr>
99         /// <tr><td> 20</td><td>{@link #ATTRIBUTE_OR_VALUE_EXISTS} (AttributeOrValueExists) </td></tr>
100         /// <tr><td> 21</td><td>{@link #INVALID_ATTRIBUTE_SYNTAX} (invalidAttributeSyntax) </td></tr>
101         /// <tr><td> 32</td><td>{@link #NO_SUCH_OBJECT} (noSuchObject) </td></tr>
102         /// <tr><td> 33</td><td>{@link #ALIAS_PROBLEM} (aliasProblem) </td></tr>
103         /// <tr><td> 34</td><td>{@link #INVALID_DN_SYNTAX} (invalidDNSyntax) </td></tr>
104         /// <tr><td> 35</td><td>{@link #IS_LEAF} (isLeaf) </td></tr>
105         /// <tr><td> 36</td><td>{@link #ALIAS_DEREFERENCING_PROBLEM} (aliasDereferencingProblem) </td></tr>
106         /// <tr><td> 48</td><td>{@link #INAPPROPRIATE_AUTHENTICATION} (inappropriateAuthentication) </td></tr>
107         /// <tr><td> 49</td><td>{@link #INVALID_CREDENTIALS} (invalidCredentials) </td></tr>
108         /// <tr><td> 50</td><td>{@link #INSUFFICIENT_ACCESS_RIGHTS} (insufficientAccessRights) </td></tr>
109         /// <tr><td> 51</td><td>{@link #BUSY} (busy) </td></tr>
110         /// <tr><td> 52</td><td>{@link #UNAVAILABLE} (unavailable) </td></tr>
111         /// <tr><td> 53</td><td>{@link #UNWILLING_TO_PERFORM} (unwillingToPerform) </td></tr>
112         /// <tr><td> 54</td><td>{@link #LOOP_DETECT} (loopDetect) </td></tr>
113         /// <tr><td> 64</td><td>{@link #NAMING_VIOLATION} (namingViolation) </td></tr>
114         /// <tr><td> 65</td><td>{@link #OBJECT_CLASS_VIOLATION} (objectClassViolation) </td></tr>
115         /// <tr><td> 66</td><td>{@link #NOT_ALLOWED_ON_NONLEAF} (notAllowedOnNonLeaf) </td></tr>
116         /// <tr><td> 67</td><td>{@link #NOT_ALLOWED_ON_RDN} (notAllowedOnRDN) </td></tr>
117         /// <tr><td> 68</td><td>{@link #ENTRY_ALREADY_EXISTS} (entryAlreadyExists) </td></tr>
118         /// <tr><td> 69</td><td>{@link #OBJECT_CLASS_MODS_PROHIBITED} (objectClassModsProhibited) </td></tr>
119         /// <tr><td> 71</td><td>{@link #AFFECTS_MULTIPLE_DSAS} (affectsMultipleDSAs </td></tr>
120         /// <tr><td> 80</td><td>{@link #OTHER} (other) </td></tr>
121         /// </table>
122         /// 
123         /// Local errors, resulting from actions other than an operation on a
124         /// server.
125         /// 
126         /// <table>
127         /// <tr>
128         /// <td><b>Value</b></td>
129         /// <td><b>Result Code</b></td>
130         /// </tr>
131         /// <tr><td>81</td><td>{@link #SERVER_DOWN}</td></tr>
132         /// <tr><td>82</td><td>{@link #LOCAL_ERROR}</td></tr>
133         /// <tr><td>83</td><td>{@link #ENCODING_ERROR}</td></tr>
134         /// <tr><td>84</td><td>{@link #DECODING_ERROR}</td></tr>
135         /// <tr><td>85</td><td>{@link #Ldap_TIMEOUT}</td></tr>
136         /// <tr><td>86</td><td>{@link #AUTH_UNKNOWN}</td></tr>
137         /// <tr><td>87</td><td>{@link #FILTER_ERROR}</td></tr>
138         /// <tr><td>88</td><td>{@link #USER_CANCELLED}</td></tr>
139         /// <tr><td>90</td><td>{@link #NO_MEMORY}</td></tr>
140         /// <tr><td>91</td><td>{@link #CONNECT_ERROR}</td></tr>
141         /// <tr><td>92</td><td>{@link #Ldap_NOT_SUPPORTED}</td></tr>
142         /// <tr><td>93</td><td>{@link #CONTROL_NOT_FOUND}</td></tr>
143         /// <tr><td>94</td><td>{@link #NO_RESULTS_RETURNED}</td></tr>
144         /// <tr><td>95</td><td>{@link #MORE_RESULTS_TO_RETURN}</td></tr>
145         /// <tr><td>96</td><td>{@link #CLIENT_LOOP}</td></tr>
146         /// <tr><td>97</td><td>{@link #REFERRAL_LIMIT_EXCEEDED}</td></tr>
147         /// <tr><td>100</td><td>{@link #INVALID_RESPONSE}</td></tr>
148         /// <tr><td>101</td><td>{@link #AMBIGUOUS_RESPONSE}</td></tr>
149         /// <tr><td>112</td><td>{@link #TLS_NOT_SUPPORTED}</td></tr>
150         /// </table>
151         /// </summary>
152         
153         public class LdapException:System.Exception
154         {
155                 /// <summary> Returns the error message from the Ldap server, if this message is
156                 /// available (that is, if this message was set). If the message was not set,
157                 /// this method returns null.
158                 /// 
159                 /// </summary>
160                 /// <returns> The error message or null if the message was not set.
161                 /// 
162                 /// </returns>
163                 virtual public System.String LdapErrorMessage
164                 {
165                         get
166                         {
167                                 if (((System.Object) serverMessage != null) && (serverMessage.Length == 0))
168                                 {
169                                         return null;
170                                 }
171                                 return serverMessage;
172                         }
173                         
174                 }
175                 /// <summary> Returns the lower level Exception which caused the failure, if any.
176                 /// For example, an IOException with additional information may be returned
177                 /// on a CONNECT_ERROR failure.
178                 /// </summary>
179                 virtual public System.Exception Cause
180                 {
181                         get
182                         {
183                                 return rootException;
184                         }
185                         
186                 }
187                 /// <summary> Returns the result code from the exception.
188                 /// 
189                 /// The codes are defined as <code>public final static int</code> members
190                 /// of the Ldap Exception class. If the exception is a
191                 /// result of error information returned from a directory operation, the
192                 /// code will be one of those defined for the class. Otherwise, a local error
193                 /// code is returned. 
194                 /// </summary>
195                 virtual public int ResultCode
196                 {
197                         get
198                         {
199                                 return resultCode;
200                         }
201                         
202                 }
203                 /// <summary> Returns the part of a submitted distinguished name which could be
204                 /// matched by the server.
205                 /// 
206                 /// If the exception was caused by a local error, such as no server
207                 /// available, the return value is null. If the exception resulted from
208                 /// an operation being executed on a server, the value is an empty string
209                 /// except when the result of the operation was one of the following:
210                 /// <ul>
211                 /// <li>NO_SUCH_OBJECT</li>
212                 /// <li>ALIAS_PROBLEM</li>
213                 /// <li>INVALID_DN_SYNTAX</li>
214                 /// <li>ALIAS_DEREFERENCING_PROBLEM</li>
215                 /// </ul>
216                 /// 
217                 /// </summary>
218                 /// <returns> The part of a submitted distinguished name which could be
219                 /// matched by the server or null if the error is a local error.
220                 /// </returns>
221                 virtual public System.String MatchedDN
222                 {
223                         get
224                         {
225                                 return matchedDN;
226                         }
227                         
228                 }
229                 public override System.String Message
230                 {
231                         get
232                         {
233                                 return resultCodeToString();
234                         }
235                         
236                 }
237         /*      public override System.String Message
238                 {
239                         get
240                         {
241                                 return resultCodeToString();
242                         }
243                         
244                 }
245     */          
246                 // The Result Code
247                 private int resultCode = 0;
248                 // The localized message
249                 private System.String messageOrKey = null;
250                 // The arguments associated with the localized message
251                 private System.Object[] arguments = null;
252                 // The Matched DN
253                 private System.String matchedDN = null;
254                 // The Root Cause
255                 private System.Exception rootException = null;
256                 // A message from the server
257                 private System.String serverMessage = null;
258                 
259                 /// <summary>Indicates the requested client operation completed successfully.
260                 /// 
261                 /// SUCCESS = 0<p/>
262                 /// </summary>
263                 public const int SUCCESS = 0;
264                 
265                 /// <summary> Indicates an internal error.
266                 /// 
267                 /// The server is unable to respond with a more specific error and is
268                 /// also unable to properly respond to a request. It does not indicate
269                 /// that the client has sent an erroneous message.
270                 /// 
271                 /// OPERATIONS_ERROR = 1
272                 /// </summary>
273                 public const int OPERATIONS_ERROR = 1;
274                 
275                 /// <summary> Indicates that the server has received an invalid or malformed request
276                 /// from the client.
277                 /// 
278                 /// PROTOCOL_ERROR = 2
279                 /// </summary>
280                 public const int PROTOCOL_ERROR = 2;
281                 
282                 /// <summary> Indicates that the operation's time limit specified by either the
283                 /// client or the server has been exceeded.
284                 /// 
285                 /// On search operations, incomplete results are returned.
286                 /// 
287                 /// TIME_LIMIT_EXCEEDED = 3
288                 /// </summary>
289                 public const int TIME_LIMIT_EXCEEDED = 3;
290                 
291                 /// <summary> Indicates that in a search operation, the size limit specified by
292                 /// the client or the server has been exceeded. Incomplete results are
293                 /// returned.
294                 /// 
295                 /// SIZE_LIMIT_EXCEEDED = 4
296                 /// </summary>
297                 public const int SIZE_LIMIT_EXCEEDED = 4;
298                 
299                 /// <summary> Does not indicate an error condition. Indicates that the results of
300                 /// a compare operation are false.
301                 /// 
302                 /// COMPARE_FALSE = 5
303                 /// </summary>
304                 public const int COMPARE_FALSE = 5;
305                 
306                 /// <summary> Does not indicate an error condition. Indicates that the results of a
307                 /// compare operation are true.
308                 /// 
309                 /// COMPARE_TRUE = 6
310                 /// </summary>
311                 public const int COMPARE_TRUE = 6;
312                 
313                 /// <summary> Indicates that during a bind operation the client requested an
314                 /// authentication method not supported by the Ldap server.
315                 /// 
316                 /// AUTH_METHOD_NOT_SUPPORTED = 7
317                 /// </summary>
318                 public const int AUTH_METHOD_NOT_SUPPORTED = 7;
319                 
320                 /// <summary>Indicates a problem with the level of authentication.
321                 /// 
322                 /// One of the following has occurred:
323                 /// <ul>
324                 /// <li>In bind requests, the Ldap server accepts only strong
325                 /// authentication.</li>
326                 /// <li>In a client request, the client requested an operation such as delete
327                 /// that requires strong authentication.</li>
328                 /// <li>In an unsolicited notice of disconnection, the Ldap server discovers
329                 /// the security protecting the communication between the client and
330                 /// server has unexpectedly failed or been compromised.</li>
331                 /// </ul>
332                 /// STRONG_AUTH_REQUIRED = 8
333                 /// </summary>
334                 public const int STRONG_AUTH_REQUIRED = 8;
335                 
336                 /// <summary> Returned by some Ldap servers to Ldapv2 clients to indicate that a referral
337                 /// has been returned in the error string.
338                 /// 
339                 /// Ldap_PARTIAL_RESULTS = 9
340                 /// </summary>
341                 public const int Ldap_PARTIAL_RESULTS = 9;
342                 
343                 /// <summary> Does not indicate an error condition. In Ldapv3, indicates that the server
344                 /// does not hold the target entry of the request, but that the servers in the
345                 /// referral field may.
346                 /// 
347                 /// REFERRAL = 10
348                 /// </summary>
349                 public const int REFERRAL = 10;
350                 
351                 /// <summary> Indicates that an Ldap server limit set by an administrative authority
352                 /// has been exceeded.
353                 /// 
354                 /// ADMIN_LIMIT_EXCEEDED = 11
355                 /// </summary>
356                 public const int ADMIN_LIMIT_EXCEEDED = 11;
357                 
358                 /// <summary> Indicates that the Ldap server was unable to satisfy a request because
359                 /// one or more critical extensions were not available.
360                 /// 
361                 /// Either the server does not support the control or the control is not
362                 /// appropriate for the operation type.
363                 /// 
364                 /// UNAVAILABLE_CRITICAL_EXTENSION = 12
365                 /// </summary>
366                 public const int UNAVAILABLE_CRITICAL_EXTENSION = 12;
367                 
368                 /// <summary> Indicates that the session is not protected by a protocol such as
369                 /// Transport Layer Security (TLS), which provides session confidentiality.
370                 /// 
371                 /// CONFIDENTIALITY_REQUIRED = 13
372                 /// </summary>
373                 public const int CONFIDENTIALITY_REQUIRED = 13;
374                 
375                 /// <summary> Does not indicate an error condition, but indicates that the server is
376                 /// ready for the next step in the process. The client must send the server
377                 /// the same SASL mechanism to continue the process.
378                 /// 
379                 /// SASL_BIND_IN_PROGRESS = 14
380                 /// </summary>
381                 public const int SASL_BIND_IN_PROGRESS = 14;
382                 
383                 /// <summary> Indicates that the attribute specified in the modify or compare
384                 /// operation does not exist in the entry.
385                 /// 
386                 /// NO_SUCH_ATTRIBUTE = 16
387                 /// </summary>
388                 public const int NO_SUCH_ATTRIBUTE = 16;
389                 
390                 /// <summary> Indicates that the attribute specified in the modify or add operation
391                 /// does not exist in the Ldap server's schema.
392                 /// 
393                 /// UNDEFINED_ATTRIBUTE_TYPE = 17
394                 /// </summary>
395                 public const int UNDEFINED_ATTRIBUTE_TYPE = 17;
396                 
397                 /// <summary> Indicates that the matching rule specified in the search filter does
398                 /// not match a rule defined for the attribute's syntax.
399                 /// 
400                 /// INAPPROPRIATE_MATCHING = 18
401                 /// </summary>
402                 public const int INAPPROPRIATE_MATCHING = 18;
403                 
404                 /// <summary> Indicates that the attribute value specified in a modify, add, or
405                 /// modify DN operation violates constraints placed on the attribute. The
406                 /// constraint can be one of size or content (for example, string only,
407                 /// no binary data).
408                 /// 
409                 /// CONSTRAINT_VIOLATION = 19
410                 /// </summary>
411                 public const int CONSTRAINT_VIOLATION = 19;
412                 
413                 /// <summary> Indicates that the attribute value specified in a modify or add
414                 /// operation already exists as a value for that attribute.
415                 /// 
416                 /// ATTRIBUTE_OR_VALUE_EXISTS = 20
417                 /// </summary>
418                 public const int ATTRIBUTE_OR_VALUE_EXISTS = 20;
419                 
420                 /// <summary> Indicates that the attribute value specified in an add, compare, or
421                 /// modify operation is an unrecognized or invalid syntax for the attribute.
422                 /// 
423                 /// INVALID_ATTRIBUTE_SYNTAX = 21
424                 /// </summary>
425                 public const int INVALID_ATTRIBUTE_SYNTAX = 21;
426                 
427                 /// <summary> Indicates the target object cannot be found.
428                 /// 
429                 /// This code is not returned on the following operations:
430                 /// <ul>
431                 /// <li>Search operations that find the search base but cannot find any
432                 /// entries that match the search filter.</li>
433                 /// <li>Bind operations.</li>
434                 /// </ul>
435                 /// NO_SUCH_OBJECT = 32
436                 /// </summary>
437                 public const int NO_SUCH_OBJECT = 32;
438                 
439                 /// <summary> Indicates that an error occurred when an alias was dereferenced.
440                 /// 
441                 /// ALIAS_PROBLEM = 33
442                 /// </summary>
443                 public const int ALIAS_PROBLEM = 33;
444                 
445                 /// <summary> Indicates that the syntax of the DN is incorrect.
446                 /// 
447                 /// If the DN syntax is correct, but the Ldap server's structure
448                 /// rules do not permit the operation, the server returns
449                 /// Ldap_UNWILLING_TO_PERFORM. 
450                 /// 
451                 /// INVALID_DN_SYNTAX = 34
452                 /// </summary>
453                 public const int INVALID_DN_SYNTAX = 34;
454                 
455                 /// <summary> Indicates that the specified operation cannot be performed on a
456                 /// leaf entry.
457                 /// 
458                 /// This code is not currently in the Ldap specifications, but is
459                 /// reserved for this constant.
460                 /// 
461                 /// IS_LEAF = 35
462                 /// </summary>
463                 public const int IS_LEAF = 35;
464                 
465                 /// <summary> Indicates that during a search operation, either the client does not
466                 /// have access rights to read the aliased object's name or dereferencing
467                 /// is not allowed.
468                 /// 
469                 /// ALIAS_DEREFERENCING_PROBLEM = 36
470                 /// </summary>
471                 public const int ALIAS_DEREFERENCING_PROBLEM = 36;
472                 
473                 /// <summary> Indicates that during a bind operation, the client is attempting to use
474                 /// an authentication method that the client cannot use correctly.
475                 /// 
476                 ///  For example, either of the following cause this error:
477                 /// <ul>
478                 /// <li>The client returns simple credentials when strong credentials are
479                 /// required.</li>
480                 /// <li>The client returns a DN and a password for a simple bind when the
481                 /// entry does not have a password defined.</li>
482                 /// </ul>
483                 /// INAPPROPRIATE_AUTHENTICATION = 48
484                 /// </summary>
485                 public const int INAPPROPRIATE_AUTHENTICATION = 48;
486                 
487                 /// <summary> Indicates that invalid information was passed during a bind operation.
488                 /// 
489                 /// One of the following occurred:
490                 /// <ul>
491                 /// <li> The client passed either an incorrect DN or password.</li>
492                 /// <li> The password is incorrect because it has expired, intruder detection
493                 /// has locked the account, or some other similar reason.</li>
494                 /// </ul>
495                 /// INVALID_CREDENTIALS = 49
496                 /// </summary>
497                 public const int INVALID_CREDENTIALS = 49;
498                 
499                 /// <summary> Indicates that the caller does not have sufficient rights to perform
500                 /// the requested operation.
501                 /// 
502                 /// INSUFFICIENT_ACCESS_RIGHTS = 50
503                 /// </summary>
504                 public const int INSUFFICIENT_ACCESS_RIGHTS = 50;
505                 
506                 /// <summary> Indicates that the Ldap server is too busy to process the client request
507                 /// at this time, but if the client waits and resubmits the request, the
508                 /// server may be able to process it then.
509                 /// 
510                 /// BUSY = 51
511                 /// </summary>
512                 public const int BUSY = 51;
513                 
514                 /// <summary> Indicates that the Ldap server cannot process the client's bind
515                 /// request, usually because it is shutting down.
516                 /// 
517                 /// UNAVAILABLE = 52
518                 /// </summary>
519                 public const int UNAVAILABLE = 52;
520                 
521                 /// <summary> Indicates that the Ldap server cannot process the request because of
522                 /// server-defined restrictions.
523                 /// 
524                 /// This error is returned for the following reasons:
525                 /// <ul>
526                 /// <li>The add entry request violates the server's structure rules.</li>
527                 /// <li>The modify attribute request specifies attributes that users
528                 /// cannot modify.</li>
529                 /// </ul>
530                 /// UNWILLING_TO_PERFORM = 53
531                 /// </summary>
532                 public const int UNWILLING_TO_PERFORM = 53;
533                 
534                 /// <summary> Indicates that the client discovered an alias or referral loop,
535                 /// and is thus unable to complete this request.
536                 /// 
537                 /// LOOP_DETECT = 54
538                 /// </summary>
539                 public const int LOOP_DETECT = 54;
540                 
541                 /// <summary> Indicates that the add or modify DN operation violates the schema's
542                 /// structure rules.
543                 /// 
544                 /// For example,
545                 /// <ul>
546                 /// <li>The request places the entry subordinate to an alias.</li>
547                 /// <li>The request places the entry subordinate to a container that
548                 /// is forbidden by the containment rules.</li>
549                 /// <li>The RDN for the entry uses a forbidden attribute type.</li>
550                 ///</ul> 
551                 /// NAMING_VIOLATION = 64
552                 /// </summary>
553                 public const int NAMING_VIOLATION = 64;
554                 
555                 /// <summary> Indicates that the add, modify, or modify DN operation violates the
556                 /// object class rules for the entry.
557                 /// 
558                 /// For example, the following types of request return this error:
559                 /// <ul>
560                 /// <li>The add or modify operation tries to add an entry without a value
561                 /// for a required attribute.</li>
562                 /// <li>The add or modify operation tries to add an entry with a value for
563                 /// an attribute which the class definition does not contain.</li>
564                 /// <li>The modify operation tries to remove a required attribute without
565                 /// removing the auxiliary class that defines the attribute as required.</li>
566                 /// </ul>
567                 /// OBJECT_CLASS_VIOLATION = 65
568                 /// </summary>
569                 public const int OBJECT_CLASS_VIOLATION = 65;
570                 
571                 /// <summary> Indicates that the requested operation is permitted only on leaf entries.
572                 /// 
573                 /// For example, the following types of requests return this error:
574                 /// <ul>
575                 /// <li>The client requests a delete operation on a parent entry.</li>
576                 /// <li> The client request a modify DN operation on a parent entry.</li>
577                 /// </ul>
578                 /// NOT_ALLOWED_ON_NONLEAF = 66
579                 /// </summary>
580                 public const int NOT_ALLOWED_ON_NONLEAF = 66;
581                 
582                 /// <summary> Indicates that the modify operation attempted to remove an attribute
583                 /// value that forms the entry's relative distinguished name.
584                 /// 
585                 /// NOT_ALLOWED_ON_RDN = 67
586                 /// </summary>
587                 public const int NOT_ALLOWED_ON_RDN = 67;
588                 
589                 /// <summary> Indicates that the add operation attempted to add an entry that already
590                 /// exists, or that the modify operation attempted to rename an entry to the
591                 /// name of an entry that already exists.
592                 /// 
593                 /// ENTRY_ALREADY_EXISTS = 68
594                 /// </summary>
595                 public const int ENTRY_ALREADY_EXISTS = 68;
596                 
597                 /// <summary> Indicates that the modify operation attempted to modify the structure
598                 /// rules of an object class.
599                 /// 
600                 /// OBJECT_CLASS_MODS_PROHIBITED = 69
601                 /// </summary>
602                 public const int OBJECT_CLASS_MODS_PROHIBITED = 69;
603                 
604                 /// <summary> Indicates that the modify DN operation moves the entry from one Ldap
605                 /// server to another and thus requires more than one Ldap server.
606                 /// 
607                 /// AFFECTS_MULTIPLE_DSAS = 71
608                 /// </summary>
609                 public const int AFFECTS_MULTIPLE_DSAS = 71;
610                 
611                 /// <summary> Indicates an unknown error condition.
612                 /// 
613                 /// OTHER = 80
614                 /// </summary>
615                 public const int OTHER = 80;
616                 
617                 /////////////////////////////////////////////////////////////////////////////
618                 // Local Errors, resulting from actions other than an operation on a server
619                 /////////////////////////////////////////////////////////////////////////////
620                 
621                 /// <summary> Indicates that the Ldap libraries cannot establish an initial connection
622                 /// with the Ldap server. Either the Ldap server is down or the specified
623                 /// host name or port number is incorrect.
624                 /// 
625                 /// SERVER_DOWN = 81
626                 /// </summary>
627                 public const int SERVER_DOWN = 81;
628                 
629                 /// <summary> Indicates that the Ldap client has an error. This is usually a failed
630                 /// dynamic memory allocation error.
631                 /// 
632                 /// LOCAL_ERROR = 82
633                 /// </summary>
634                 public const int LOCAL_ERROR = 82;
635                 
636                 /// <summary> Indicates that the Ldap client encountered errors when encoding an
637                 /// Ldap request intended for the Ldap server.
638                 /// 
639                 /// ENCODING_ERROR = 83
640                 /// </summary>
641                 public const int ENCODING_ERROR = 83;
642                 
643                 /// <summary> Indicates that the Ldap client encountered errors when decoding an
644                 /// Ldap response from the Ldap server.
645                 /// 
646                 /// DECODING_ERROR = 84
647                 /// </summary>
648                 public const int DECODING_ERROR = 84;
649                 
650                 /// <summary> Indicates that the time limit of the Ldap client was exceeded while
651                 /// waiting for a result.
652                 /// 
653                 /// Ldap_TIMEOUT = 85
654                 /// </summary>
655                 public const int Ldap_TIMEOUT = 85;
656                 
657                 /// <summary> Indicates that a bind method was called with an unknown
658                 /// authentication method.
659                 /// 
660                 /// AUTH_UNKNOWN = 86
661                 /// </summary>
662                 public const int AUTH_UNKNOWN = 86;
663                 
664                 /// <summary> Indicates that the search method was called with an invalid
665                 /// search filter.
666                 /// 
667                 /// FILTER_ERROR = 87
668                 /// </summary>
669                 public const int FILTER_ERROR = 87;
670                 
671                 /// <summary> Indicates that the user cancelled the Ldap operation.
672                 /// 
673                 /// USER_CANCELLED = 88
674                 /// </summary>
675                 public const int USER_CANCELLED = 88;
676                 
677                 
678                 /// <summary> Indicates that a dynamic memory allocation method failed when calling
679                 /// an Ldap method.
680                 /// 
681                 /// NO_MEMORY = 90
682                 /// </summary>
683                 public const int NO_MEMORY = 90;
684                 
685                 /// <summary> Indicates that the Ldap client has lost either its connection or
686                 /// cannot establish a connection to the Ldap server.
687                 /// 
688                 /// CONNECT_ERROR = 91
689                 /// </summary>
690                 public const int CONNECT_ERROR = 91;
691                 
692                 /// <summary> Indicates that the requested functionality is not supported by the
693                 /// client. For example, if the Ldap client is established as an Ldapv2
694                 /// client, the libraries set this error code when the client requests
695                 /// Ldapv3 functionality.
696                 /// 
697                 /// Ldap_NOT_SUPPORTED = 92
698                 /// </summary>
699                 public const int Ldap_NOT_SUPPORTED = 92;
700                 
701                 /// <summary> Indicates that the client requested a control that the libraries
702                 /// cannot find in the list of supported controls sent by the Ldap server.
703                 /// 
704                 /// CONTROL_NOT_FOUND = 93
705                 /// </summary>
706                 public const int CONTROL_NOT_FOUND = 93;
707                 
708                 /// <summary> Indicates that the Ldap server sent no results.
709                 /// 
710                 /// NO_RESULTS_RETURNED = 94
711                 /// </summary>
712                 public const int NO_RESULTS_RETURNED = 94;
713                 
714                 /// <summary> Indicates that more results are chained in the result message.
715                 /// 
716                 /// MORE_RESULTS_TO_RETURN = 95
717                 /// </summary>
718                 public const int MORE_RESULTS_TO_RETURN = 95;
719                 
720                 /// <summary> Indicates the Ldap libraries detected a loop. Usually this happens
721                 /// when following referrals.
722                 /// 
723                 /// CLIENT_LOOP = 96
724                 /// </summary>
725                 public const int CLIENT_LOOP = 96;
726                 
727                 /// <summary> Indicates that the referral exceeds the hop limit. The default hop
728                 /// limit is ten.
729                 /// 
730                 /// The hop limit determines how many servers the client can hop through
731                 /// to retrieve data. For example, suppose the following conditions:
732                 /// <ul>
733                 /// <li>Suppose the hop limit is two.</li>
734                 /// <li> If the referral is to server D which can be contacted only through
735                 /// server B (1 hop) which contacts server C (2 hops) which contacts
736                 /// server D (3 hops).</li>
737                 /// </ul>
738                 ///  With these conditions, the hop limit is exceeded and the Ldap
739                 /// libraries set this code.
740                 /// 
741                 /// REFERRAL_LIMIT_EXCEEDED = 97
742                 /// </summary>
743                 public const int REFERRAL_LIMIT_EXCEEDED = 97;
744                 
745                 /// <summary> Indicates that the server response to a request is invalid.
746                 /// 
747                 /// INVALID_RESPONSE = 100
748                 /// </summary>
749                 public const int INVALID_RESPONSE = 100;
750                 
751                 /// <summary> Indicates that the server response to a request is ambiguous.
752                 /// 
753                 /// AMBIGUOUS_RESPONSE = 101
754                 /// </summary>
755                 public const int AMBIGUOUS_RESPONSE = 101;
756                 
757                 /// <summary> Indicates that TLS is not supported on the server.
758                 /// 
759                 /// TLS_NOT_SUPPORTED = 112
760                 /// </summary>
761                 public const int TLS_NOT_SUPPORTED = 112;
762                 
763                 /// <summary> Indicates that SSL Handshake could not succeed.
764                 ///
765                 /// SSL_HANDSHAKE_FAILED = 113
766                 /// </summary>
767                 public const int SSL_HANDSHAKE_FAILED = 113;
768  
769                 /// <summary> Indicates that SSL Provider could not be found.
770                 ///
771                 /// SSL_PROVIDER_NOT_FOUND = 114
772                 /// </summary>
773                 public const int SSL_PROVIDER_NOT_FOUND = 114;
774                 /*
775                 * Note: Error strings have been pulled out into
776                 * ResultCodeMessages.properties
777                 */
778                 
779                 /// <summary> Constructs a default exception with no specific error information.</summary>
780                 public LdapException():base()
781                 {
782                         return ;
783                 }
784                 
785                 /// <summary> Constructs an exception with a detailed message obtained from the
786                 /// specified <code>MessageOrKey</code> String, the result code,
787                 /// and a server meessage.
788                 /// 
789                 /// The String is used either as a message key to obtain a localized
790                 /// messsage from ExceptionMessages, or if there is no key in the
791                 /// resource matching the text, it is used as the detailed message itself.
792                 /// 
793                 /// </summary>
794                 /// <param name="messageOrKey"> Key to addition result information, a key into
795                 /// ExceptionMessages, or the information
796                 /// itself if the key doesn't exist.
797                 /// 
798                 /// </param>
799                 /// <param name="resultCode">   The result code returned.
800                 /// 
801                 /// </param>
802                 /// <param name="serverMsg">    Error message specifying additional information
803                 /// from the server
804                 /// </param>
805                 public LdapException(System.String messageOrKey, int resultCode, System.String serverMsg):this(messageOrKey, null, resultCode, serverMsg, null, null)
806                 {
807                         return ;
808                 }
809                 
810                 /// <summary> Constructs an exception with a detailed message obtained from the
811                 /// specified <code>MessageOrKey</code> String and modifying arguments.
812                 /// Additional parameters specify the result code and server message.
813                 /// 
814                 /// The String is used either as a message key to obtain a localized
815                 /// messsage from ExceptionMessages, or if there is no key in the
816                 /// resource matching the text, it is used as the detailed message itself.
817                 /// 
818                 /// The message in the default locale is built with the supplied arguments,
819                 /// which are saved to be used for building messages for other locales.
820                 /// 
821                 /// </summary>
822                 /// <param name="messageOrKey"> Key to addition result information, a key into
823                 /// ExceptionMessages, or the information
824                 /// itself if the key doesn't exist.
825                 /// 
826                 /// </param>
827                 /// <param name="arguments">   The modifying arguments to be included in the
828                 /// message string.
829                 /// 
830                 /// </param>
831                 /// <param name="serverMsg">    Error message specifying additional information
832                 /// from the server
833                 /// 
834                 /// </param>
835                 /// <param name="resultCode">   The result code returned.
836                 /// </param>
837                 public LdapException(System.String messageOrKey, System.Object[] arguments, int resultCode, System.String serverMsg):this(messageOrKey, arguments, resultCode, serverMsg, null, null)
838                 {
839                         return ;
840                 }
841                 
842                 /// <summary> Constructs an exception with a detailed message obtained from the
843                 /// specified <code>MessageOrKey</code> String.
844                 /// Additional parameters specify the result code, the server message, and a
845                 /// rootException which is the underlying cause of an error on the client.
846                 /// 
847                 /// The String is used either as a message key to obtain a localized
848                 /// messsage from ExceptionMessages, or if there is no key in the
849                 /// resource matching the text, it is used as the detailed message itself.
850                 /// 
851                 /// </summary>
852                 /// <param name="messageOrKey"> Key to addition result information, a key into
853                 /// ExceptionMessages, or the information
854                 /// itself if the key doesn't exist.
855                 /// 
856                 /// </param>
857                 /// <param name="resultCode">   The result code returned.
858                 /// 
859                 /// </param>
860                 /// <param name="serverMsg">    Error message specifying additional information
861                 /// from the server
862                 /// 
863                 /// </param>
864                 /// <param name="rootException"> A throwable which is the underlying cause
865                 /// of the LdapException.
866                 /// </param>
867                 public LdapException(System.String messageOrKey, int resultCode, System.String serverMsg, System.Exception rootException):this(messageOrKey, null, resultCode, serverMsg, null, rootException)
868                 {
869                         return ;
870                 }
871                 
872                 /// <summary> Constructs an exception with a detailed message obtained from the
873                 /// specified <code>MessageOrKey</code> String and modifying arguments.
874                 /// Additional parameters specify the result code, the server message,
875                 /// and a rootException which is the underlying cause of an error
876                 /// on the client.
877                 /// 
878                 /// The String is used either as a message key to obtain a localized
879                 /// messsage from ExceptionMessages, or if there is no key in the
880                 /// resource matching the text, it is used as the detailed message itself.
881                 /// 
882                 /// The message in the default locale is built with the supplied arguments,
883                 /// which are saved to be used for building messages for other locales.
884                 /// 
885                 /// </summary>
886                 /// <param name="messageOrKey"> Key to addition result information, a key into
887                 /// ExceptionMessages, or the information
888                 /// itself if the key doesn't exist.
889                 /// 
890                 /// </param>
891                 /// <param name="arguments">   The modifying arguments to be included in the
892                 /// message string.
893                 /// 
894                 /// </param>
895                 /// <param name="resultCode">   The result code returned.
896                 /// 
897                 /// </param>
898                 /// <param name="serverMsg">    Error message specifying additional information
899                 /// from the server
900                 /// 
901                 /// </param>
902                 /// <param name="rootException"> A throwable which is the underlying cause
903                 /// of the LdapException.
904                 /// </param>
905                 public LdapException(System.String messageOrKey, System.Object[] arguments, int resultCode, System.String serverMsg, System.Exception rootException):this(messageOrKey, arguments, resultCode, serverMsg, null, rootException)
906                 {
907                         return ;
908                 }
909                 
910                 /// <summary> Constructs an exception with a detailed message obtained from the
911                 /// specified <code>MessageOrKey</code> String.
912                 /// Additional parameters specify the result code, the message returned
913                 /// from the server, and a matchedDN returned from the server.
914                 /// 
915                 /// The String is used either as a message key to obtain a localized
916                 /// messsage from ExceptionMessages, or if there is no key in the
917                 /// resource matching the text, it is used as the detailed message itself.
918                 /// 
919                 /// </summary>
920                 /// <param name="messageOrKey"> Key to addition result information, a key into
921                 /// ExceptionMessages, or the information
922                 /// itself if the key doesn't exist.
923                 /// 
924                 /// </param>
925                 /// <param name="resultCode">   The result code returned.
926                 /// 
927                 /// </param>
928                 /// <param name="serverMsg">    Error message specifying additional information
929                 /// from the server
930                 /// 
931                 /// </param>
932                 /// <param name="matchedDN">     The maximal subset of a specified DN which could
933                 /// be matched by the server on a search operation.
934                 /// </param>
935                 public LdapException(System.String messageOrKey, int resultCode, System.String serverMsg, System.String matchedDN):this(messageOrKey, null, resultCode, serverMsg, matchedDN, null)
936                 {
937                         return ;
938                 }
939                 
940                 /// <summary> Constructs an exception with a detailed message obtained from the
941                 /// specified <code>MessageOrKey</code> String and modifying arguments.
942                 /// Additional parameters specify the result code, a message returned from
943                 /// the server, and a matchedDN returned from the server.
944                 /// 
945                 /// The String is used either as a message key to obtain a localized
946                 /// messsage from ExceptionMessages, or if there is no key in the
947                 /// resource matching the text, it is used as the detailed message itself.
948                 /// 
949                 /// The message in the default locale is built with the supplied arguments,
950                 /// which are saved to be used for building messages for other locales.
951                 /// 
952                 /// </summary>
953                 /// <param name="messageOrKey"> Key to addition result information, a key into
954                 /// ExceptionMessages, or the information
955                 /// itself if the key doesn't exist.
956                 /// 
957                 /// </param>
958                 /// <param name="arguments">   The modifying arguments to be included in the
959                 /// message string.
960                 /// 
961                 /// </param>
962                 /// <param name="resultCode">   The result code returned.
963                 /// 
964                 /// </param>
965                 /// <param name="serverMsg">    Error message specifying additional information
966                 /// from the server
967                 /// 
968                 /// </param>
969                 /// <param name="matchedDN">     The maximal subset of a specified DN which could
970                 /// be matched by the server on a search operation.
971                 /// </param>
972                 public LdapException(System.String messageOrKey, System.Object[] arguments, int resultCode, System.String serverMsg, System.String matchedDN):this(messageOrKey, arguments, resultCode, serverMsg, matchedDN, null)
973                 {
974                         return ;
975                 }
976                 
977                 /// <summary> Constructs an exception with a detailed message obtained from the
978                 /// specified <code>MessageOrKey</code> String and modifying arguments.
979                 /// Additional parameters specify the result code, a message returned
980                 /// from the server, a matchedDN returned from
981                 /// the server, and a rootException which is the underlying cause of an error
982                 /// on the client.
983                 /// 
984                 /// The String is used either as a message key to obtain a localized
985                 /// messsage from ExceptionMessages, or if there is no key in the
986                 /// resource matching the text, it is used as the detailed message itself.
987                 /// 
988                 /// The message in the default locale is built with the supplied arguments,
989                 /// which are saved to be used for building messages for other locales.
990                 /// 
991                 /// </summary>
992                 /// <param name="messageOrKey"> Key to addition result information, a key into
993                 /// ExceptionMessages, or the information
994                 /// itself if the key doesn't exist.
995                 /// 
996                 /// </param>
997                 /// <param name="arguments">   The modifying arguments to be included in the
998                 /// message string.
999                 /// 
1000                 /// </param>
1001                 /// <param name="resultCode">   The result code returned.
1002                 /// 
1003                 /// </param>
1004                 /// <param name="serverMsg">    Error message specifying additional information
1005                 /// from the server
1006                 /// 
1007                 /// </param>
1008                 /// <param name="rootException"> A throwable which is the underlying cause
1009                 /// of the LdapException.
1010                 /// 
1011                 /// </param>
1012                 /// <param name="matchedDN">     The maximal subset of a specified DN which could
1013                 /// be matched by the server on a search operation.
1014                 /// </param>
1015                 /* package */
1016                 internal LdapException(System.String messageOrKey, System.Object[] arguments, int resultCode, System.String serverMsg, System.String matchedDN, System.Exception rootException)
1017                             //:base(Novell.Directory.Ldap.Utilclass.ResourcesHandler.getMessage(messageOrKey, arguments))
1018                 //Once resorcehandler starts working properly need to uncomment
1019                 {
1020                         this.messageOrKey = messageOrKey;
1021                         this.arguments = arguments;
1022                         this.resultCode = resultCode;
1023                         this.rootException = rootException;
1024                         this.matchedDN = matchedDN;
1025                         this.serverMessage = serverMsg;
1026                         return ;
1027                 }
1028                 
1029                 /// <summary> Returns a string representing the result code in the default
1030                 /// locale.
1031                 /// 
1032                 /// </summary>
1033                 /// <returns> The message for the result code in the LdapException object.
1034                 /// </returns>
1035                 public virtual System.String resultCodeToString()
1036                 {
1037                         return ResourcesHandler.getResultString(resultCode);
1038                 }
1039                 
1040                 /// <summary> Returns a string representing the specified result code in the default
1041                 /// locale.
1042                 /// 
1043                 /// </summary>
1044                 /// <param name="code"> The result code for which a message is to be returned.
1045                 /// 
1046                 /// </param>
1047                 /// <returns> The message corresponding to the specified result code, or
1048                 /// or null if the message is not available for the default locale.
1049                 /// </returns>
1050                 public static System.String resultCodeToString(int code)
1051                 {
1052                         return ResourcesHandler.getResultString(code);
1053                 }
1054                 
1055                 /// <summary> Returns a string representing the result code in the
1056                 /// specified locale.
1057                 /// 
1058                 /// </summary>
1059                 /// <param name="locale">The locale in which to render the error message.
1060                 /// 
1061                 /// </param>
1062                 /// <returns> A message corresponding to the result code in the
1063                 /// specified locale, or null if the message is not available
1064                 /// for the requested locale.
1065                 /// </returns>
1066                 public virtual System.String resultCodeToString(System.Globalization.CultureInfo locale)
1067                 {
1068                         return ResourcesHandler.getResultString(resultCode, locale);
1069                 }
1070                 
1071                 /// <summary> Returns a string representing the specified error code in the
1072                 /// specified locale.
1073                 /// 
1074                 /// </summary>
1075                 /// <param name="code">    The result code for which a message is to be
1076                 /// returned.
1077                 /// 
1078                 /// </param>
1079                 /// <param name="locale">  The locale in which to render the message.
1080                 /// 
1081                 /// </param>
1082                 /// <returns> A message corresponding to the result code in the
1083                 /// specified locale, or null if the message is not available
1084                 /// for the requested locale.
1085                 /// </returns>
1086                 public static System.String resultCodeToString(int code, System.Globalization.CultureInfo locale)
1087                 {
1088                         return ResourcesHandler.getResultString(code, locale);
1089                 }
1090                 
1091                 /// <summary> returns a string of information about the exception and the
1092                 /// the nested exceptions, if any.
1093                 /// </summary>
1094                 public override System.String ToString()
1095                 {
1096                         return getExceptionString("LdapException");
1097                 }
1098                 
1099                 /// <summary> builds a string of information about the exception and the
1100                 /// the nested exceptions, if any.
1101                 /// 
1102                 /// </summary>
1103                 /// <param name="exception">The name of the exception class
1104                 /// </param>
1105                 /* package */
1106                 internal virtual System.String getExceptionString(System.String exception)
1107                 {
1108                         System.String tmsg;
1109                         
1110                         // Format the basic exception information
1111                         
1112                         // Craft a string from the resouce file
1113                         System.String msg = ResourcesHandler.getMessage("TOSTRING", new System.Object[]{exception, base.Message, resultCode, resultCodeToString()});
1114                         // If found no string from resource file, use a default string
1115                         if (msg.ToUpper().Equals("TOSTRING".ToUpper()))
1116                         {
1117                                 msg = exception + ": (" + resultCode + ") " + resultCodeToString();
1118                         }
1119                         
1120                         // Add server message
1121                         if (((System.Object) serverMessage != null) && (serverMessage.Length != 0))
1122                         {
1123                                 tmsg = ResourcesHandler.getMessage("SERVER_MSG", new System.Object[]{exception, serverMessage});
1124                                 // If found no string from resource file, use a default string
1125                                 if (tmsg.ToUpper().Equals("SERVER_MSG".ToUpper()))
1126                                 {
1127                                         tmsg = exception + ": Server Message: " + serverMessage;
1128                                 }
1129                                 
1130                                 msg = msg + '\n' + tmsg;
1131                         }
1132                         
1133                         // Add Matched DN message
1134                         if ((System.Object) matchedDN != null)
1135                         {
1136                                 tmsg = ResourcesHandler.getMessage("MATCHED_DN", new System.Object[]{exception, matchedDN});
1137                                 // If found no string from resource file, use a default string
1138                                 if (tmsg.ToUpper().Equals("MATCHED_DN".ToUpper()))
1139                                 {
1140                                         tmsg = exception + ": Matched DN: " + matchedDN;
1141                                 }
1142                                 
1143                                 msg = msg + '\n' + tmsg;
1144                         }
1145                         
1146                         if (rootException != null)
1147                         {
1148                                 msg = msg + '\n' + rootException.ToString();
1149                         }
1150                         return msg;
1151                 }
1152         }
1153 }