directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject [ServerEntry new API] Q about BasicServerAttribute
Date Fri, 14 Dec 2007 11:57:11 GMT
Hi,

just a quick Q :

we have many methods 'add' in this class. Should we always check that 
the added value is syntaxically correct ? The current version does not 
check this :

    public boolean add( String val )
    {
        return values.add( new ServerStringValue( attributeType, val ) );
    }

I suggest that we should write this method this way :

    public boolean add( String val ) throws 
InvalidAttributeValueException, NamingException
    {
        if ( attributeType.getSyntax().isHumanReadable() )
        {
            attributeType.getSyntax().getSyntaxChecker().assertSyntax( 
val );

            return values.add( new ServerStringValue( attributeType, val 
) );
        }
        else
        {
            throw new InvalidAttributeValueException();
        }
    }

wdyt ?

-- 
--
cordialement, regards,
Emmanuel L├ęcharny
www.iktek.com
directory.apache.org



Mime
View raw message