corba/src/java.corba/share/classes/org/omg/CORBA/SystemException.java
author msheppar
Thu, 01 Jun 2017 17:49:34 +0100
changeset 45443 57dbb6453a4d
parent 25862 a5e25d68f971
permissions -rw-r--r--
8176784: Amend HREF to technote/guides in CORBA API docs to unilinks for guides Reviewed-by: chegar, rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
/*
45443
57dbb6453a4d 8176784: Amend HREF to technote/guides in CORBA API docs to unilinks for guides
msheppar
parents: 25862
diff changeset
     2
 * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
 *
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    23
 * questions.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    25
02bb8761fcce Initial load
duke
parents:
diff changeset
    26
package org.omg.CORBA;
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
import org.omg.CORBA.portable.InputStream;
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
import org.omg.CORBA.portable.OutputStream;
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
import java.util.*;
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
import org.omg.CORBA.OMGVMCID;
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
import com.sun.corba.se.impl.util.SUNVMCID;
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
/**
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
 * The root class for all CORBA standard exceptions. These exceptions
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
 * may be thrown as a result of any CORBA operation invocation and may
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
 * also be returned by many standard CORBA API methods. The standard
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
 * exceptions contain a minor code, allowing more detailed specification, and a
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
 * completion status. This class is subclassed to
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
 * generate each one of the set of standard ORB exceptions.
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
 * <code>SystemException</code> extends
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
 * <code>java.lang.RuntimeException</code>; thus none of the
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
 * <code>SystemException</code> exceptions need to be
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
 * declared in signatures of the Java methods mapped from operations in
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
 * IDL interfaces.
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
 *
45443
57dbb6453a4d 8176784: Amend HREF to technote/guides in CORBA API docs to unilinks for guides
msheppar
parents: 25862
diff changeset
    47
 * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
57dbb6453a4d 8176784: Amend HREF to technote/guides in CORBA API docs to unilinks for guides
msheppar
parents: 25862
diff changeset
    48
 * </p>
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
public abstract class SystemException extends java.lang.RuntimeException {
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
     * The CORBA Exception minor code.
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
     * @serial
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
    public int minor;
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
     * The status of the operation that threw this exception.
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
     * @serial
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
    public CompletionStatus completed;
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
     * Constructs a <code>SystemException</code> exception with the specified detail
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
     * message, minor code, and completion status.
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
     * A detail message is a String that describes this particular exception.
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
     * @param reason the String containing a detail message
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
     * @param minor the minor code
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
     * @param completed the completion status
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
    protected SystemException(String reason, int minor, CompletionStatus completed) {
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
        super(reason);
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
        this.minor = minor;
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
        this.completed = completed;
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
     * Converts this exception to a representative string.
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
    public String toString() {
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
        // The fully qualified exception class name
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
        String result = super.toString();
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
        // The vmcid part
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
        int vmcid = minor & 0xFFFFF000;
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
        switch (vmcid) {
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
            case OMGVMCID.value:
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
                result += "  vmcid: OMG";
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
                break;
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
            case SUNVMCID.value:
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
                result += "  vmcid: SUN";
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
                break;
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
            default:
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
                result += "  vmcid: 0x" + Integer.toHexString(vmcid);
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
                break;
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
        // The minor code part
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
        int mc = minor & 0x00000FFF;
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
        result += "  minor code: " + mc;
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
        // The completion status part
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
        switch (completed.value()) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
            case CompletionStatus._COMPLETED_YES:
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
                result += "  completed: Yes";
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
                break;
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
            case CompletionStatus._COMPLETED_NO:
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
                result += "  completed: No";
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
                break;
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
            case CompletionStatus._COMPLETED_MAYBE:
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
            default:
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
                result += " completed: Maybe";
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
                break;
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
        return result;
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
}