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, 2000, 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 | * A modifiable list containing <code>NamedValue</code> objects. |
duke@1 | 30 | * <P> |
duke@1 | 31 | * The class <code>NVList</code> is used as follows: |
duke@1 | 32 | * <UL> |
duke@1 | 33 | * <LI>to describe arguments for a <code>Request</code> object |
duke@1 | 34 | * in the Dynamic Invocation Interface and |
duke@1 | 35 | * the Dynamic Skeleton Interface |
duke@1 | 36 | * <LI>to describe context values in a <code>Context</code> object |
duke@1 | 37 | * </UL> |
duke@1 | 38 | * <P> |
duke@1 | 39 | * Each <code>NamedValue</code> object consists of the following: |
duke@1 | 40 | * <UL> |
duke@1 | 41 | * <LI>a name, which is a <code>String</code> object |
duke@1 | 42 | * <LI>a value, as an <code>Any</code> object |
duke@1 | 43 | * <LI>an argument mode flag |
duke@1 | 44 | * </UL> |
duke@1 | 45 | * <P> |
duke@1 | 46 | * An <code>NVList</code> object |
duke@1 | 47 | * may be created using one of the following |
duke@1 | 48 | * <code>ORB</code> methods: |
duke@1 | 49 | * <OL> |
duke@1 | 50 | * <LI><code>org.omg.CORBA.ORB.create_list</code> |
duke@1 | 51 | * <PRE> |
duke@1 | 52 | * org.omg.CORBA.NVList nv = orb.create_list(3); |
duke@1 | 53 | * </PRE> |
duke@1 | 54 | * The variable <code>nv</code> represents a newly-created |
duke@1 | 55 | * <code>NVList</code> object. The argument is a memory-management |
duke@1 | 56 | * hint to the orb and does not imply the actual length of the list. |
duke@1 | 57 | * If, for example, you want to use an <code>NVList</code> object |
duke@1 | 58 | * in a request, and the method being invoked takes three parameters, |
duke@1 | 59 | * you might optimize by supplying 3 to the method |
duke@1 | 60 | * <code>create_list</code>. Note that the new <code>NVList</code> |
duke@1 | 61 | * will not necessarily have a length of 3; it |
duke@1 | 62 | * could have a length of 2 or 4, for instance. |
duke@1 | 63 | * Note also that you can add any number of |
duke@1 | 64 | * <code>NamedValue</code> objects to this list regardless of |
duke@1 | 65 | * its original length. |
duke@1 | 66 | * <P> |
duke@1 | 67 | * <LI><code>org.omg.CORBA.ORB.create_operation_list</code> |
duke@1 | 68 | * <PRE> |
duke@1 | 69 | * org.omg.CORBA.NVList nv = orb.create_operation_list(myOperationDef); |
duke@1 | 70 | * </PRE> |
duke@1 | 71 | * The variable <code>nv</code> represents a newly-created |
duke@1 | 72 | * <code>NVList</code> object that contains descriptions of the |
duke@1 | 73 | * arguments to the method described in the given |
duke@1 | 74 | * <code>OperationDef</code> object. |
duke@1 | 75 | * </OL> |
duke@1 | 76 | * <P> |
duke@1 | 77 | * The methods in the class <code>NVList</code> all deal with |
duke@1 | 78 | * the <code>NamedValue</code> objects in the list. |
duke@1 | 79 | * There are three methods for adding a <code>NamedValue</code> object, |
duke@1 | 80 | * a method for getting the count of <code>NamedValue</code> objects in |
duke@1 | 81 | * the list, a method for retrieving a <code>NamedValue</code> object |
duke@1 | 82 | * at a given index, and a method for removing a <code>NamedValue</code> object |
duke@1 | 83 | * at a given index. |
duke@1 | 84 | * |
duke@1 | 85 | * @see org.omg.CORBA.Request |
duke@1 | 86 | * @see org.omg.CORBA.ServerRequest |
duke@1 | 87 | * @see org.omg.CORBA.NamedValue |
duke@1 | 88 | * @see org.omg.CORBA.Context |
duke@1 | 89 | * |
duke@1 | 90 | * @since JDK1.2 |
duke@1 | 91 | */ |
duke@1 | 92 | |
duke@1 | 93 | public abstract class NVList { |
duke@1 | 94 | |
duke@1 | 95 | /** |
duke@1 | 96 | * Returns the number of <code>NamedValue</code> objects that have |
duke@1 | 97 | * been added to this <code>NVList</code> object. |
duke@1 | 98 | * |
duke@1 | 99 | * @return an <code>int</code> indicating the number of |
duke@1 | 100 | * <code>NamedValue</code> objects in this <code>NVList</code>. |
duke@1 | 101 | */ |
duke@1 | 102 | |
duke@1 | 103 | public abstract int count(); |
duke@1 | 104 | |
duke@1 | 105 | /** |
duke@1 | 106 | * Creates a new <code>NamedValue</code> object initialized with the given flag |
duke@1 | 107 | * and adds it to the end of this <code>NVList</code> object. |
duke@1 | 108 | * The flag can be any one of the argument passing modes: |
duke@1 | 109 | * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or |
duke@1 | 110 | * <code>ARG_INOUT.value</code>. |
duke@1 | 111 | * |
duke@1 | 112 | * @param flags one of the argument mode flags |
duke@1 | 113 | * @return the newly-created <code>NamedValue</code> object |
duke@1 | 114 | */ |
duke@1 | 115 | |
duke@1 | 116 | public abstract NamedValue add(int flags); |
duke@1 | 117 | |
duke@1 | 118 | /** |
duke@1 | 119 | * Creates a new <code>NamedValue</code> object initialized with the |
duke@1 | 120 | * given name and flag, |
duke@1 | 121 | * and adds it to the end of this <code>NVList</code> object. |
duke@1 | 122 | * The flag can be any one of the argument passing modes: |
duke@1 | 123 | * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or |
duke@1 | 124 | * <code>ARG_INOUT.value</code>. |
duke@1 | 125 | * |
duke@1 | 126 | * @param item_name the name for the new <code>NamedValue</code> object |
duke@1 | 127 | * @param flags one of the argument mode flags |
duke@1 | 128 | * @return the newly-created <code>NamedValue</code> object |
duke@1 | 129 | */ |
duke@1 | 130 | |
duke@1 | 131 | public abstract NamedValue add_item(String item_name, int flags); |
duke@1 | 132 | |
duke@1 | 133 | /** |
duke@1 | 134 | * Creates a new <code>NamedValue</code> object initialized with the |
duke@1 | 135 | * given name, value, and flag, |
duke@1 | 136 | * and adds it to the end of this <code>NVList</code> object. |
duke@1 | 137 | * |
duke@1 | 138 | * @param item_name the name for the new <code>NamedValue</code> object |
duke@1 | 139 | * @param val an <code>Any</code> object containing the value |
duke@1 | 140 | * for the new <code>NamedValue</code> object |
duke@1 | 141 | * @param flags one of the following argument passing modes: |
duke@1 | 142 | * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or |
duke@1 | 143 | * <code>ARG_INOUT.value</code> |
duke@1 | 144 | * @return the newly created <code>NamedValue</code> object |
duke@1 | 145 | */ |
duke@1 | 146 | |
duke@1 | 147 | public abstract NamedValue add_value(String item_name, Any val, int flags); |
duke@1 | 148 | |
duke@1 | 149 | /** |
duke@1 | 150 | * Retrieves the <code>NamedValue</code> object at the given index. |
duke@1 | 151 | * |
duke@1 | 152 | * @param index the index of the desired <code>NamedValue</code> object, |
duke@1 | 153 | * which must be between zero and the length of the list |
duke@1 | 154 | * minus one, inclusive. The first item is at index zero. |
duke@1 | 155 | * @return the <code>NamedValue</code> object at the given index |
duke@1 | 156 | * @exception org.omg.CORBA.Bounds if the index is greater than |
duke@1 | 157 | * or equal to number of <code>NamedValue</code> objects |
duke@1 | 158 | */ |
duke@1 | 159 | |
duke@1 | 160 | public abstract NamedValue item(int index) throws org.omg.CORBA.Bounds; |
duke@1 | 161 | |
duke@1 | 162 | /** |
duke@1 | 163 | * Removes the <code>NamedValue</code> object at the given index. |
duke@1 | 164 | * Note that the indices of all <code>NamedValue</code> objects following |
duke@1 | 165 | * the one removed are shifted down by one. |
duke@1 | 166 | * |
duke@1 | 167 | * @param index the index of the <code>NamedValue</code> object to be |
duke@1 | 168 | * removed, which must be between zero and the length |
duke@1 | 169 | * of the list minus one, inclusive. |
duke@1 | 170 | * The first item is at index zero. |
duke@1 | 171 | * @exception org.omg.CORBA.Bounds if the index is greater than |
duke@1 | 172 | * or equal to number of <code>NamedValue</code> objects in |
duke@1 | 173 | * the list |
duke@1 | 174 | */ |
duke@1 | 175 | |
duke@1 | 176 | public abstract void remove(int index) throws org.omg.CORBA.Bounds; |
duke@1 | 177 | |
duke@1 | 178 | } |