Fri, 24 Sep 2010 22:42:14 -0700
6891766: Vulnerabilities in use of reflection in CORBA
Reviewed-by: hawtin
1 /*
2 * Copyright (c) 1996, 1999, 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 */
26 package org.omg.CORBA;
28 /**
29 * An object used in <code>Request</code> operations to
30 * describe the exceptions that can be thrown by a method. It maintains a
31 * modifiable list of <code>TypeCode</code>s of the exceptions.
32 * <P>
33 * The following code fragment demonstrates creating
34 * an <code>ExceptionList</code> object:
35 * <PRE>
36 * ORB orb = ORB.init(args, null);
37 * org.omg.CORBA.ExceptionList excList = orb.create_exception_list();
38 * </PRE>
39 * The variable <code>excList</code> represents an <code>ExceptionList</code>
40 * object with no <code>TypeCode</code> objects in it.
41 * <P>
42 * To add items to the list, you first create a <code>TypeCode</code> object
43 * for the exception you want to include, using the <code>ORB</code> method
44 * <code>create_exception_tc</code>. Then you use the <code>ExceptionList</code>
45 * method <code>add</code> to add it to the list.
46 * The class <code>ExceptionList</code> has a method for getting
47 * the number of <code>TypeCode</code> objects in the list, and after
48 * items have been added, it is possible to call methods for accessing
49 * or deleting an item at a designated index.
50 *
51 * @since JDK1.2
52 */
54 public abstract class ExceptionList {
56 /**
57 * Retrieves the number of <code>TypeCode</code> objects in this
58 * <code>ExceptionList</code> object.
59 *
60 * @return the number of <code>TypeCode</code> objects in this
61 * <code>ExceptionList</code> object
62 */
64 public abstract int count();
66 /**
67 * Adds a <code>TypeCode</code> object describing an exception
68 * to this <code>ExceptionList</code> object.
69 *
70 * @param exc the <code>TypeCode</code> object to be added
71 */
73 public abstract void add(TypeCode exc);
75 /**
76 * Returns the <code>TypeCode</code> object at the given index. The first
77 * item is at index 0.
78 *
79 * @param index the index of the <code>TypeCode</code> object desired.
80 * This must be an <code>int</code> between 0 and the
81 * number of <code>TypeCode</code> objects
82 * minus one, inclusive.
83 * @return the <code>TypeCode</code> object at the given index
84 * @exception org.omg.CORBA.Bounds if the index given is greater than
85 * or equal to the number of <code>TypeCode</code> objects
86 * in this <code>ExceptionList</code> object
87 */
89 public abstract TypeCode item(int index)
90 throws org.omg.CORBA.Bounds;
92 /**
93 * Removes the <code>TypeCode</code> object at the given index.
94 * Note that the indices of all the <code>TypeCoded</code> objects
95 * following the one deleted are shifted down by one.
96 *
97 * @param index the index of the <code>TypeCode</code> object to be
98 * removed.
99 * This must be an <code>int</code> between 0 and the
100 * number of <code>TypeCode</code> objects
101 * minus one, inclusive.
102 *
103 * @exception org.omg.CORBA.Bounds if the index is greater than
104 * or equal to the number of <code>TypeCode</code> objects
105 * in this <code>ExceptionList</code> object
106 */
108 public abstract void remove(int index)
109 throws org.omg.CORBA.Bounds;
110 }