src/share/classes/org/omg/CORBA/SystemException.java

Tue, 21 Jan 2014 16:26:59 +0000

author
msheppar
date
Tue, 21 Jan 2014 16:26:59 +0000
changeset 615
8b0b643ffd42
parent 158
91006f157c46
child 748
6845b95cba6b
permissions
-rw-r--r--

8025005: Enhance CORBA initializations
Summary: restructure ORB.init() processing flow.
Reviewed-by: alanb, coffeys, skoivu

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

mercurial