[ldap-sdk-commits] SF.net SVN: ldap-sdk:[1573] trunk
A Java-based LDAP API
Brought to you by:
dirmgr,
kennethleo
|
From: <di...@us...> - 2022-10-19 19:00:38
|
Revision: 1573
http://sourceforge.net/p/ldap-sdk/code/1573
Author: dirmgr
Date: 2022-10-19 19:00:36 +0000 (Wed, 19 Oct 2022)
Log Message:
-----------
Fix an issue with Entry.applyModifications
Fixed an issue with the Entry.applyModifications method in which it
could fail with a NOT_ALLOWED_ON_RDN result if the provided entry was
missing one or more attribute values used in its RDN.
Modified Paths:
--------------
trunk/docs/release-notes.html
trunk/src/com/unboundid/ldap/sdk/Entry.java
trunk/tests/unit/src/com/unboundid/ldap/sdk/EntryTestCase.java
Modified: trunk/docs/release-notes.html
===================================================================
--- trunk/docs/release-notes.html 2022-10-11 14:18:43 UTC (rev 1572)
+++ trunk/docs/release-notes.html 2022-10-19 19:00:36 UTC (rev 1573)
@@ -14,6 +14,13 @@
<ul>
<li>
+ Fixed an issue with the Entry.applyModifications method in which it could fail
+ with a NOT_ALLOWED_ON_RDN result if the provided entry was missing one or more
+ attribute values used in its RDN.
+ <br><br>
+ </li>
+
+ <li>
Updated the set of LDAP-related specifications to include the latest version of
draft-schmaus-kitten-sasl-ht.
<br><br>
Modified: trunk/src/com/unboundid/ldap/sdk/Entry.java
===================================================================
--- trunk/src/com/unboundid/ldap/sdk/Entry.java 2022-10-11 14:18:43 UTC (rev 1572)
+++ trunk/src/com/unboundid/ldap/sdk/Entry.java 2022-10-19 19:00:36 UTC (rev 1573)
@@ -2587,12 +2587,15 @@
{
if (! e.hasAttributeValue(rdnAttrs[i], rdnValues[i]))
{
- errors.add(ERR_ENTRY_APPLY_MODS_TARGETS_RDN.get(entry.getDN()));
- if (resultCode == null)
+ if (entry.hasAttributeValue(rdnAttrs[i], rdnValues[i]))
{
- resultCode = ResultCode.NOT_ALLOWED_ON_RDN;
+ errors.add(ERR_ENTRY_APPLY_MODS_TARGETS_RDN.get(entry.getDN()));
+ if (resultCode == null)
+ {
+ resultCode = ResultCode.NOT_ALLOWED_ON_RDN;
+ }
+ break;
}
- break;
}
}
}
Modified: trunk/tests/unit/src/com/unboundid/ldap/sdk/EntryTestCase.java
===================================================================
--- trunk/tests/unit/src/com/unboundid/ldap/sdk/EntryTestCase.java 2022-10-11 14:18:43 UTC (rev 1572)
+++ trunk/tests/unit/src/com/unboundid/ldap/sdk/EntryTestCase.java 2022-10-19 19:00:36 UTC (rev 1573)
@@ -3664,6 +3664,35 @@
/**
+ * Tests the {@code applyModifications} method with an entry that has an RDN
+ * attribute value that isn't present in the entry.
+ *
+ * @throws Exception If an unexpected problem occurs.
+ */
+ @Test()
+ public void testApplyModificationsEntryMissingAttributeValueUsedInRDN()
+ throws Exception
+ {
+ Entry source = new Entry(
+ "dn: cn=test,dc=example,dc=com",
+ "objectClass: top",
+ "objectClass: untypedObject",
+ "objectClass: extensibleObject");
+
+ assertEquals(
+ Entry.applyModifications(source, true,
+ new Modification(ModificationType.REPLACE, "foo", "bar")),
+ new Entry(
+ "dn: cn=test,dc=example,dc=com",
+ "objectClass: top",
+ "objectClass: untypedObject",
+ "objectClass: extensibleObject",
+ "foo: bar"));
+ }
+
+
+
+ /**
* Tests the {@code matchesBaseAndScope} method with a string representation
* of the target DN.
*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|