From 503844c1f6bfdccf6ff6e21c1226a4f7aaa3c3c0 Mon Sep 17 00:00:00 2001
From: sin <sin@localhost>
Date: Thu, 23 Apr 2009 17:15:32 +0000
Subject: [PATCH] Fixes the warning messages generated by fix for issue# 3387

---
 opends/src/server/org/opends/server/schema/AttributeTypeSyntax.java |    7 +++++--
 opends/src/server/org/opends/server/schema/ObjectClassSyntax.java   |   14 ++++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/opends/src/server/org/opends/server/schema/AttributeTypeSyntax.java b/opends/src/server/org/opends/server/schema/AttributeTypeSyntax.java
index d70b289..f8d30fa 100644
--- a/opends/src/server/org/opends/server/schema/AttributeTypeSyntax.java
+++ b/opends/src/server/org/opends/server/schema/AttributeTypeSyntax.java
@@ -538,8 +538,11 @@
         //RFC 2251: A specification may also assign one or more textual names
         //for an attribute type.  These names MUST begin with a letter, and
         //only contain ASCII letters, digit characters and hyphens.
-        boolean allowExceptions =
-                                DirectoryServer.allowAttributeNameExceptions();
+
+        //The global config hasn't been read so far. Allow the name exceptions
+        //during startup.
+        boolean allowExceptions = DirectoryServer.isRunning()?
+                           DirectoryServer.allowAttributeNameExceptions():true;
         //Iterate over all the names and throw an exception if it is invalid.
         for(String name : typeNames)
         {
diff --git a/opends/src/server/org/opends/server/schema/ObjectClassSyntax.java b/opends/src/server/org/opends/server/schema/ObjectClassSyntax.java
index dc8f792..2d76721 100644
--- a/opends/src/server/org/opends/server/schema/ObjectClassSyntax.java
+++ b/opends/src/server/org/opends/server/schema/ObjectClassSyntax.java
@@ -261,8 +261,8 @@
     // and with all lowercase characters.
     String valueStr = value.toString();
     String lowerStr = toLowerCase(valueStr);
-
-
+    boolean allowExceptions = DirectoryServer.isRunning()?
+                        DirectoryServer.allowAttributeNameExceptions():true;
     // We'll do this a character at a time.  First, skip over any leading
     // whitespace.
     int pos    = 0;
@@ -360,7 +360,7 @@
       while ((pos < length) && ((c = valueStr.charAt(pos++)) != ' '))
       {
         if (isAlpha(c) || isDigit(c) || (c == '-') ||
-            ((c == '_') && DirectoryServer.allowAttributeNameExceptions()))
+            ((c == '_') && allowExceptions))
         {
           // This is fine.  It is an acceptable character.
         }
@@ -510,8 +510,6 @@
         //RFC 2251: A specification may also assign one or more textual names
         //for an attribute type.  These names MUST begin with a letter, and
         //only contain ASCII letters, digit characters and hyphens.
-        boolean allowExceptions =
-                                DirectoryServer.allowAttributeNameExceptions();
         //Iterate over all the names and throw an exception if it is invalid.
         for(String name : names)
         {
@@ -1161,8 +1159,8 @@
     // Skip over any spaces at the beginning of the value.
     char c = '\u0000';
     int  length = lowerStr.length();
-    boolean allowExceptions =
-                  DirectoryServer.allowAttributeNameExceptions();
+    boolean allowExceptions = DirectoryServer.isRunning()?
+                        DirectoryServer.allowAttributeNameExceptions():true;
     while ((startPos < length) && ((c = lowerStr.charAt(startPos)) == ' '))
     {
       startPos++;
@@ -1237,7 +1235,7 @@
       while ((startPos < length) && ((c = lowerStr.charAt(startPos++)) != ' '))
       {
         if (isAlpha(c) || isDigit(c) || (c == '-') ||
-            ((c == '_') && DirectoryServer.allowAttributeNameExceptions()))
+            ((c == '_') && allowExceptions))
         {
           woidBuffer.append(c);
         }

--
Gitblit v1.10.0