History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/sun/security/validator/ValidatorException.java (1 of 18352 files). Show all

Unified · Split

java/pkg/sun/security/validator/ValidatorException.java+116−0
@@ -0,0 +1,116 @@
1/*
2 * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package sun.security.validator;
27
28import java.security.cert.*;
29
30/**
31 * ValidatorException thrown by the Validator. It has optional fields that
32 * allow better error diagnostics.
33 *
34 * @author Andreas Sterbenz
35 */
36public class ValidatorException extends CertificateException {
37
38 private static final long serialVersionUID = -2836879718282292155L;
39
40 public final static Object T_NO_TRUST_ANCHOR =
41 "No trusted certificate found";
42
43 public final static Object T_EE_EXTENSIONS =
44 "End entity certificate extension check failed";
45
46 public final static Object T_CA_EXTENSIONS =
47 "CA certificate extension check failed";
48
49 public final static Object T_CERT_EXPIRED =
50 "Certificate expired";
51
52 public final static Object T_SIGNATURE_ERROR =
53 "Certificate signature validation failed";
54
55 public final static Object T_NAME_CHAINING =
56 "Certificate chaining error";
57
58 public final static Object T_ALGORITHM_DISABLED =
59 "Certificate signature algorithm disabled";
60
61 private Object type;
62 private X509Certificate cert;
63
64 public ValidatorException(String msg) {
65 super(msg);
66 }
67
68 public ValidatorException(String msg, Throwable cause) {
69 super(msg);
70 initCause(cause);
71 }
72
73 public ValidatorException(Object type) {
74 this(type, null);
75 }
76
77 public ValidatorException(Object type, X509Certificate cert) {
78 super((String)type);
79 this.type = type;
80 this.cert = cert;
81 }
82
83 public ValidatorException(Object type, X509Certificate cert,
84 Throwable cause) {
85 this(type, cert);
86 initCause(cause);
87 }
88
89 public ValidatorException(String msg, Object type, X509Certificate cert) {
90 super(msg);
91 this.type = type;
92 this.cert = cert;
93 }
94
95 public ValidatorException(String msg, Object type, X509Certificate cert,
96 Throwable cause) {
97 this(msg, type, cert);
98 initCause(cause);
99 }
100
101 /**
102 * Get the type of the failure (one of the T_XXX constants), if
103 * available. This may be helpful when designing a user interface.
104 */
105 public Object getErrorType() {
106 return type;
107 }
108
109 /**
110 * Get the certificate causing the exception, if available.
111 */
112 public X509Certificate getErrorCertificate() {
113 return cert;
114 }
115
116}