mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

dugan
24.15.2009 458de7e54da932519ce0c17e2470c89c5b5a045c
Fix for issue 4188: invalid schema raises exception import exception
4 files modified
106 ■■■■ changed files
opends/src/messages/messages/jeb.properties 11 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/utility.properties 3 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java 72 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/LDIFReader.java 20 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/jeb.properties
@@ -370,3 +370,14 @@
NOTICE_JEB_IMPORT_LDIF_BUFF_SIZE_LESS_DEFAULT_197=Setting phase one buffer \
size to minimal %d bytes and proceeding
SEVERE_ERR_DATABASE_ERROR_198=Database error during backend operation: %s
SEVERE_ERR_JEB_IMPORT_LDIF_INDEX_WRITE_DB_ERR_199=The following \
error was received while processing the %s index: %s
SEVERE_ERR_JEB_IMPORT_LDIF_IMPORT_TASK_ERR_200=The following \
error was received while processing the import task: %s
SEVERE_ERR_JEB_IMPORT_LDIF_MIGRATE_EXCLUDED_TASK_ERR_201=The following \
error was received while processing the migrate excluded task: %s
SEVERE_ERR_JEB_IMPORT_LDIF_MIGRATE_EXISTING_TASK_ERR_202=The following \
error was received while processing the migrate existing task: %s
SEVERE_ERR_JEB_IMPORT_LDIF_APPEND_REPLACE_TASK_ERR_203=The following \
error was received while processing the append and replace task: %s
opends/src/messages/messages/utility.properties
@@ -619,3 +619,6 @@
INFO_ARGPARSER_USAGE_DEFAULT_VALUE_299=Default value: %s
SEVERE_WARN_EXPORT_LDIF_SET_PERMISSION_FAILED_300=An error occurred while \
 setting file permissions for the LDIF file %s: %s
MILD_ERR_LDIF_READ_ATTR_SKIP_301=Skipping entry %s because the following error \
was received when reading its attributes: %s
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -467,7 +467,8 @@
          InitializationException, IOException, JebException, DatabaseException,
          InterruptedException, ExecutionException
  {
    try {
    try
    {
    this.rootContainer = rootContainer;
    this.reader = new LDIFReader(importConfiguration, rootContainer,
            LDIF_READER_BUFFER_SIZE);
@@ -495,15 +496,10 @@
             .getEntriesRejected(), migratedCount, importTime / 1000, rate);
    logError(message);
    }
    catch(Throwable t) {
        System.out.println("here: " + t.getMessage());
        t.printStackTrace();
    }
    finally
    {
      reader.close();
    }
    return new LDIFImportResult(reader.getEntriesRead(), reader
            .getEntriesRejected(), reader.getEntriesIgnored());
  }
@@ -743,8 +739,8 @@
                // This is the base entry for a branch that was excluded in the
                // import so we must migrate all entries in this branch over to
                // the new entry container.
                byte[] end =
                    StaticUtils.getBytes("," + excludedDN.toNormalizedString());
                byte[] end = StaticUtils.getBytes("," +
                                excludedDN.toNormalizedString());
                end[0] = (byte) (end[0] + 1);
                while(status == OperationStatus.SUCCESS &&
@@ -761,6 +757,13 @@
              }
            }
          }
          catch (Exception e)
          {
            message =
              ERR_JEB_IMPORT_LDIF_MIGRATE_EXCLUDED_TASK_ERR.get(e.getMessage());
            logError(message);
            throw e;
          }
          finally
          {
            cursor.close();
@@ -831,7 +834,16 @@
                  status = cursor.getSearchKeyRange(key, data, lockMode);
                }
              }
            } finally {
          }
          catch(Exception e)
          {
            message =
              ERR_JEB_IMPORT_LDIF_MIGRATE_EXISTING_TASK_ERR.get(e.getMessage());
            logError(message);
            throw e;
          }
          finally
          {
              cursor.close();
              flushIndexBuffers();
              closeCursors();
@@ -840,7 +852,6 @@
        }
      return null;
    }
  }
  /**
@@ -859,6 +870,8 @@
     */
    public Void call() throws Exception
    {
      try
      {
      while (true)
      {
        if (importConfiguration.isCancelled())
@@ -879,6 +892,14 @@
      }
      flushIndexBuffers();
      closeCursors();
      }
      catch(Exception e)
      {
        Message message =
                ERR_JEB_IMPORT_LDIF_APPEND_REPLACE_TASK_ERR.get(e.getMessage());
        logError(message);
        throw e;
      }
      return null;
    }
