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