in ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/FastDnParser.java [461:560]
private static String matchAttributeTypeNumericOid( char[] name, Position pos ) throws LdapInvalidDnException
{
int dotCount = 0;
int start = pos.start;
while ( true )
{
char c = nextChar( name, pos, true );
switch ( c )
{
case '0':
// leading '0', no other digit may follow!
c = nextChar( name, pos, true );
switch ( c )
{
case '.':
dotCount++;
break;
case ' ':
case '=':
pos.start--;
break;
default:
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err(
I18n.ERR_13606_EXPECTED_NUMERICOID, c, pos.start ) );
}
break;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
boolean inInnerLoop = true;
while ( inInnerLoop )
{
c = nextChar( name, pos, true );
switch ( c )
{
case ' ':
case '=':
inInnerLoop = false;
pos.start--;
break;
case '.':
inInnerLoop = false;
dotCount++;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
break;
default:
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err(
I18n.ERR_13606_EXPECTED_NUMERICOID, c, pos.start ) );
}
}
break;
case ' ':
case '=':
pos.start--;
if ( dotCount > 0 )
{
return new String( name, start, pos.start - start );
}
else
{
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_13607_DOT_MISSING_IN_OID ) );
}
default:
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_13608_START_AT_NUMERICOID_EXPECTED, c,
pos.start ) );
}
}
}