1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.model.exception;
21
22
23 import java.security.cert.CertPathValidatorException.BasicReason;
24 import java.security.cert.CertPathValidatorException.Reason;
25
26
27 public class LdapTlsHandshakeFailCause
28 {
29 private Throwable cause;
30 private Throwable rootCause;
31 private Reason reason;
32 private String reasonPhrase;
33
34
35 public LdapTlsHandshakeFailCause()
36 {
37 }
38
39
40 public LdapTlsHandshakeFailCause( Throwable cause, Throwable rootCause, Reason reason, String reasonPhrase )
41 {
42 this.cause = cause;
43 this.rootCause = rootCause;
44 this.reason = reason;
45 this.reasonPhrase = reasonPhrase;
46 }
47
48
49 public Throwable getCause()
50 {
51 return cause;
52 }
53
54
55 public void setCause( Throwable cause )
56 {
57 this.cause = cause;
58 }
59
60
61 public Throwable getRootCause()
62 {
63 return rootCause;
64 }
65
66
67 public void setRootCause( Throwable rootCause )
68 {
69 this.rootCause = rootCause;
70 }
71
72
73 public Reason getReason()
74 {
75 return reason;
76 }
77
78
79 public void setReason( Reason reason )
80 {
81 this.reason = reason;
82 }
83
84
85 public String getReasonPhrase()
86 {
87 return reasonPhrase;
88 }
89
90
91 public void setReasonPhrase( String reasonPhrase )
92 {
93 this.reasonPhrase = reasonPhrase;
94 }
95
96
97
98
99
100
101
102 public enum LdapApiReason implements Reason
103 {
104 NO_VALID_CERTIFICATION_PATH,
105 SELF_SIGNED,
106 HOST_NAME_VERIFICATION_FAILED,
107 }
108
109
110 public String getMessage()
111 {
112 String message = reasonPhrase;
113 if ( rootCause != null && rootCause != cause )
114 {
115 message += ": " + rootCause.getMessage();
116 }
117 return message;
118 }
119
120 }