@@ -1040,7 +1061,8 @@
     */
    public Void call() throws Exception
    {
     try {
      try
      {
      while (true)
      {
        if (importConfiguration.isCancelled())
@@ -1061,10 +1083,15 @@
      }
      flushIndexBuffers();
      closeCursors();
     } catch(Throwable t) {
         System.out.println(t.getMessage());
         t.printStackTrace();
     }
      catch (Exception e)
      {
        Message message =
                ERR_JEB_IMPORT_LDIF_IMPORT_TASK_ERR.get(e.getMessage());
        logError(message);
        throw e;
      }
      return null;
    }
@@ -1424,10 +1451,11 @@
    public Void call() throws Exception
    {
        try {
      byte[] cKey = null;
      ImportIDSet cInsertIDSet = null, cDeleteIDSet = null;
      Integer cIndexID = null;
      try
      {
      indexMgr.openIndexFile();
      SortedSet<Buffer> bufferSet = initializeBuffers();
      while(!bufferSet.isEmpty())
@@ -1474,9 +1502,14 @@
        addToDB(cInsertIDSet, cDeleteIDSet, cIndexID);
      }
      cleanUP();
        }     catch(Throwable t) {
        System.out.println("db here: " + t.getMessage());
        t.printStackTrace();
      }
      catch (Exception e)
      {
        Message message =
              ERR_JEB_IMPORT_LDIF_INDEX_WRITE_DB_ERR.get(indexMgr.getFileName(),
                        e.getMessage());
        logError(message);
        throw e;
    }
      return null;
    }
@@ -1824,7 +1857,8 @@
        dataStream.close();
        indexMgr.setFileLength();
      }
      catch (IOException e) {
      catch (IOException e)
      {
        Message message =
                ERR_JEB_IMPORT_LDIF_INDEX_FILEWRITER_ERR.get(file.getName(),
                        e.getMessage());
opends/src/server/org/opends/server/util/LDIFReader.java
@@ -306,9 +306,18 @@
      }
      catch (LDIFException e)
      {
        entriesRejected.incrementAndGet();
          if (debugEnabled())
          {
            TRACER.debugInfo("Skipping entry %s because the it reading" +
                    "its attributes failed.", entryDN);
          }
          Message message =
                           ERR_LDIF_READ_ATTR_SKIP.get(String.valueOf(entryDN),
                                                       e.getMessage());
          logToSkipWriter(lines, message);
          entriesIgnored.incrementAndGet();
        suffix.removePending(entryDN);
        throw e;
          continue;
      }
      // Create the entry and see if it is one that should be included in the
@@ -344,7 +353,10 @@
        Message message = ERR_LDIF_COULD_NOT_EVALUATE_FILTERS_FOR_IMPORT.
            get(String.valueOf(entry.getDN()), lastEntryLineNumber,
                String.valueOf(e));
        throw new LDIFException(message, lastEntryLineNumber, true, e);
                 logToSkipWriter(lines, message);
          entriesIgnored.incrementAndGet();
          suffix.removePending(entryDN);
          continue;
      }
@@ -390,7 +402,7 @@
          logToRejectWriter(lines, message);
          entriesRejected.incrementAndGet();
          suffix.removePending(entryDN);
          throw new LDIFException(message, lastEntryLineNumber, true);
          continue;
        }
      }
      entryInfo.setEntryID(entryID);