From 593afd8aa7240b69a5f2ce212e787246e1757757 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 06 Jun 2016 14:44:52 +0000
Subject: [PATCH] SchemaBackend.java: Generalize use of addIfNotNull()
---
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java | 61 ++++++------------------------
1 files changed, 12 insertions(+), 49 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
index a98e771..b16283a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -1213,14 +1213,9 @@
}
}
- // If we've gotten here, then it's OK to remove the attribute type from
- // the schema.
+ // If we've gotten here, then it's OK to remove the attribute type from the schema.
schema.deregisterAttributeType(removeType);
- String schemaFile = getSchemaFile(removeType);
- if (schemaFile != null)
- {
- modifiedSchemaFiles.add(schemaFile);
- }
+ addIfNotNull(modifiedSchemaFiles, getSchemaFile(removeType));
}
/**
@@ -1460,14 +1455,9 @@
}
}
- // If we've gotten here, then it's OK to remove the objectclass from the
- // schema.
+ // If we've gotten here, then it's OK to remove the objectclass from the schema.
schema.deregisterObjectClass(removeClass);
- String schemaFile = getSchemaFile(removeClass);
- if (schemaFile != null)
- {
- modifiedSchemaFiles.add(schemaFile);
- }
+ addIfNotNull(modifiedSchemaFiles, getSchemaFile(removeClass));
}
/**
@@ -1626,11 +1616,7 @@
// Now remove the name form from the schema.
schema.deregisterNameForm(removeNF);
- String schemaFile = getSchemaFile(removeNF);
- if (schemaFile != null)
- {
- modifiedSchemaFiles.add(schemaFile);
- }
+ addIfNotNull(modifiedSchemaFiles, getSchemaFile(removeNF));
}
/**
@@ -1788,11 +1774,7 @@
// just remove the DIT content rule now, and if it is added back later then
// there still won't be any conflict.
schema.deregisterDITContentRule(removeDCR);
- String schemaFile = getSchemaFile(removeDCR);
- if (schemaFile != null)
- {
- modifiedSchemaFiles.add(schemaFile);
- }
+ addIfNotNull(modifiedSchemaFiles, getSchemaFile(removeDCR));
}
/**
@@ -1978,14 +1960,9 @@
}
}
- // If we've gotten here, then it's OK to remove the DIT structure rule from
- // the schema.
+ // If we've gotten here, then it's OK to remove the DIT structure rule from the schema.
schema.deregisterDITStructureRule(removeDSR);
- String schemaFile = getSchemaFile(removeDSR);
- if (schemaFile != null)
- {
- modifiedSchemaFiles.add(schemaFile);
- }
+ addIfNotNull(modifiedSchemaFiles, getSchemaFile(removeDSR));
}
/**
@@ -2110,11 +2087,7 @@
// just remove the DIT content rule now, and if it is added back later then
// there still won't be any conflict.
schema.deregisterMatchingRuleUse(removeMRU);
- String schemaFile = getSchemaFile(removeMRU);
- if (schemaFile != null)
- {
- modifiedSchemaFiles.add(schemaFile);
- }
+ addIfNotNull(modifiedSchemaFiles, getSchemaFile(removeMRU));
}
/**
@@ -2167,14 +2140,8 @@
schema.registerLdapSyntaxDescription(def, false);
String newSchemaFile = getSchemaFile(schema.getLdapSyntaxDescription(oid));
- if (oldSchemaFile != null)
- {
- modifiedSchemaFiles.add(oldSchemaFile);
- }
- if (newSchemaFile != null)
- {
- modifiedSchemaFiles.add(newSchemaFile);
- }
+ addIfNotNull(modifiedSchemaFiles, oldSchemaFile);
+ addIfNotNull(modifiedSchemaFiles, newSchemaFile);
}
}
@@ -2199,11 +2166,7 @@
}
schema.deregisterLdapSyntaxDescription(removeLSD);
- String schemaFile = getSchemaFile(removeLSD);
- if (schemaFile != null)
- {
- modifiedSchemaFiles.add(schemaFile);
- }
+ addIfNotNull(modifiedSchemaFiles, getSchemaFile(removeLSD));
}
/**
--
Gitblit v1.10.0