< prev index next >

src/java.rmi/share/classes/sun/rmi/server/ActivatableRef.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad


 353         if (localRef == null) {
 354             out.writeUTF("");
 355         } else {
 356             out.writeUTF(localRef.getRefClass(out));
 357             localRef.writeExternal(out);
 358         }
 359     }
 360 
 361     /**
 362      * Read in external representation for remote ref.
 363      * @exception ClassNotFoundException If the class for an object
 364      * being restored cannot be found.
 365      */
 366     public void readExternal(ObjectInput in)
 367         throws IOException, ClassNotFoundException
 368     {
 369         id = (ActivationID)in.readObject();
 370         ref = null;
 371         String className = in.readUTF();
 372 
 373         if (className.equals("")) return;
 374 
 375         try {
 376             Class<?> refClass = Class.forName(RemoteRef.packagePrefix + "." +
 377                                               className);
 378             ref = (RemoteRef)refClass.newInstance();
 379             ref.readExternal(in);
 380         } catch (InstantiationException e) {
 381             throw new UnmarshalException("Unable to create remote reference",
 382                                          e);
 383         } catch (IllegalAccessException e) {
 384             throw new UnmarshalException("Illegal access creating remote reference");
 385         }
 386     }
 387 
 388     //----------------------------------------------------------------------;
 389     /**
 390      * Method from object, forward from RemoteObject
 391      */
 392     public String remoteToString() {
 393         return Util.getUnqualifiedName(getClass()) +


 353         if (localRef == null) {
 354             out.writeUTF("");
 355         } else {
 356             out.writeUTF(localRef.getRefClass(out));
 357             localRef.writeExternal(out);
 358         }
 359     }
 360 
 361     /**
 362      * Read in external representation for remote ref.
 363      * @exception ClassNotFoundException If the class for an object
 364      * being restored cannot be found.
 365      */
 366     public void readExternal(ObjectInput in)
 367         throws IOException, ClassNotFoundException
 368     {
 369         id = (ActivationID)in.readObject();
 370         ref = null;
 371         String className = in.readUTF();
 372 
 373         if (className.isEmpty()) return;
 374 
 375         try {
 376             Class<?> refClass = Class.forName(RemoteRef.packagePrefix + "." +
 377                                               className);
 378             ref = (RemoteRef)refClass.newInstance();
 379             ref.readExternal(in);
 380         } catch (InstantiationException e) {
 381             throw new UnmarshalException("Unable to create remote reference",
 382                                          e);
 383         } catch (IllegalAccessException e) {
 384             throw new UnmarshalException("Illegal access creating remote reference");
 385         }
 386     }
 387 
 388     //----------------------------------------------------------------------;
 389     /**
 390      * Method from object, forward from RemoteObject
 391      */
 392     public String remoteToString() {
 393         return Util.getUnqualifiedName(getClass()) +
< prev index next >