From 3e7410b2ec4ceeef110ed4864d86cd56993512fe Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Sat, 26 Sep 2009 18:33:49 +0000
Subject: [PATCH] Rebuild index using new import engine.
---
opends/src/server/org/opends/server/util/LDIFReader.java | 66 ++++++++++++++------------------
1 files changed, 29 insertions(+), 37 deletions(-)
diff --git a/opends/src/server/org/opends/server/util/LDIFReader.java b/opends/src/server/org/opends/server/util/LDIFReader.java
index 48a32ba..e52a697 100644
--- a/opends/src/server/org/opends/server/util/LDIFReader.java
+++ b/opends/src/server/org/opends/server/util/LDIFReader.java
@@ -236,7 +236,7 @@
- private final Entry readEntry(boolean checkSchema, Map<DN, Suffix> map,
+ private Entry readEntry(boolean checkSchema, Map<DN, Suffix> map,
Importer.EntryInformation entryInfo)
throws IOException, LDIFException
{
@@ -244,8 +244,8 @@
{
LinkedList<StringBuilder> lines;
DN entryDN;
- EntryID entryID = null;
- Suffix suffix = null;
+ EntryID entryID;
+ Suffix suffix;
synchronized (this)
{
// Read the set of lines that make up the next entry.
@@ -260,7 +260,14 @@
// Read the DN of the entry and see if it is one that should be included
// in the import.
- entryDN = readDN(lines);
+
+ try
+ {
+ entryDN = readDN(lines);
+ } catch (LDIFException le) {
+ entriesIgnored.incrementAndGet();
+ continue;
+ }
if (entryDN == null)
{
// This should only happen if the LDIF starts with the "version:" line
@@ -904,7 +911,8 @@
// The value did not have a valid base64-encoding.
if (debugEnabled())
{
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ TRACER.debugInfo("Base64 decode failed for dn: ",
+ line.substring(pos));
}
Message message =
@@ -925,7 +933,7 @@
{
if (debugEnabled())
{
- TRACER.debugCaught(DebugLogLevel.ERROR, de);
+ TRACER.debugInfo("DN decode failed for: ", dnStr);
}
Message message = ERR_LDIF_INVALID_DN.get(
@@ -940,9 +948,8 @@
{
if (debugEnabled())
{
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ TRACER.debugInfo("DN decode failed for: ", dnStr);
}
-
Message message = ERR_LDIF_INVALID_DN.get(
lastEntryLineNumber, line.toString(),
String.valueOf(e));
@@ -972,9 +979,8 @@
{
if (debugEnabled())
{
- TRACER.debugCaught(DebugLogLevel.ERROR, de);
+ TRACER.debugInfo("DN decode failed for: ", line.substring(pos));
}
-
Message message = ERR_LDIF_INVALID_DN.get(
lastEntryLineNumber, line.toString(), de.getMessageObject());
@@ -986,7 +992,7 @@
{
if (debugEnabled())
{
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
+ TRACER.debugInfo("DN decode failed for: ", line.substring(pos));
}
Message message = ERR_LDIF_INVALID_DN.get(
@@ -1103,9 +1109,7 @@
pos++;
}
- String changeTypeString = line.substring(pos);
-
- return changeTypeString;
+ return line.substring(pos);
}
}
@@ -1269,51 +1273,41 @@
// Check to see if any of the attributes in the list have the same set of
// options. If so, then try to add a value to that attribute.
- for (int i = 0; i < attrList.size(); i++) {
- AttributeBuilder a = attrList.get(i);
-
- if (a.optionsEqual(attribute.getOptions()))
- {
- if (a.contains(attributeValue))
- {
- if (! checkSchema)
- {
+ for (AttributeBuilder a : attrList) {
+ if (a.optionsEqual(attribute.getOptions())) {
+ if (a.contains(attributeValue)) {
+ if (!checkSchema) {
// If we're not doing schema checking, then it is possible that
// the attribute type should use case-sensitive matching and the
// values differ in capitalization. Only reject the proposed
// value if we find another value that is exactly the same as the
// one that was provided.
- for (AttributeValue v : a)
- {
- if (v.getValue().equals(attributeValue.getValue()))
- {
+ for (AttributeValue v : a) {
+ if (v.getValue().equals(attributeValue.getValue())) {
Message message = WARN_LDIF_DUPLICATE_ATTR.get(
String.valueOf(entryDN),
lastEntryLineNumber, attrName,
value.toString());
logToRejectWriter(lines, message);
throw new LDIFException(message, lastEntryLineNumber,
- true);
+ true);
}
}
- }
- else
- {
+ } else {
Message message = WARN_LDIF_DUPLICATE_ATTR.get(
String.valueOf(entryDN),
lastEntryLineNumber, attrName,
value.toString());
logToRejectWriter(lines, message);
throw new LDIFException(message, lastEntryLineNumber,
- true);
+ true);
}
}
- if (attrType.isSingleValue() && !a.isEmpty() && checkSchema)
- {
+ if (attrType.isSingleValue() && !a.isEmpty() && checkSchema) {
Message message = ERR_LDIF_MULTIPLE_VALUES_FOR_SINGLE_VALUED_ATTR
.get(String.valueOf(entryDN),
- lastEntryLineNumber, attrName);
+ lastEntryLineNumber, attrName);
logToRejectWriter(lines, message);
throw new LDIFException(message, lastEntryLineNumber, true);
}
@@ -1328,7 +1322,6 @@
AttributeBuilder builder = new AttributeBuilder(attribute, true);
builder.add(attributeValue);
attrList.add(builder);
- return;
}
}
@@ -2356,7 +2349,6 @@
AttributeBuilder builder = new AttributeBuilder(attribute, true);
builder.add(attributeValue);
attrList.add(builder.toAttribute());
- return;
}
}
}
--
Gitblit v1.10.0