From 4996d2cac0e374a6cfdbed971ad07148c7a9e2fd Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 06 Apr 2016 10:18:12 +0000
Subject: [PATCH] SchemaLoader.java: simplified code

---
 opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java
index 36ec567..4fa60c2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/SchemaLoader.java
@@ -21,7 +21,7 @@
 import java.io.File;
 import java.io.FileFilter;
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import org.forgerock.i18n.LocalizableMessage;
@@ -106,7 +106,7 @@
   {
     schema = getBaseSchema();
 
-    String[] fileNames;
+    List<String> fileNames;
     String schemaDirPath = getSchemaDirectoryPath();
     try
     {
@@ -140,18 +140,16 @@
         }
       };
       File[] schemaFiles = schemaDir.listFiles(ldifFilesFilter);
-      List<String> fileList = new ArrayList<>(schemaFiles.length);
+      fileNames = new ArrayList<>(schemaFiles.length);
       for (File f : schemaFiles)
       {
         if (f.isFile())
         {
-          fileList.add(f.getName());
+          fileNames.add(f.getName());
         }
       }
 
-      fileNames = new String[fileList.size()];
-      fileList.toArray(fileNames);
-      Arrays.sort(fileNames);
+      Collections.sort(fileNames);
     }
     catch (InitializationException ie)
     {
@@ -162,10 +160,9 @@
       throw new InitializationException(ERR_CONFIG_SCHEMA_CANNOT_LIST_FILES.get(schemaDirPath, e.getMessage()), e);
     }
 
-    //  Iterate through the schema files and read them as an LDIF file
-    //  containing a single entry.  Then get the attributeTypes and
-    //  objectClasses attributes from that entry and parse them to
-    //  initialize the server schema.
+    // Iterate through the schema files and read them as an LDIF file containing a single entry.
+    // Then get the attributeTypes and objectClasses attributes from that entry
+    // and parse them to initialize the server schema.
     for (String schemaFile : fileNames)
     {
       SchemaConfigManager.loadSchemaFile(schema, schemaFile);

--
Gitblit v1.10.0