src/share/classes/java/rmi/server/RemoteObject.java

Print this page




 419      * instance of that implementation-specific class.
 420      */
 421     private void readObject(java.io.ObjectInputStream in)
 422         throws java.io.IOException, java.lang.ClassNotFoundException
 423     {
 424         String refClassName = in.readUTF();
 425         if (refClassName == null || refClassName.length() == 0) {
 426             /*
 427              * No reference class name specified, so construct
 428              * remote reference from its serialized form.
 429              */
 430             ref = (RemoteRef) in.readObject();
 431         } else {
 432             /*
 433              * Built-in reference class specified, so delegate to
 434              * internal reference class to initialize its fields from
 435              * its external form.
 436              */
 437             String internalRefClassName =
 438                 RemoteRef.packagePrefix + "." + refClassName;
 439             Class refClass = Class.forName(internalRefClassName);
 440             try {
 441                 ref = (RemoteRef) refClass.newInstance();
 442 
 443                 /*
 444                  * If this step fails, assume we found an internal
 445                  * class that is not meant to be a serializable ref
 446                  * type.
 447                  */
 448             } catch (InstantiationException e) {
 449                 throw new ClassNotFoundException(internalRefClassName, e);
 450             } catch (IllegalAccessException e) {
 451                 throw new ClassNotFoundException(internalRefClassName, e);
 452             } catch (ClassCastException e) {
 453                 throw new ClassNotFoundException(internalRefClassName, e);
 454             }
 455             ref.readExternal(in);
 456         }
 457     }
 458 }


 419      * instance of that implementation-specific class.
 420      */
 421     private void readObject(java.io.ObjectInputStream in)
 422         throws java.io.IOException, java.lang.ClassNotFoundException
 423     {
 424         String refClassName = in.readUTF();
 425         if (refClassName == null || refClassName.length() == 0) {
 426             /*
 427              * No reference class name specified, so construct
 428              * remote reference from its serialized form.
 429              */
 430             ref = (RemoteRef) in.readObject();
 431         } else {
 432             /*
 433              * Built-in reference class specified, so delegate to
 434              * internal reference class to initialize its fields from
 435              * its external form.
 436              */
 437             String internalRefClassName =
 438                 RemoteRef.packagePrefix + "." + refClassName;
 439             Class<?> refClass = Class.forName(internalRefClassName);
 440             try {
 441                 ref = (RemoteRef) refClass.newInstance();
 442 
 443                 /*
 444                  * If this step fails, assume we found an internal
 445                  * class that is not meant to be a serializable ref
 446                  * type.
 447                  */
 448             } catch (InstantiationException e) {
 449                 throw new ClassNotFoundException(internalRefClassName, e);
 450             } catch (IllegalAccessException e) {
 451                 throw new ClassNotFoundException(internalRefClassName, e);
 452             } catch (ClassCastException e) {
 453                 throw new ClassNotFoundException(internalRefClassName, e);
 454             }
 455             ref.readExternal(in);
 456         }
 457     }
 458 }