68 * that caused the exception to be thrown |
68 * that caused the exception to be thrown |
69 */ |
69 */ |
70 private int index = -1; |
70 private int index = -1; |
71 |
71 |
72 /** |
72 /** |
73 * @serial the <code>CertPath</code> that was being validated when |
73 * @serial the {@code CertPath} that was being validated when |
74 * the exception was thrown |
74 * the exception was thrown |
75 */ |
75 */ |
76 private CertPath certPath; |
76 private CertPath certPath; |
77 |
77 |
78 /** |
78 /** |
79 * @serial the reason the validation failed |
79 * @serial the reason the validation failed |
80 */ |
80 */ |
81 private Reason reason = BasicReason.UNSPECIFIED; |
81 private Reason reason = BasicReason.UNSPECIFIED; |
82 |
82 |
83 /** |
83 /** |
84 * Creates a <code>CertPathValidatorException</code> with |
84 * Creates a {@code CertPathValidatorException} with |
85 * no detail message. |
85 * no detail message. |
86 */ |
86 */ |
87 public CertPathValidatorException() { |
87 public CertPathValidatorException() { |
88 this(null, null); |
88 this(null, null); |
89 } |
89 } |
90 |
90 |
91 /** |
91 /** |
92 * Creates a <code>CertPathValidatorException</code> with the given |
92 * Creates a {@code CertPathValidatorException} with the given |
93 * detail message. A detail message is a <code>String</code> that |
93 * detail message. A detail message is a {@code String} that |
94 * describes this particular exception. |
94 * describes this particular exception. |
95 * |
95 * |
96 * @param msg the detail message |
96 * @param msg the detail message |
97 */ |
97 */ |
98 public CertPathValidatorException(String msg) { |
98 public CertPathValidatorException(String msg) { |
99 this(msg, null); |
99 this(msg, null); |
100 } |
100 } |
101 |
101 |
102 /** |
102 /** |
103 * Creates a <code>CertPathValidatorException</code> that wraps the |
103 * Creates a {@code CertPathValidatorException} that wraps the |
104 * specified throwable. This allows any exception to be converted into a |
104 * specified throwable. This allows any exception to be converted into a |
105 * <code>CertPathValidatorException</code>, while retaining information |
105 * {@code CertPathValidatorException}, while retaining information |
106 * about the wrapped exception, which may be useful for debugging. The |
106 * about the wrapped exception, which may be useful for debugging. The |
107 * detail message is set to (<code>cause==null ? null : cause.toString() |
107 * detail message is set to ({@code cause==null ? null : cause.toString()}) |
108 * </code>) (which typically contains the class and detail message of |
108 * (which typically contains the class and detail message of |
109 * cause). |
109 * cause). |
110 * |
110 * |
111 * @param cause the cause (which is saved for later retrieval by the |
111 * @param cause the cause (which is saved for later retrieval by the |
112 * {@link #getCause getCause()} method). (A <code>null</code> value is |
112 * {@link #getCause getCause()} method). (A {@code null} value is |
113 * permitted, and indicates that the cause is nonexistent or unknown.) |
113 * permitted, and indicates that the cause is nonexistent or unknown.) |
114 */ |
114 */ |
115 public CertPathValidatorException(Throwable cause) { |
115 public CertPathValidatorException(Throwable cause) { |
116 this((cause == null ? null : cause.toString()), cause); |
116 this((cause == null ? null : cause.toString()), cause); |
117 } |
117 } |
118 |
118 |
119 /** |
119 /** |
120 * Creates a <code>CertPathValidatorException</code> with the specified |
120 * Creates a {@code CertPathValidatorException} with the specified |
121 * detail message and cause. |
121 * detail message and cause. |
122 * |
122 * |
123 * @param msg the detail message |
123 * @param msg the detail message |
124 * @param cause the cause (which is saved for later retrieval by the |
124 * @param cause the cause (which is saved for later retrieval by the |
125 * {@link #getCause getCause()} method). (A <code>null</code> value is |
125 * {@link #getCause getCause()} method). (A {@code null} value is |
126 * permitted, and indicates that the cause is nonexistent or unknown.) |
126 * permitted, and indicates that the cause is nonexistent or unknown.) |
127 */ |
127 */ |
128 public CertPathValidatorException(String msg, Throwable cause) { |
128 public CertPathValidatorException(String msg, Throwable cause) { |
129 this(msg, cause, null, -1); |
129 this(msg, cause, null, -1); |
130 } |
130 } |
131 |
131 |
132 /** |
132 /** |
133 * Creates a <code>CertPathValidatorException</code> with the specified |
133 * Creates a {@code CertPathValidatorException} with the specified |
134 * detail message, cause, certification path, and index. |
134 * detail message, cause, certification path, and index. |
135 * |
135 * |
136 * @param msg the detail message (or <code>null</code> if none) |
136 * @param msg the detail message (or {@code null} if none) |
137 * @param cause the cause (or <code>null</code> if none) |
137 * @param cause the cause (or {@code null} if none) |
138 * @param certPath the certification path that was in the process of |
138 * @param certPath the certification path that was in the process of |
139 * being validated when the error was encountered |
139 * being validated when the error was encountered |
140 * @param index the index of the certificate in the certification path |
140 * @param index the index of the certificate in the certification path |
141 * that caused the error (or -1 if not applicable). Note that |
141 * that caused the error (or -1 if not applicable). Note that |
142 * the list of certificates in a <code>CertPath</code> is zero based. |
142 * the list of certificates in a {@code CertPath} is zero based. |
143 * @throws IndexOutOfBoundsException if the index is out of range |
143 * @throws IndexOutOfBoundsException if the index is out of range |
144 * {@code (index < -1 || (certPath != null && index >= |
144 * {@code (index < -1 || (certPath != null && index >= |
145 * certPath.getCertificates().size()) } |
145 * certPath.getCertificates().size()) } |
146 * @throws IllegalArgumentException if <code>certPath</code> is |
146 * @throws IllegalArgumentException if {@code certPath} is |
147 * <code>null</code> and <code>index</code> is not -1 |
147 * {@code null} and {@code index} is not -1 |
148 */ |
148 */ |
149 public CertPathValidatorException(String msg, Throwable cause, |
149 public CertPathValidatorException(String msg, Throwable cause, |
150 CertPath certPath, int index) { |
150 CertPath certPath, int index) { |
151 this(msg, cause, certPath, index, BasicReason.UNSPECIFIED); |
151 this(msg, cause, certPath, index, BasicReason.UNSPECIFIED); |
152 } |
152 } |
153 |
153 |
154 /** |
154 /** |
155 * Creates a <code>CertPathValidatorException</code> with the specified |
155 * Creates a {@code CertPathValidatorException} with the specified |
156 * detail message, cause, certification path, index, and reason. |
156 * detail message, cause, certification path, index, and reason. |
157 * |
157 * |
158 * @param msg the detail message (or <code>null</code> if none) |
158 * @param msg the detail message (or {@code null} if none) |
159 * @param cause the cause (or <code>null</code> if none) |
159 * @param cause the cause (or {@code null} if none) |
160 * @param certPath the certification path that was in the process of |
160 * @param certPath the certification path that was in the process of |
161 * being validated when the error was encountered |
161 * being validated when the error was encountered |
162 * @param index the index of the certificate in the certification path |
162 * @param index the index of the certificate in the certification path |
163 * that caused the error (or -1 if not applicable). Note that |
163 * that caused the error (or -1 if not applicable). Note that |
164 * the list of certificates in a <code>CertPath</code> is zero based. |
164 * the list of certificates in a {@code CertPath} is zero based. |
165 * @param reason the reason the validation failed |
165 * @param reason the reason the validation failed |
166 * @throws IndexOutOfBoundsException if the index is out of range |
166 * @throws IndexOutOfBoundsException if the index is out of range |
167 * {@code (index < -1 || (certPath != null && index >= |
167 * {@code (index < -1 || (certPath != null && index >= |
168 * certPath.getCertificates().size()) } |
168 * certPath.getCertificates().size()) } |
169 * @throws IllegalArgumentException if <code>certPath</code> is |
169 * @throws IllegalArgumentException if {@code certPath} is |
170 * <code>null</code> and <code>index</code> is not -1 |
170 * {@code null} and {@code index} is not -1 |
171 * @throws NullPointerException if <code>reason</code> is <code>null</code> |
171 * @throws NullPointerException if {@code reason} is {@code null} |
172 * |
172 * |
173 * @since 1.7 |
173 * @since 1.7 |
174 */ |
174 */ |
175 public CertPathValidatorException(String msg, Throwable cause, |
175 public CertPathValidatorException(String msg, Throwable cause, |
176 CertPath certPath, int index, Reason reason) { |
176 CertPath certPath, int index, Reason reason) { |