From c5740d7b39334af983957a9c284ddd792d598f6c Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 10 Jul 2015 15:13:20 +0000
Subject: [PATCH] Code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java b/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
index 4b86808..10a0606 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
@@ -397,21 +397,8 @@
       final byte[] encodedAttribute, final String attributeName,
       final Collection<String> attributeOptions)
   {
-    final AttributeType type = DirectoryServer.getAttributeType(
-        toLowerCase(attributeName), true);
-    final Set<String> options;
-    switch (attributeOptions.size())
-    {
-    case 0:
-      options = Collections.emptySet();
-      break;
-    case 1:
-      options = Collections.singleton(attributeOptions.iterator().next());
-      break;
-    default:
-      options = new LinkedHashSet<>(attributeOptions);
-      break;
-    }
+    final AttributeType type = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeName));
+    final Set<String> options = getOptions(attributeOptions);
     final Entry<AttributeType, Set<String>> ad = new SimpleImmutableEntry<>(type, options);
     final int id = decodeId(encodedAttribute);
     synchronized (adEncodeMap)
@@ -434,7 +421,18 @@
     return ad;
   }
 
-
+  private Set<String> getOptions(final Collection<String> attributeOptions)
+  {
+    switch (attributeOptions.size())
+    {
+    case 0:
+      return Collections.emptySet();
+    case 1:
+      return Collections.singleton(attributeOptions.iterator().next());
+    default:
+      return new LinkedHashSet<>(attributeOptions);
+    }
+  }
 
   /**
    * Loads an encoded object class into this compressed schema. This method may

--
Gitblit v1.10.0