private static String matchAttributeTypeDescr()

in ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/FastDnParser.java [354:448]


    private static String matchAttributeTypeDescr( char[] name, Position pos ) throws LdapInvalidDnException
    {
        int start = pos.start;

        while ( hasMoreChars( pos ) )
        {
            char c = nextChar( name, pos, true );

            switch ( c )
            {
                case 'A':
                case 'B':
                case 'C':
                case 'D':
                case 'E':
                case 'F':
                case 'G':
                case 'H':
                case 'I':
                case 'J':
                case 'K':
                case 'L':
                case 'M':
                case 'N':
                case 'O':
                case 'P':
                case 'Q':
                case 'R':
                case 'S':
                case 'T':
                case 'U':
                case 'V':
                case 'W':
                case 'X':
                case 'Y':
                case 'Z':
                case 'a':
                case 'b':
                case 'c':
                case 'd':
                case 'e':
                case 'f':
                case 'g':
                case 'h':
                case 'i':
                case 'j':
                case 'k':
                case 'l':
                case 'm':
                case 'n':
                case 'o':
                case 'p':
                case 'q':
                case 'r':
                case 's':
                case 't':
                case 'u':
                case 'v':
                case 'w':
                case 'x':
                case 'y':
                case 'z':
                case '0':
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case '-':
                case '_':
                    // Violation of the RFC, just because those idiots at Microsoft decided to support it...
                    break;

                case ' ':
                case '=':
                    pos.start--;
                    return new String( name, start, pos.start - start );

                case '.':
                    // occurs for RDNs of form "oid.1.2.3=test"
                    throw TooComplexDnException.INSTANCE;

                default:
                    // error
                    throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_13605_START_AT_DESCR_EXPECTED, c,
                        pos.start ) );
            }
        }

        return new String( name, start, pos.start - start );
    }