From cde6a17df0b2ae42e2e44426be4fe60636c446bc Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 31 Jan 2007 21:46:27 +0000
Subject: [PATCH] Fix a problem in the backup backend in which it could throw an internal exception if a search operation was performed whose scope included a backup directory that didn't contain a descriptor file (which is the case in the out-of-the-box configuration before any backups have been performed).

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

diff --git a/opends/src/server/org/opends/server/backends/BackupBackend.java b/opends/src/server/org/opends/server/backends/BackupBackend.java
index 6d92aad..93440bd 100644
--- a/opends/src/server/org/opends/server/backends/BackupBackend.java
+++ b/opends/src/server/org/opends/server/backends/BackupBackend.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Portions Copyright 2006 Sun Microsystems, Inc.
+ *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  */
 package org.opends.server.backends;
 
@@ -351,6 +351,14 @@
     {
       try
       {
+        // Check to see if the descriptor file exists.  If not, then skip this
+        // backup directory.
+        File descriptorFile = new File(f, BACKUP_DIRECTORY_DESCRIPTOR_FILE);
+        if (! descriptorFile.exists())
+        {
+          continue;
+        }
+
         DN backupDirDN = makeChildDN(backupBaseDN, backupPathType,
                                      f.getAbsolutePath());
         getBackupDirectoryEntry(backupDirDN);
@@ -920,6 +928,15 @@
              DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
         for (File f : backupDirectories)
         {
+          // Check to see if the descriptor file exists.  If not, then skip this
+          // backup directory.
+          File descriptorFile = new File(f, BACKUP_DIRECTORY_DESCRIPTOR_FILE);
+          if (! descriptorFile.exists())
+          {
+            continue;
+          }
+
+
           DN backupDirDN = makeChildDN(backupBaseDN, backupPathType,
                                        f.getAbsolutePath());
 

--
Gitblit v1.10.0