return PortableServer.toStub(obj);
String icn = ObjImpl.getClass().getName(); if (!icn.endsWith("Impl")) throw new BAD_PARAM("Invalid class name '" + icn + "', must end with 'Impl'");  String sn = "_" + icn.substring(0, icn.length() - "Impl".length()) + "_Stub";  Class stubClass; Object o_stub;  try { stubClass = RMIClassLoader.loadClass(sn); o_stub = stubClass.newInstance(); } catch (Exception e) { NoSuchObjectException n = new NoSuchObjectException(sn); n.initCause(e); throw n; }  if (!Remote.class.isAssignableFrom(stubClass)) throw new ClassCastException(stubClass.getName() + " exists but cannot be returned as it does not inherit from " + Remote.class.getName());  return (Remote) o_stub;
  public Remote toStub(Remote obj)    throws NoSuchObjectException  {    return PortableServer.toStub(obj);  }