Functional_ORB orb)
OrbFunctional orb)
  public synchronized org.omg.CORBA.Object corbaloc(String corbaloc,    Functional_ORB orb)    throws BAD_PARAM  {    boolean corbaname;    // The alternative addresses, if given.    ArrayList alt_addr = new ArrayList();    // The version numbers with default values.    int major = 1;    int minor = 0;    // The host address.    String host;    // The port.    int port = DEFAULT_PORT;    // The object key as string.    String key;    StringTokenizer st = new StringTokenizer(corbaloc, ":@/.,#", true);    t = new String[st.countTokens()];    for (int i = 0; i < t.length; i++)      {        t[i] = st.nextToken();      }    p = 0;    if (t[p].startsWith(pxCORBANAME))      corbaname = true;    else if (t[p].equalsIgnoreCase(pxCORBALOC))      corbaname = false;    else if (t[p].equalsIgnoreCase(pxIOR))      {        IOR ior = IOR.parse(corbaloc);        return orb.ior_to_object(ior);      }    else      throw new DATA_CONVERSION("Unsupported protocol: '" + t[p] + "'");    p++;    if (!t[p++].equals(":"))      throw new BAD_PARAM("Syntax (':' expected after name prefix)");    // Check for rir:    if (t[p].equals(RIR))      {        p++;        if (!t[p++].equals(":"))          throw new BAD_PARAM("':' expected after 'rir'");        key = readKey("/");        Object object;        try          {            object = orb.resolve_initial_references(key);            return corbaname ? resolve(object) : object;          }        catch (InvalidName e)          {            throw new BAD_PARAM("Unknown initial reference '" + key + "'");          }      }    else    // Check for iiop.    if (t[p].equals(IIOP) || t[p].equals(":"))      {        IOR ior = new IOR();        Addresses: do          { // Read addresses.            if (t[p].equals(":"))              {                p++;              }            else              {                p++;                if (!t[p++].equals(":"))                  throw new BAD_PARAM("':' expected after 'iiop'");                // Check if version is present.                if (t[p + 1].equals("."))                  if (t[p + 3].equals("@"))                    {                      // Version info present.                      try                        {                          major = Integer.parseInt(t[p++]);                        }                      catch (NumberFormatException e)                        {                          throw new BAD_PARAM("Major version number '"                            + t[p - 1] + "'");                        }                      p++; // '.' at this point.                      try                        {                          minor = Integer.parseInt(t[p++]);                        }                      catch (NumberFormatException e)                        {                          throw new BAD_PARAM("Major version number '"                            + t[p - 1] + "'");                        }                      p++; // '@' at this point.                    }              }            ior.Internet.version = new Version(major, minor);            // Then host data goes till '/' or ':'.            StringBuffer bhost = new StringBuffer(corbaloc.length());            while (!t[p].equals(":") && !t[p].equals("/") && !t[p].equals(","))              bhost.append(t[p++]);            host = bhost.toString();            ior.Internet.host = host;            if (t[p].equals(":"))              {                // Port specified.                p++;                try                  {                    port = Integer.parseInt(t[p++]);                  }                catch (NumberFormatException e)                  {                    throw new BAD_PARAM("Invalid port '" + t[p - 1] + "'");                  }              }            ior.Internet.port = port;            // Id is not listed.            ior.Id = "";            if (t[p].equals(","))              p++;            else              break Addresses;          }        while (true);        key = readKey("/");        ior.key = key.getBytes();        org.omg.CORBA.Object object = orb.ior_to_object(ior);        return corbaname ? resolve(object) : object;      }    else      throw new DATA_CONVERSION("Unsupported protocol '" + t[p] + "'");  }