mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
20.20.2014 2d7aad2c25507ea427980b54848c26594c607ae2
opendj3-server-dev/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRule.java
@@ -34,9 +34,8 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.api.SubstringMatchingRule;
import org.opends.server.types.DirectoryException;
import org.forgerock.opendj.ldap.ResultCode;
import static org.opends.server.schema.SchemaConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -123,12 +122,12 @@
   *
   * @return  The normalized version of the provided value.
   *
   * @throws  DirectoryException  If the provided value is invalid according to
   * @throws  DecodeException  If the provided value is invalid according to
   *                              the associated attribute syntax.
   */
  @Override
  public ByteString normalizeAttributeValue(ByteSequence value)
         throws DirectoryException
         throws DecodeException
  {
    String valueString = value.toString();
    int    valueLength = valueString.length();
@@ -160,20 +159,19 @@
   *
   * @return  The normalized form of the value fragment.
   *
   * @throws  DirectoryException  If the provided value fragment is not
   * @throws  DecodeException  If the provided value fragment is not
   *                              acceptable according to the associated syntax.
   */
  @Override
  public ByteString normalizeSubstring(ByteSequence substring)
         throws DirectoryException
         throws DecodeException
  {
    // In this case, the logic used to normalize a substring is identical to the
    // logic used to normalize a full value.
    ByteString value = normalizeAttributeValue(substring);
    if (value.length() == 0)
    {
      throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX,
          LocalizableMessage.EMPTY);
      throw DecodeException.error(LocalizableMessage.EMPTY);
    }
    return value;
  }