From aa4cddefb7237eea616db2b525539cc7c854d41a Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Tue, 29 Jul 2008 10:11:57 +0000
Subject: [PATCH] Fix or indicate possible null pointer dereferencing detected by FindBugs

---
 opends/src/server/org/opends/server/backends/SchemaBackend.java |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/SchemaBackend.java b/opends/src/server/org/opends/server/backends/SchemaBackend.java
index 225d41a..d1e1a05 100644
--- a/opends/src/server/org/opends/server/backends/SchemaBackend.java
+++ b/opends/src/server/org/opends/server/backends/SchemaBackend.java
@@ -4235,7 +4235,8 @@
           AttributeType attrType = AttributeTypeSyntax.decodeAttributeType(
               v.getValue(), schema, false);
           String schemaFile = attrType.getSchemaFile();
-          if (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE))
+          if ((schemaFile != null) &&
+              (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE)))
           {
             // Don't import the file containing the definitions of the
             // Schema elements used for configuration because these
@@ -4287,7 +4288,8 @@
     for (AttributeType removeType : currentAttrTypes.values())
     {
       String schemaFile = removeType.getSchemaFile();
-      if (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE))
+      if ((schemaFile != null) &&
+           (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE)))
       {
         // Don't import the file containing the definitiong of the
         // Schema elements used for configuration because these
@@ -4297,10 +4299,9 @@
       if (!oidList.contains(removeType.getOID()))
       {
         newSchema.deregisterAttributeType(removeType);
-
         if (schemaFile != null)
         {
-          modifiedSchemaFiles.add(schemaFile);
+              modifiedSchemaFiles.add(schemaFile);
         }
       }
     }
@@ -4349,7 +4350,8 @@
           ObjectClass newObjectClass = ObjectClassSyntax.decodeObjectClass(
               v.getValue(), newSchema, true);
           String schemaFile = newObjectClass.getSchemaFile();
-          if (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE))
+          if ((schemaFile != null) &&
+              (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE)))
           {
             // Don't import the file containing the definitions of the
             // Schema elements used for configuration because these
@@ -4406,7 +4408,8 @@
     for (ObjectClass removeClass : currentObjectClasses.values())
     {
       String schemaFile = removeClass.getSchemaFile();
-      if (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE))
+      if ((schemaFile != null) &&
+          (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE)))
       {
         // Don't import the file containing the definitiong of the
         // Schema elements used for configuration because these
@@ -5276,8 +5279,7 @@
           logError(message);
         }
 
-        Message message = ERR_SCHEMA_RESTORE_SIGNED_HASH_INVALID.get(
-              schemaBackupDir.getPath());
+        Message message = ERR_SCHEMA_RESTORE_SIGNED_HASH_INVALID.get(backupID);
         throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                      message);
       }

--
Gitblit v1.10.0