| | |
| | | |
| | | |
| | | |
| | | 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 |
| | | { |
| | |
| | | { |
| | | 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. |
| | |
| | | |
| | | // 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 |
| | |
| | | // 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 = |
| | |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, de); |
| | | TRACER.debugInfo("DN decode failed for: ", dnStr); |
| | | } |
| | | |
| | | Message message = ERR_LDIF_INVALID_DN.get( |
| | |
| | | { |
| | | 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)); |
| | |
| | | { |
| | | 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()); |
| | | |
| | |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | TRACER.debugInfo("DN decode failed for: ", line.substring(pos)); |
| | | } |
| | | |
| | | Message message = ERR_LDIF_INVALID_DN.get( |
| | |
| | | pos++; |
| | | } |
| | | |
| | | String changeTypeString = line.substring(pos); |
| | | |
| | | return changeTypeString; |
| | | return line.substring(pos); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // 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); |
| | | } |
| | |
| | | AttributeBuilder builder = new AttributeBuilder(attribute, true); |
| | | builder.add(attributeValue); |
| | | attrList.add(builder); |
| | | return; |
| | | } |
| | | } |
| | | |
| | |
| | | AttributeBuilder builder = new AttributeBuilder(attribute, true); |
| | | builder.add(attributeValue); |
| | | attrList.add(builder.toAttribute()); |
| | | return; |
| | | } |
| | | } |
| | | } |