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;
}
Aggregations