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