Package javax.naming

Examples of javax.naming.InvalidNameException


            try                             // do sanity check
            {
//        if (RDN==null || "".equals(RDN)) return;
                if (rdnText==null || "".equals(rdnText))  //TE: empty RDN.
                    throw new InvalidNameException(CBIntText.get("Empty RDN, please enter a valid RDN.") + " " + ((rdnText==null)?"<null>":CBIntText.get("The RDN value entered was: '")+rdnText) + "'");

                if (NameUtility.next(rdnText,0,'=')<0//TE: no '='.
                    throw new InvalidNameException(CBIntText.get("Invalid RDN, please enter a naming attribute followed by '=' followed by a name in the RDN field (for example, 'cn=Trudi). '") + ((rdnText==null)?"<null>":CBIntText.get("The RDN value entered was: '")+rdnText) + "'");
                else if (NameUtility.next(rdnText,0,'=')<1//TE: no naming attribute.
                    throw new InvalidNameException(CBIntText.get("Invalid RDN, please enter a naming attribute in the RDN field (for example, cn: 'cn=Trudi). '") + ((rdnText==null)?"<null>":CBIntText.get("The RDN value entered was: '")+rdnText) + "'");
            }
            catch (InvalidNameException ine)
            {
                CBUtility.warning(this, CBIntText.get("Please Fill in the RDN field with a valid RDN."), CBIntText.get("Invalid RDN"));
                log.log(Level.WARNING, "Invalid RDN value in the New Entry dialog: ", ine);
View Full Code Here


               NameParser parser = context.getNameParser("");
               URI userNameUri = new URI(absoluteName);
               String pathComponent = userNameUri.getPath();
               // Should not ever have an empty path component, since that is /{DN}
               if (pathComponent.length() < 1 ) {
                   throw new InvalidNameException(
                           "Search returned unparseable absolute name: " +
                           absoluteName );
               }
               Name name = parser.parse(pathComponent.substring(1));
               return name.toString();
           } catch ( URISyntaxException e ) {
               throw new InvalidNameException(
                       "Search returned unparseable absolute name: " +
                       absoluteName );
           }
        }
    }
View Full Code Here

               NameParser parser = context.getNameParser("");
               URI userNameUri = new URI(absoluteName);
               String pathComponent = userNameUri.getPath();
               // Should not ever have an empty path component, since that is /{DN}
               if (pathComponent.length() < 1 ) {
                   throw new InvalidNameException(
                           "Search returned unparseable absolute name: " +
                           absoluteName );
               }
               Name name = parser.parse(pathComponent.substring(1));
               return name.toString();
           } catch ( URISyntaxException e ) {
               throw new InvalidNameException(
                       "Search returned unparseable absolute name: " +
                       absoluteName );
           }
        }
    }
View Full Code Here

        int equalpos = NameUtility.next(rdnfragment, 0, '=');
        // check rdn has at least one non null attribute and one non null value

        if (equalpos <= 0 || equalpos == rdnfragment.length()-1)
            throw new InvalidNameException("RDN.add(): invalid rdn fragment '" + ((rdnfragment==null)?"<null>":rdnfragment) + "' (can't find equal sign)");

        if (ldapEscapedRDN.length()>0)
            ldapEscapedRDN += "+" + rdnfragment;
        else
            ldapEscapedRDN = rdnfragment;
View Full Code Here

        if (status == SINGLEVALUED)
        {
            if (i==0)
                ldapEscapedRDN = ldapEscapedElement;
            else
                throw new InvalidNameException("cannot set non zero element of single valued rdn.");
        }
        else
        {
            if (i < 0 || i >= size())
                throw new InvalidNameException("attempt to set element " + i + " of rdn: '" + ldapEscapedRDN + "' (size = " + size() + ")");

            ldapEscapedRDN = ldapEscapedRDN.substring(0, elements[i]+1) +
                             ldapEscapedElement +
                             ldapEscapedRDN.substring(elements[i+1]);
View Full Code Here

        validate();

        String attval = getElement(i);
        String att = attval.substring(0, attval.indexOf('='));
        if (att == null || att.length()==0)
            throw new InvalidNameException("can't parse old RDN '" + ldapEscapedRDN);

        String newElement = att + "=" + NameUtility.escape(v);
        setElement(i, newElement);
    }
View Full Code Here

                if ("01234567890ABCDEFabcdef".indexOf(c) > 0)
                {
                    foundUTF = true;
                    char c2 = utfString.charAt(pos+2);
                    if ("01234567890ABCDEFabcdef".indexOf(c2) == -1)
                        throw new InvalidNameException("second char of escaped hex couplet wasn't hex; was '" + c2 + "'");
                       
                    char utf8 = (char)Integer.parseInt("" + c + c2, 16);
                    utfString = utfString.substring(0,pos) + utf8 + utfString.substring(pos+3);
                    pos = utfString.indexOf('\\',pos+1);
                }
                else
                {
                    pos = utfString.indexOf('\\',pos+1); // skip normally escaped ldap character (e.g. \+ or \= )
                }
            }
           
            if (foundUTF// read the string as ascii (8859-1) bytes, and then interpret
            {           // those bytes as utf8 to make a java unicode internal string...
                utfString = new String(utfString.getBytes("ISO-8859-1"), "UTF8");
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
            throw new InvalidNameException("unable to parse rdn val: '" + utfString + "' - raw error was: " + e.toString());
        }
       
        return utfString;
    }
View Full Code Here

        if (len == 0) return string;
   
        if (string.charAt(0)=='\"')
        {
            if (string.charAt(string.length()-1)!='\"'// whole string *must* be quoted
                throw new InvalidNameException("RDN.unescape(): invalid rdn fragment '" + ((string==null)?"<null>":string) + "'");
               
            string = string.substring(1,string.length()-1);
        }
        else
        {      
View Full Code Here

            hasUTF8 = true; // we'll cope with this seperately below...
            pos += 2; // skip past the two hex digits and keep going...         
          }
          else
          {
            throw new InvalidNameException("illegal escaped character '" + c + "' in name: '" + string + "' (NameUtility:handleEscapedCharacters() ).");
          }
        }         
        pos = buffy.toString().indexOf("\\",pos+1)// try to find next slash to work on.
          }
      }
      catch (StringIndexOutOfBoundsException e)
      {
          throw new InvalidNameException("unparsable string '" + string + "' in NameUtility");
      }               
     
    if (hasUTF8)
      return removeEscapedUTF(buffy.toString());
    else     
View Full Code Here

     * {@inheritDoc}
     */
    public void bind(Name name, Object obj) throws NamingException {
        if (name.isEmpty()) {
            // jndi.7B=Cannot bind empty name
            throw new InvalidNameException(Messages.getString("jndi.7B")); //$NON-NLS-1$
        }
        String stringName = getMyComponents(name);

        try {
            registry.bind(stringName, getStateToBind(stringName, obj));
View Full Code Here

TOP

Related Classes of javax.naming.InvalidNameException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.