| | |
| | | } |
| | | else |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDIF_INVALID_LEADING_SPACE.get(lineNumber, line); |
| | | LocalizableMessage message = ERR_LDIF_INVALID_LEADING_SPACE.get(lineNumber, line); |
| | | logToRejectWriter(lines, message); |
| | | throw new LDIFException(message, lineNumber, false); |
| | | } |
| | |
| | | int colonPos = line.indexOf(":"); |
| | | if (colonPos <= 0) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDIF_NO_ATTR_NAME.get(lastEntryLineNumber, line); |
| | | |
| | | LocalizableMessage message = ERR_LDIF_NO_ATTR_NAME.get(lastEntryLineNumber, line); |
| | | logToRejectWriter(lines, message); |
| | | throw new LDIFException(message, lastEntryLineNumber, true); |
| | | } |
| | |
| | | } |
| | | else if (! attrName.equals("dn")) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_LDIF_NO_DN.get(lastEntryLineNumber, line); |
| | | |
| | | LocalizableMessage message = ERR_LDIF_NO_DN.get(lastEntryLineNumber, line); |
| | | logToRejectWriter(lines, message); |
| | | throw new LDIFException(message, lastEntryLineNumber, true); |
| | | } |
| | |
| | | return DN.rootDN(); |
| | | } |
| | | |
| | | String dn = readValue(line, colonPos, lines); |
| | | return decodeDN(dn, lines, line); |
| | | } |
| | | |
| | | private String readValue(StringBuilder line, int colonPos, List<StringBuilder> lines) throws LDIFException |
| | | { |
| | | if (line.charAt(colonPos+1) == ':') |
| | | { |
| | | // The DN is base64-encoded. Find the first non-blank character and |
| | | // take the rest of the line, base64-decode it, and parse it as a DN. |
| | | // The value is base64-encoded. Find the first non-blank character |
| | | // and take the rest of the line, and base64-decode it. |
| | | int pos = findFirstNonSpaceCharPosition(line, colonPos + 2); |
| | | String dnStr = base64Decode(line.substring(pos), lines, line); |
| | | return decodeDN(dnStr, lines, line); |
| | | return base64Decode(line.substring(pos), lines, line); |
| | | } |
| | | else |
| | | { |
| | | // The rest of the value should be the DN. Skip over any spaces and |
| | | // attempt to decode the rest of the line as the DN. |
| | | // The rest of the value should be the value. Skip over any spaces |
| | | // and attempt to decode the rest of the line as a string. |
| | | int pos = findFirstNonSpaceCharPosition(line, colonPos + 1); |
| | | return decodeDN(line.substring(pos), lines, line); |
| | | return line.substring(pos); |
| | | } |
| | | } |
| | | |
| | |
| | | throw new LDIFException(message, lastEntryLineNumber, false ); |
| | | } |
| | | |
| | | if (line.charAt(colonPos+1) == ':') |
| | | { |
| | | // The change type is base64-encoded. Find the first non-blank character |
| | | // and take the rest of the line, and base64-decode it. |
| | | int pos = findFirstNonSpaceCharPosition(line, colonPos + 2); |
| | | return base64Decode(line.substring(pos), lines, line); |
| | | return readValue(line, colonPos, lines); |
| | | } |
| | | else |
| | | { |
| | | // The rest of the value should be the changetype. Skip over any spaces |
| | | // and attempt to decode the rest of the line as the changetype string. |
| | | int pos = findFirstNonSpaceCharPosition(line, colonPos + 1); |
| | | return line.substring(pos); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Decodes the provided line as an LDIF attribute and adds it to the |