src/java.rmi/share/classes/java/rmi/server/RemoteObject.java
author darcy
Fri, 20 Jul 2018 14:46:43 -0700
changeset 51181 01b8120f867a
parent 47216 71c04702a3d5
permissions -rw-r--r--
8208060: Additional corrections of serial-related declarations Reviewed-by: rriggs, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
27805
e63666f0f666 8066632: Suppress deprecation warnings in java.rmi module
darcy
parents: 25859
diff changeset
     2
 * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.rmi.server;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.rmi.Remote;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.rmi.NoSuchObjectException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.lang.reflect.Proxy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import sun.rmi.server.Util;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * The <code>RemoteObject</code> class implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <code>java.lang.Object</code> behavior for remote objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <code>RemoteObject</code> provides the remote semantics of Object by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * implementing methods for hashCode, equals, and toString.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @author      Ann Wollrath
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @author      Laird Dornin
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @author      Peter Jones
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 14342
diff changeset
    42
 * @since       1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
public abstract class RemoteObject implements Remote, java.io.Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    /** The object's remote reference. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    transient protected RemoteRef ref;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    /** indicate compatibility with JDK 1.1.x version of class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    private static final long serialVersionUID = -3215090123894869218L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * Creates a remote object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    protected RemoteObject() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
        ref = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * Creates a remote object, initialized with the specified remote
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * reference.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * @param newref remote reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    protected RemoteObject(RemoteRef newref) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        ref = newref;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * Returns the remote reference for the remote object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * <p>Note: The object returned from this method may be an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * an implementation-specific class.  The <code>RemoteObject</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * class ensures serialization portability of its instances' remote
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * references through the behavior of its custom
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * <code>writeObject</code> and <code>readObject</code> methods.  An
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * instance of <code>RemoteRef</code> should not be serialized outside
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * of its <code>RemoteObject</code> wrapper instance or the result may
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * be unportable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @return remote reference for the remote object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    public RemoteRef getRef() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        return ref;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * Returns the stub for the remote object <code>obj</code> passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * as a parameter. This operation is only valid <i>after</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * the object has been exported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @param obj the remote object whose stub is needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @return the stub for the remote object, <code>obj</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * @exception NoSuchObjectException if the stub for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * remote object could not be found.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     */
27805
e63666f0f666 8066632: Suppress deprecation warnings in java.rmi module
darcy
parents: 25859
diff changeset
    97
    @SuppressWarnings("deprecation")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public static Remote toStub(Remote obj) throws NoSuchObjectException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        if (obj instanceof RemoteStub ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            (obj != null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
             Proxy.isProxyClass(obj.getClass()) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
             Proxy.getInvocationHandler(obj) instanceof
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
             RemoteObjectInvocationHandler))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
            return obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            return sun.rmi.transport.ObjectTable.getStub(obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * Returns a hashcode for a remote object.  Two remote object stubs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * that refer to the same remote object will have the same hash code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * (in order to support remote objects as keys in hash tables).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @see             java.util.Hashtable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        return (ref == null) ? super.hashCode() : ref.remoteHashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * Compares two remote objects for equality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * Returns a boolean that indicates whether this remote object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * equivalent to the specified Object. This method is used when a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * remote object is stored in a hashtable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * If the specified Object is not itself an instance of RemoteObject,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * then this method delegates by returning the result of invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * <code>equals</code> method of its parameter with this remote object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * as the argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @param   obj     the Object to compare with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @return  true if these Objects are equal; false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * @see             java.util.Hashtable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        if (obj instanceof RemoteObject) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            if (ref == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                return obj == this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                return ref.remoteEquals(((RemoteObject)obj).ref);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        } else if (obj != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
             * Fix for 4099660: if object is not an instance of RemoteObject,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
             * use the result of its equals method, to support symmetry is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
             * remote object implementation class that does not extend
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
             * RemoteObject wishes to support equality with its stub objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            return obj.equals(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * Returns a String that represents the value of this remote object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        String classname = Util.getUnqualifiedName(getClass());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        return (ref == null) ? classname :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            classname + "[" + ref.remoteToString() + "]";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * <code>writeObject</code> for custom serialization.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * <p>This method writes this object's serialized form for this class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * <p>The {@link RemoteRef#getRefClass(java.io.ObjectOutput) getRefClass}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * method is invoked on this object's <code>ref</code> field
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * to obtain its external ref type name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * If the value returned by <code>getRefClass</code> was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * a non-<code>null</code> string of length greater than zero,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * the <code>writeUTF</code> method is invoked on <code>out</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * with the value returned by <code>getRefClass</code>, and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * the <code>writeExternal</code> method is invoked on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * this object's <code>ref</code> field passing <code>out</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * as the argument; otherwise,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * the <code>writeUTF</code> method is invoked on <code>out</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * with a zero-length string (<code>""</code>), and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * the <code>writeObject</code> method is invoked on <code>out</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * passing this object's <code>ref</code> field as the argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * @serialData
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * The serialized data for this class comprises a string (written with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * <code>ObjectOutput.writeUTF</code>) that is either the external
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * ref type name of the contained <code>RemoteRef</code> instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * (the <code>ref</code> field) or a zero-length string, followed by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * either the external form of the <code>ref</code> field as written by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * its <code>writeExternal</code> method if the string was of non-zero
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * length, or the serialized form of the <code>ref</code> field as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * written by passing it to the serialization stream's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * <code>writeObject</code> if the string was of zero length.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * <p>If this object is an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * {@link RemoteStub} or {@link RemoteObjectInvocationHandler}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * that was returned from any of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * the <code>UnicastRemoteObject.exportObject</code> methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * and custom socket factories are not used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * the external ref type name is <code>"UnicastRef"</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * If this object is an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * that was returned from any of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * the <code>UnicastRemoteObject.exportObject</code> methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * and custom socket factories are used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * the external ref type name is <code>"UnicastRef2"</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * If this object is an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * that was returned from any of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * the <code>java.rmi.activation.Activatable.exportObject</code> methods,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * the external ref type name is <code>"ActivatableRef"</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * If this object is an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * that was returned from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * the <code>RemoteObject.toStub</code> method (and the argument passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * to <code>toStub</code> was not itself a <code>RemoteStub</code>),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * the external ref type name is a function of how the remote object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * passed to <code>toStub</code> was exported, as described above.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * If this object is an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * <code>RemoteStub</code> or <code>RemoteObjectInvocationHandler</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * that was originally created via deserialization,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * the external ref type name is the same as that which was read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * when this object was deserialized.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * <p>If this object is an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * <code>java.rmi.server.UnicastRemoteObject</code> that does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * use custom socket factories,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * the external ref type name is <code>"UnicastServerRef"</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * If this object is an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * <code>UnicastRemoteObject</code> that does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * use custom socket factories,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * the external ref type name is <code>"UnicastServerRef2"</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * <p>Following is the data that must be written by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * <code>writeExternal</code> method and read by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * <code>readExternal</code> method of <code>RemoteRef</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * implementation classes that correspond to the each of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * defined external ref type names:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * <p>For <code>"UnicastRef"</code>:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * <li>the hostname of the referenced remote object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * written by {@link java.io.ObjectOutput#writeUTF(String)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * <li>the port of the referenced remote object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * written by {@link java.io.ObjectOutput#writeInt(int)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * <li>the data written as a result of calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * {link java.rmi.server.ObjID#write(java.io.ObjectOutput)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * on the <code>ObjID</code> instance contained in the reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * <li>the boolean value <code>false</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * written by {@link java.io.ObjectOutput#writeBoolean(boolean)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * <p>For <code>"UnicastRef2"</code> with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * <code>null</code> client socket factory:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * <li>the byte value <code>0x00</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * (indicating <code>null</code> client socket factory),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * written by {@link java.io.ObjectOutput#writeByte(int)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * <li>the hostname of the referenced remote object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * written by {@link java.io.ObjectOutput#writeUTF(String)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * <li>the port of the referenced remote object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * written by {@link java.io.ObjectOutput#writeInt(int)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * <li>the data written as a result of calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * {link java.rmi.server.ObjID#write(java.io.ObjectOutput)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * on the <code>ObjID</code> instance contained in the reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * <li>the boolean value <code>false</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * written by {@link java.io.ObjectOutput#writeBoolean(boolean)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * <p>For <code>"UnicastRef2"</code> with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * non-<code>null</code> client socket factory:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * <li>the byte value <code>0x01</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * (indicating non-<code>null</code> client socket factory),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * written by {@link java.io.ObjectOutput#writeByte(int)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * <li>the hostname of the referenced remote object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * written by {@link java.io.ObjectOutput#writeUTF(String)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * <li>the port of the referenced remote object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * written by {@link java.io.ObjectOutput#writeInt(int)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * <li>a client socket factory (object of type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * <code>java.rmi.server.RMIClientSocketFactory</code>),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * written by passing it to an invocation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * <code>writeObject</code> on the stream instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * <li>the data written as a result of calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * {link java.rmi.server.ObjID#write(java.io.ObjectOutput)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * on the <code>ObjID</code> instance contained in the reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * <li>the boolean value <code>false</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * written by {@link java.io.ObjectOutput#writeBoolean(boolean)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * <p>For <code>"ActivatableRef"</code> with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * <code>null</code> nested remote reference:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * <li>an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * <code>java.rmi.activation.ActivationID</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * written by passing it to an invocation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * <code>writeObject</code> on the stream instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * <li>a zero-length string (<code>""</code>),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * written by {@link java.io.ObjectOutput#writeUTF(String)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * <p>For <code>"ActivatableRef"</code> with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * non-<code>null</code> nested remote reference:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * <li>an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * <code>java.rmi.activation.ActivationID</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * written by passing it to an invocation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * <code>writeObject</code> on the stream instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * <li>the external ref type name of the nested remote reference,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * which must be <code>"UnicastRef2"</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * written by {@link java.io.ObjectOutput#writeUTF(String)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * <li>the external form of the nested remote reference,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * written by invoking its <code>writeExternal</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * with the stream instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * (see the description of the external form for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * <code>"UnicastRef2"</code> above)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * <p>For <code>"UnicastServerRef"</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * <code>"UnicastServerRef2"</code>, no data is written by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * <code>writeExternal</code> method or read by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * <code>readExternal</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    private void writeObject(java.io.ObjectOutputStream out)
51181
01b8120f867a 8208060: Additional corrections of serial-related declarations
darcy
parents: 47216
diff changeset
   362
        throws java.io.IOException
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        if (ref == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            throw new java.rmi.MarshalException("Invalid remote object");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            String refClassName = ref.getRefClass(out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
            if (refClassName == null || refClassName.length() == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                 * No reference class name specified, so serialize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                 * remote reference.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                out.writeUTF("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                out.writeObject(ref);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                 * Built-in reference class specified, so delegate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                 * to reference to write out its external form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                out.writeUTF(refClassName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                ref.writeExternal(out);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * <code>readObject</code> for custom serialization.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * <p>This method reads this object's serialized form for this class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * <p>The <code>readUTF</code> method is invoked on <code>in</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * to read the external ref type name for the <code>RemoteRef</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * instance to be filled in to this object's <code>ref</code> field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * If the string returned by <code>readUTF</code> has length zero,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * the <code>readObject</code> method is invoked on <code>in</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * and than the value returned by <code>readObject</code> is cast to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * <code>RemoteRef</code> and this object's <code>ref</code> field is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * set to that value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * Otherwise, this object's <code>ref</code> field is set to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * <code>RemoteRef</code> instance that is created of an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * implementation-specific class corresponding to the external ref
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * type name returned by <code>readUTF</code>, and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * the <code>readExternal</code> method is invoked on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * this object's <code>ref</code> field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * <p>If the external ref type name is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * <code>"UnicastRef"</code>, <code>"UnicastServerRef"</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * <code>"UnicastRef2"</code>, <code>"UnicastServerRef2"</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * or <code>"ActivatableRef"</code>, a corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * implementation-specific class must be found, and its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * <code>readExternal</code> method must read the serial data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * for that external ref type name as specified to be written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * in the <b>serialData</b> documentation for this class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * If the external ref type name is any other string (of non-zero
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * length), a <code>ClassNotFoundException</code> will be thrown,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * unless the implementation provides an implementation-specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * class corresponding to that external ref type name, in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * case this object's <code>ref</code> field will be set to an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * instance of that implementation-specific class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    private void readObject(java.io.ObjectInputStream in)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        throws java.io.IOException, java.lang.ClassNotFoundException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        String refClassName = in.readUTF();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        if (refClassName == null || refClassName.length() == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
             * No reference class name specified, so construct
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
             * remote reference from its serialized form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
            ref = (RemoteRef) in.readObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
             * Built-in reference class specified, so delegate to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
             * internal reference class to initialize its fields from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
             * its external form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
            String internalRefClassName =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                RemoteRef.packagePrefix + "." + refClassName;
11117
b6e68b1344d4 7116404: Miscellaneous warnings (java.rmi.**, serialization, some core classes)
alanb
parents: 5506
diff changeset
   440
            Class<?> refClass = Class.forName(internalRefClassName);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
            try {
37782
ad8fe7507ecc 6850612: Deprecate Class.newInstance since it violates the checked exception language contract
darcy
parents: 27805
diff changeset
   442
                @SuppressWarnings("deprecation")
ad8fe7507ecc 6850612: Deprecate Class.newInstance since it violates the checked exception language contract
darcy
parents: 27805
diff changeset
   443
                Object tmp = refClass.newInstance();
ad8fe7507ecc 6850612: Deprecate Class.newInstance since it violates the checked exception language contract
darcy
parents: 27805
diff changeset
   444
                ref = (RemoteRef) tmp;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
                 * If this step fails, assume we found an internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                 * class that is not meant to be a serializable ref
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                 * type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
                 */
37782
ad8fe7507ecc 6850612: Deprecate Class.newInstance since it violates the checked exception language contract
darcy
parents: 27805
diff changeset
   451
            } catch (InstantiationException | IllegalAccessException | ClassCastException e) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
                throw new ClassNotFoundException(internalRefClassName, e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
            ref.readExternal(in);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
}