From ec6fcea7eb3b1013db8b26ff65327d3ab24077c9 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 09 Sep 2016 09:45:26 +0000
Subject: [PATCH] OPENDJ-3089 Several minor fixes from the PR
---
opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
index acbb9cf..23e3f8b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
@@ -26,7 +26,6 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.Schema;
import org.forgerock.opendj.ldap.schema.SchemaBuilder;
import org.forgerock.opendj.server.config.server.SynchronizationProviderCfg;
@@ -35,7 +34,6 @@
import org.opends.server.backends.task.Task;
import org.opends.server.backends.task.TaskState;
import org.opends.server.core.DirectoryServer;
-import org.opends.server.core.ServerContext;
import org.opends.server.schema.SchemaHandler;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
@@ -90,10 +88,8 @@
// Get the attribute that specifies which schema file(s) to add.
Entry taskEntry = getTaskEntry();
- ServerContext serverContext = getServerContext();
- AttributeType attrType = serverContext.getSchema().getAttributeType(ATTR_TASK_ADDSCHEMAFILE_FILENAME);
- List<Attribute> attrList = taskEntry.getAllAttributes(attrType);
- if (attrList.isEmpty())
+ Iterable<Attribute> attrList = taskEntry.getAllAttributes(ATTR_TASK_ADDSCHEMAFILE_FILENAME);
+ if (!attrList.iterator().hasNext())
{
LocalizableMessage message = ERR_TASK_ADDSCHEMAFILE_NO_FILENAME.get(
ATTR_TASK_ADDSCHEMAFILE_FILENAME, taskEntry.getName());
@@ -140,7 +136,7 @@
// it will be good to do it now as well so we can reject
// the entry immediately which will fail the attempt by the client to add it
// to the server, rather than having to check its status after the fact.
- final SchemaHandler schemaHandler = serverContext.getSchemaHandler();
+ final SchemaHandler schemaHandler = getServerContext().getSchemaHandler();
final Schema currentSchema = schemaHandler.getSchema();
final SchemaBuilder schemaBuilder = new SchemaBuilder(currentSchema);
for (String schemaFile : filesToAdd)
@@ -239,7 +235,7 @@
final Schema newSchema = schemaBuilder.toSchema();
try
{
- schemaHandler.updateSchemaAndConcatenatedSchemaFiles(newSchema);
+ schemaHandler.updateSchemaAndConcatenatedSchemaFile(newSchema);
}
catch (DirectoryException e)
{
--
Gitblit v1.10.0