From 22094368c2865dcfb6daf8366425212b721a4657 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Thu, 05 Feb 2009 17:42:14 +0000
Subject: [PATCH] Merge ASN1 branch to trunk

---
 opends/src/server/org/opends/server/schema/UserPasswordSyntax.java |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java b/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java
index e69d4b7..5dc61ef 100644
--- a/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java
+++ b/opends/src/server/org/opends/server/schema/UserPasswordSyntax.java
@@ -37,11 +37,9 @@
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.ByteString;
-import org.opends.server.types.DirectoryException;
 
 
-import org.opends.server.types.ResultCode;
+import org.opends.server.types.*;
 
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.messages.SchemaMessages.*;
@@ -212,7 +210,7 @@
    * @return  <CODE>true</CODE> if the provided value is acceptable for use with
    *          this syntax, or <CODE>false</CODE> if not.
    */
-  public boolean valueIsAcceptable(ByteString value,
+  public boolean valueIsAcceptable(ByteSequence value,
                                    MessageBuilder invalidReason)
   {
     // We have to accept any value here because in many cases the value will not
@@ -291,18 +289,17 @@
    * @return  <CODE>true</CODE> if the value appears to be encoded using the
    *          user password syntax, or <CODE>false</CODE> if not.
    */
-  public static boolean isEncoded(ByteString value)
+  public static boolean isEncoded(ByteSequence value)
   {
     // If the value is null or empty, then it's not.
-    byte[] valueBytes;
-    if ((value == null) || ((valueBytes = value.value()).length == 0))
+    if ((value == null) || value.length() == 0)
     {
       return false;
     }
 
 
     // If the value doesn't start with an opening curly brace, then it's not.
-    if (valueBytes[0] != '{')
+    if (value.byteAt(0) != '{')
     {
       return false;
     }
@@ -311,9 +308,9 @@
     // There must be a corresponding closing curly brace, and there must be at
     // least one character inside the brace.
     int closingBracePos = -1;
-    for (int i=1; i < valueBytes.length; i++)
+    for (int i=1; i < value.length(); i++)
     {
-      if (valueBytes[i] == '}')
+      if (value.byteAt(i) == '}')
       {
         closingBracePos = i;
         break;
@@ -327,7 +324,7 @@
 
 
     // The closing curly brace must not be the last character of the password.
-    if (closingBracePos == (valueBytes.length - 1))
+    if (closingBracePos == (value.length() - 1))
     {
       return false;
     }

--
Gitblit v1.10.0