From 975c043fb68244888e4f4b08583b4704dc3c9076 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Tue, 21 Jun 2011 20:52:08 +0000
Subject: [PATCH] Partial fix for OPENDJ-205: Add support for rejecting and skipping records to the LDIF readers
---
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java | 29 +++++++++++++----------------
1 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java
index 875da3b..c7e21d1 100644
--- a/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java
+++ b/opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java
@@ -784,6 +784,9 @@
* @param attributeDescription
* The LDAP string representation of an attribute description.
* @return The parsed attribute description.
+ * @throws UnknownSchemaElementException
+ * If {@code attributeDescription} contains an attribute type which
+ * is not contained in the default schema and the schema is strict.
* @throws LocalizedIllegalArgumentException
* If {@code attributeDescription} is not a valid LDAP string
* representation of an attribute description.
@@ -791,7 +794,8 @@
* If {@code attributeDescription} was {@code null}.
*/
public static AttributeDescription valueOf(final String attributeDescription)
- throws LocalizedIllegalArgumentException, NullPointerException
+ throws UnknownSchemaElementException, LocalizedIllegalArgumentException,
+ NullPointerException
{
return valueOf(attributeDescription, Schema.getDefaultSchema());
}
@@ -807,17 +811,20 @@
* @param schema
* The schema to use when parsing the attribute description.
* @return The parsed attribute description.
+ * @throws UnknownSchemaElementException
+ * If {@code attributeDescription} contains an attribute type which
+ * is not contained in the provided schema and the schema is strict.
* @throws LocalizedIllegalArgumentException
* If {@code attributeDescription} is not a valid LDAP string
* representation of an attribute description.
* @throws NullPointerException
- * If {@code attributeDescription} or {@code schema} was {@code
- * null}.
+ * If {@code attributeDescription} or {@code schema} was
+ * {@code null}.
*/
@SuppressWarnings("serial")
public static AttributeDescription valueOf(final String attributeDescription,
- final Schema schema) throws LocalizedIllegalArgumentException,
- NullPointerException
+ final Schema schema) throws UnknownSchemaElementException,
+ LocalizedIllegalArgumentException, NullPointerException
{
Validator.ensureNotNull(attributeDescription, schema);
@@ -1005,17 +1012,7 @@
}
// Get the attribute type from the schema.
- final AttributeType attributeType;
- try
- {
- attributeType = schema.getAttributeType(oid);
- }
- catch (final UnknownSchemaElementException e)
- {
- final LocalizableMessage message = ERR_ATTRIBUTE_DESCRIPTION_TYPE_NOT_FOUND
- .get(attributeDescription, e.getMessageObject());
- throw new LocalizedIllegalArgumentException(message);
- }
+ final AttributeType attributeType = schema.getAttributeType(oid);
// If we're already at the end of the attribute description then it
// does not contain any options.
--
Gitblit v1.10.0