jdk/src/java.base/share/classes/sun/security/provider/certpath/BuildStep.java
author ascarpino
Wed, 03 May 2017 09:04:35 -0700
changeset 44920 5b66112437ba
parent 30374 2abaf49910ea
permissions -rw-r--r--
8176457: Add verbose option to java.security.debug Reviewed-by: vinnie
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
     2
 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.security.provider.certpath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.security.cert.X509Certificate;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * Describes one step of a certification path build, consisting of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * <code>Vertex</code> state description, a certificate, a possible throwable,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * and a result code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * @author      Anne Anderson
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * @since       1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @see sun.security.provider.certpath.Vertex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
public class BuildStep {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    private Vertex          vertex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private X509Certificate cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    private Throwable       throwable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    private int             result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * result code associated with a certificate that may continue a path from
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * the current certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    public static final int POSSIBLE = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * result code associated with a certificate that was tried, but that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * represents an unsuccessful path, so the certificate has been backed out
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * to allow backtracking to the next possible path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    public static final int BACK = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * result code associated with a certificate that successfully continues the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * current path, but does not yet reach the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    public static final int FOLLOW = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * result code associated with a certificate that represents the end of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * last possible path, where no path successfully reached the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public static final int FAIL = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * result code associated with a certificate that represents the end of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * path that successfully reaches the target.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public static final int SUCCEED = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * construct a BuildStep
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @param vtx description of the vertex at this step
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @param res result, where result is one of POSSIBLE, BACK,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     *            FOLLOW, FAIL, SUCCEED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public BuildStep(Vertex vtx, int res) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        vertex = vtx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        if (vertex != null) {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
    87
            cert = vertex.getCertificate();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            throwable = vertex.getThrowable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        result = res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * return vertex description for this build step
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
    96
     * @return Vertex
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public Vertex getVertex() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        return vertex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * return the certificate associated with this build step
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   105
     * @return X509Certificate
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    public X509Certificate getCertificate() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        return cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * return string form of issuer name from certificate associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * build step
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   115
     * @return String form of issuer name or null, if no certificate.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    public String getIssuerName() {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
   118
        return getIssuerName(null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * return string form of issuer name from certificate associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * build step, or a default name if no certificate associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * build step, or if issuer name could not be obtained from the certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * @param defaultName name to use as default if unable to return an issuer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * name from the certificate, or if no certificate.
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   128
     * @return String form of issuer name or defaultName, if no certificate or
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * exception received while trying to extract issuer name from certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    public String getIssuerName(String defaultName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        return (cert == null ? defaultName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                             : cert.getIssuerX500Principal().toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * return string form of subject name from certificate associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * build step.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   140
     * @return String form of subject name or null, if no certificate.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    public String getSubjectName() {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
   143
        return getSubjectName(null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * return string form of subject name from certificate associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * build step, or a default name if no certificate associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * build step, or if subject name could not be obtained from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * @param defaultName name to use as default if unable to return a subject
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * name from the certificate, or if no certificate.
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   154
     * @return String form of subject name or defaultName, if no certificate or
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * if an exception was received while attempting to extract the subject name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * from the certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public String getSubjectName(String defaultName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        return (cert == null ? defaultName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                             : cert.getSubjectX500Principal().toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * return the exception associated with this build step.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   166
     * @return Throwable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public Throwable getThrowable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        return throwable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * return the result code associated with this build step.  The result codes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * are POSSIBLE, FOLLOW, BACK, FAIL, SUCCEED.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   176
     * @return int result code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    public int getResult() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * return a string representing the meaning of the result code associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * with this build step.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @param   res    result code
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   187
     * @return String string representing meaning of the result code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    public String resultToString(int res) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        String resultString = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        switch (res) {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
   192
            case POSSIBLE:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                resultString = "Certificate to be tried.\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                break;
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
   195
            case BACK:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                resultString = "Certificate backed out since path does not "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                    + "satisfy build requirements.\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                break;
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
   199
            case FOLLOW:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                resultString = "Certificate satisfies conditions.\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                break;
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
   202
            case FAIL:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                resultString = "Certificate backed out since path does not "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                    + "satisfy conditions.\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                break;
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
   206
            case SUCCEED:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                resultString = "Certificate satisfies conditions.\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                resultString = "Internal error: Invalid step result value.\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        return resultString;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * return a string representation of this build step, showing minimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * detail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   219
     * @return String
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     */
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
   221
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        String out = "Internal Error\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        switch (result) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        case BACK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        case FAIL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            out = resultToString(result);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            out = out + vertex.throwableToString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        case FOLLOW:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        case SUCCEED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        case POSSIBLE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            out = resultToString(result);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            out = "Internal Error: Invalid step result\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        return out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * return a string representation of this build step, showing all detail of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * the vertex state appropriate to the result of this build step, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * certificate contents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   246
     * @return String
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    public String verboseToString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        String out = resultToString(getResult());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        switch (result) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        case BACK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        case FAIL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            out = out + vertex.throwableToString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        case FOLLOW:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        case SUCCEED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            out = out + vertex.moreToString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        case POSSIBLE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        out = out + "Certificate contains:\n" + vertex.certToString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        return out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * return a string representation of this build step, including all possible
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * detail of the vertex state, but not including the certificate contents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     *
30374
2abaf49910ea 8079478: some docs cleanup for sun.security
avstepan
parents: 25859
diff changeset
   272
     * @return String
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    public String fullToString() {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 5506
diff changeset
   275
        return resultToString(getResult()) + vertex.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
}