Fri, 24 Sep 2010 22:42:14 -0700
6891766: Vulnerabilities in use of reflection in CORBA
Reviewed-by: hawtin
1 /*
2 * Copyright (c) 1999, 2001, 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 */
25 package org.omg.CORBA;
28 /**
29 * The Stub for <tt>IDLType</tt>. For more information on
30 * Stub files, see <a href="doc-files/generatedfiles.html#stub">
31 * "Generated Files: Stubs"</a>.<P>
32 * org/omg/CORBA/_IDLTypeStub.java
33 * Generated by the IDL-to-Java compiler (portable), version "3.0"
34 * from ir.idl.
35 * 03 June 1999 11:33:44 o'clock GMT+00:00
36 */
38 public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.IDLType
39 {
40 /**
41 * Constructs a default <code>_IDLTypeStub</code> object.
42 * NOTE: If the default constructor is used, the
43 * object is useless until the method <code>_set_delegate</code>
44 * has been called.
45 */
46 // NOTE: This constructor is not required according to the spec. Only JCK expects it now.
47 public _IDLTypeStub ()
48 {
49 super ();
50 }
52 /**
53 * Constructs an <code>_IDLTypeStub</code> object initialized
54 * with the given <code>Delegate</code> object.
55 *
56 * @param delegate a Delegate object
57 */
58 // NOTE: This constructor is not required according to the spec. We keep it as a convenience method.
59 public _IDLTypeStub (org.omg.CORBA.portable.Delegate delegate)
60 {
61 super ();
62 _set_delegate (delegate);
63 }
65 public org.omg.CORBA.TypeCode type ()
66 {
67 org.omg.CORBA.portable.InputStream _in = null;
68 try {
69 org.omg.CORBA.portable.OutputStream _out = _request ("_get_type", true);
70 _in = _invoke (_out);
71 org.omg.CORBA.TypeCode __result = _in.read_TypeCode ();
72 return __result;
73 } catch (org.omg.CORBA.portable.ApplicationException _ex) {
74 _in = _ex.getInputStream ();
75 String _id = _ex.getId ();
76 throw new org.omg.CORBA.MARSHAL (_id);
77 } catch (org.omg.CORBA.portable.RemarshalException _rm) {
78 return type ();
79 } finally {
80 _releaseReply (_in);
81 }
82 } // type
85 // read interface
86 public org.omg.CORBA.DefinitionKind def_kind ()
87 {
88 org.omg.CORBA.portable.InputStream _in = null;
89 try {
90 org.omg.CORBA.portable.OutputStream _out = _request ("_get_def_kind", true);
91 _in = _invoke (_out);
92 org.omg.CORBA.DefinitionKind __result = org.omg.CORBA.DefinitionKindHelper.read (_in);
93 return __result;
94 } catch (org.omg.CORBA.portable.ApplicationException _ex) {
95 _in = _ex.getInputStream ();
96 String _id = _ex.getId ();
97 throw new org.omg.CORBA.MARSHAL (_id);
98 } catch (org.omg.CORBA.portable.RemarshalException _rm) {
99 return def_kind ();
100 } finally {
101 _releaseReply (_in);
102 }
103 } // def_kind
106 // write interface
107 public void destroy ()
108 {
109 org.omg.CORBA.portable.InputStream _in = null;
110 try {
111 org.omg.CORBA.portable.OutputStream _out = _request ("destroy", true);
112 _in = _invoke (_out);
113 } catch (org.omg.CORBA.portable.ApplicationException _ex) {
114 _in = _ex.getInputStream ();
115 String _id = _ex.getId ();
116 throw new org.omg.CORBA.MARSHAL (_id);
117 } catch (org.omg.CORBA.portable.RemarshalException _rm) {
118 destroy ();
119 } finally {
120 _releaseReply (_in);
121 }
122 } // destroy
124 // Type-specific CORBA::Object operations
125 private static String[] __ids = {
126 "IDL:omg.org/CORBA/IDLType:1.0",
127 "IDL:omg.org/CORBA/IRObject:1.0"};
129 public String[] _ids ()
130 {
131 return (String[])__ids.clone ();
132 }
134 private void readObject (java.io.ObjectInputStream s)
135 {
136 try
137 {
138 String str = s.readUTF ();
139 org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str);
140 org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
141 _set_delegate (delegate);
142 } catch (java.io.IOException e) {}
143 }
145 private void writeObject (java.io.ObjectOutputStream s)
146 {
147 try
148 {
149 String str = org.omg.CORBA.ORB.init ().object_to_string (this);
150 s.writeUTF (str);
151 } catch (java.io.IOException e) {}
152 }
153 } // class _IDLTypeStub