Search in sources :

Example 11 with InvalidName

use of org.omg.CosNaming.NamingContextPackage.InvalidName in project wildfly by wildfly.

the class Name method toName.

/**
     *
     * @return an a array of NameComponents
     * @throws org.omg.CosNaming.NamingContextPackage.InvalidName
     */
public static org.omg.CosNaming.NameComponent[] toName(String sn) throws org.omg.CosNaming.NamingContextPackage.InvalidName {
    if (sn == null || sn.length() == 0 || sn.startsWith("/"))
        throw new InvalidName();
    Vector v = new Vector();
    int start = 0;
    int i = 0;
    for (; i < sn.length(); i++) {
        if (sn.charAt(i) == '/' && sn.charAt(i - 1) != '\\') {
            if (i - start == 0)
                throw new InvalidName();
            v.addElement(getComponent(sn.substring(start, i)));
            start = i + 1;
        }
    }
    if (start < i)
        v.addElement(getComponent(sn.substring(start, i)));
    org.omg.CosNaming.NameComponent[] result = new org.omg.CosNaming.NameComponent[v.size()];
    for (int j = 0; j < result.length; j++) {
        result[j] = (org.omg.CosNaming.NameComponent) v.elementAt(j);
    }
    return result;
}
Also used : InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName) NameComponent(org.omg.CosNaming.NameComponent) Vector(java.util.Vector)

Aggregations

InvalidName (org.omg.CosNaming.NamingContextPackage.InvalidName)11 NameComponent (org.omg.CosNaming.NameComponent)9 CannotProceed (org.omg.CosNaming.NamingContextPackage.CannotProceed)9 NotFound (org.omg.CosNaming.NamingContextPackage.NotFound)6 AlreadyBound (org.omg.CosNaming.NamingContextPackage.AlreadyBound)3 NamingContext (org.omg.CosNaming.NamingContext)2 Vector (java.util.Vector)1 CannotProceedException (javax.naming.CannotProceedException)1 ContextNotEmptyException (javax.naming.ContextNotEmptyException)1 InvalidNameException (javax.naming.InvalidNameException)1 NameAlreadyBoundException (javax.naming.NameAlreadyBoundException)1 NameNotFoundException (javax.naming.NameNotFoundException)1 NamingException (javax.naming.NamingException)1 StartException (org.jboss.msc.service.StartException)1 NamingContextExt (org.omg.CosNaming.NamingContextExt)1 NotEmpty (org.omg.CosNaming.NamingContextPackage.NotEmpty)1