mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
16.17.2016 ac272266185cd7aefee60209b4fcfd47733d4d15
refs
author Matthew Swift <matthew.swift@forgerock.com>
Wednesday, March 16, 2016 01:17 +0100
committer Matthew Swift <matthew.swift@forgerock.com>
Wednesday, March 16, 2016 01:46 +0100
commitac272266185cd7aefee60209b4fcfd47733d4d15
tree 86300ae30bd420032757cf0c639bc1e7ca49e9a3 tree | zip | gz
parent a3765efb5b8fda69465b9f8fb433bdf16eb21307 view | diff
OPENDJ-2776 Remove insignificant/illegal whitespace during parsing of DNs

Strictly speaking RFC 4514 does not allow whitespace before or after RDN
or AVA separators. Whilst it is often good practice to be tolerant of
malformed input, we should not produce it.

The DN class was tolerating whitespace characters around the RDN and AVA
separators, but was not removing them, causing the toString() method to
product an invalid string representation.

This change provides a simple fix: do not cache the user provided
string, but instead regenerate it lazily when toString() is called.
Whilst the fix is simple it does incur a slight performance penalty in
the common case where the input DN string is valid.
5 files modified
114 ■■■■ changed files
opendj-sdk/opendj-core/src/main/java/org/forgerock/opendj/ldap/DN.java 35 ●●●●● diff | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java 20 ●●●●● diff | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java 32 ●●●●● diff | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriterTestCase.java 5 ●●●●● diff | view | raw | blame | history
opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java 22 ●●●●● diff | view | raw | blame | history