jdk/src/share/classes/javax/xml/crypto/NoSuchMechanismException.java
author malenkov
Wed, 30 Apr 2014 19:28:05 +0400
changeset 24544 c0133e7c7162
parent 5506 202f599c92aa
permissions -rw-r--r--
8041917: unexcepted behavior of LineBorder while using Boolean variable true Reviewed-by: alexsch, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2005, 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
 * $Id: NoSuchMechanismException.java,v 1.4 2005/05/10 15:47:42 mullan Exp $
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
package javax.xml.crypto;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.PrintStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.io.PrintWriter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.xml.crypto.dsig.Manifest;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.xml.crypto.dsig.XMLSignature;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.xml.crypto.dsig.XMLSignatureFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.xml.crypto.dsig.keyinfo.KeyInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.xml.crypto.dsig.keyinfo.KeyInfoFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * This exception is thrown when a particular XML mechanism is requested but
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * is not available in the environment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>A <code>NoSuchMechanismException</code> can contain a cause: another
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * throwable that caused this <code>NoSuchMechanismException</code> to get
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @author Sean Mullan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @author JSR 105 Expert Group
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @see XMLSignatureFactory#getInstance XMLSignatureFactory.getInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * @see KeyInfoFactory#getInstance KeyInfoFactory.getInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
public class NoSuchMechanismException extends RuntimeException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private static final long serialVersionUID = 4189669069570660166L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * The throwable that caused this exception to get thrown, or null if this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * exception was not caused by another throwable or if the causative
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * throwable is unknown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    private Throwable cause;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * Constructs a new <code>NoSuchMechanismException</code> with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * <code>null</code> as its detail message.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public NoSuchMechanismException() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * Constructs a new <code>NoSuchMechanismException</code> with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * specified detail message.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @param message the detail message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public NoSuchMechanismException(String message) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        super(message);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * Constructs a new <code>NoSuchMechanismException</code> with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * specified detail message and cause.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * <p>Note that the detail message associated with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * <code>cause</code> is <i>not</i> automatically incorporated in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * this exception's detail message.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @param message the detail message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @param cause the cause (A <tt>null</tt> value is permitted, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     *        indicates that the cause is nonexistent or unknown.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public NoSuchMechanismException(String message, Throwable cause) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        super(message);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        this.cause = cause;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * Constructs a new <code>NoSuchMechanismException</code> with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * specified cause and a detail message of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * <code>(cause==null ? null : cause.toString())</code> (which typically
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * contains the class and detail message of <code>cause</code>).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param cause the cause (A <tt>null</tt> value is permitted, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *        indicates that the cause is nonexistent or unknown.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    public NoSuchMechanismException(Throwable cause) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        super(cause==null ? null : cause.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        this.cause = cause;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * Returns the cause of this <code>NoSuchMechanismException</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * <code>null</code> if the cause is nonexistent or unknown.  (The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * cause is the throwable that caused this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * <code>NoSuchMechanismException</code> to get thrown.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @return the cause of this <code>NoSuchMechanismException</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *         <code>null</code> if the cause is nonexistent or unknown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    public Throwable getCause() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        return cause;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * Prints this <code>NoSuchMechanismException</code>, its backtrace and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * the cause's backtrace to the standard error stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    public void printStackTrace() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        super.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        //XXX print backtrace of cause
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * Prints this <code>NoSuchMechanismException</code>, its backtrace and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * the cause's backtrace to the specified print stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * @param s <code>PrintStream</code> to use for output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public void printStackTrace(PrintStream s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        super.printStackTrace(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        //XXX print backtrace of cause
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
     * Prints this <code>NoSuchMechanismException</code>, its backtrace and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * the cause's backtrace to the specified print writer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * @param s <code>PrintWriter</code> to use for output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    public void printStackTrace(PrintWriter s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        super.printStackTrace(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        //XXX print backtrace of cause
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
}